using System.Collections; using System.Collections.Generic; using UnityEngine; public class ForcibleEntryCheck : MonoBehaviour { public ForcibleEntryCtrl fec; private void Awake() { fec = GetComponentInParent<ForcibleEntryCtrl>(); } private void OnTriggerEnter(Collider other) { if (other.gameObject.GetComponent<Bags>()) { if (!fec.FireManOnRightPos.Contains(other.gameObject)) { fec.FireManOnRightPos.Add(other.gameObject); } } } private void OnTriggerExit(Collider other) { if (other.gameObject.GetComponent<Bags>()) { if (fec.FireManOnRightPos.Contains(other.gameObject)) { fec.FireManOnRightPos.Remove(other.gameObject); } } } }