using System.Collections;
using System.Collections.Generic;
using UnityEngine;

public class TriggerZone : MonoBehaviour
{
    [SerializeField]
    private Triggerable linkedObj;
    [SerializeField]
    private bool onEnter = true, onStay = false, OnExit = false;
    // Start is called before the first frame update
    private void OnTriggerEnter(Collider other) {
        if(!onEnter)return;
        if(other.gameObject.tag.Equals("Player")){
            linkedObj.TriggerEvent();
        }
    }

    private void OnTriggerStay(Collider other) {
        if(!onStay)return;
        if(other.gameObject.tag.Equals("Player")){
            linkedObj.TriggerEvent();
        }
    }

    private void OnTriggerExit(Collider other) {
        if(!OnExit)return;
        if(other.gameObject.tag.Equals("Player")){
            linkedObj.TriggerEvent();
        }
    }
}
