diff --git a/Game/Assets/Scripts/EffectTrigger.cs b/Game/Assets/Scripts/EffectTrigger.cs index 8ad8711..3eaeb02 100644 --- a/Game/Assets/Scripts/EffectTrigger.cs +++ b/Game/Assets/Scripts/EffectTrigger.cs @@ -1,5 +1,9 @@ -using System.Collections; -using System.Collections.Generic; +/* + * Author: Reza + * Date: 13/2/2025 + * Description: Car obstacle + */ + using UnityEngine; public class EffectTrigger : MonoBehaviour @@ -7,26 +11,21 @@ public class EffectTrigger : MonoBehaviour // The effect name to trigger when the player enters this area public string effectName; - // Check if the player enters the trigger zone - private void OnTriggerStay(Collider other) - { - // Check if the player is in the trigger zone - if (other.CompareTag("Player")) - { - // Trigger the effect based on the specified effectName - if (!PostProcessingManager.Instance.IsEffectActive()) - { - PostProcessingManager.Instance.TriggerEffect(effectName); - } - } - } - // Optionally stop the effect when the player exits the trigger zone private void OnTriggerExit(Collider other) { if (other.CompareTag("Player") && PostProcessingManager.Instance.IsEffectActive()) - { PostProcessingManager.Instance.StopEffect(); - } + } + + // Check if the player enters the trigger zone + private void OnTriggerStay(Collider other) + { + // Check if the player is in the trigger zone + if (!other.CompareTag("Player")) return; + + // Trigger the effect based on the specified effectName + if (!PostProcessingManager.Instance.IsEffectActive()) + PostProcessingManager.Instance.TriggerEffect(effectName); } } \ No newline at end of file