using System.Collections; using System.Collections.Generic; using UnityEngine; public class BoxDools : MonoBehaviour { // Start is called before the first frame update void Start() { } private void OnTriggerEnter(Collider other) { if (other != null) { for (int i = 0; i < GameManager.Instance.interactive.Count; i++) { if (GameManager.Instance.interactive[i]) { if (!GameManager.Instance.interactive[i].GetComponent().启用交互) { GameManager.Instance.interactive[i].GetComponent().启用交互 = true; } } } } } private void OnTriggerExit(Collider other) { if (other != null) { for (int i = 0; i < GameManager.Instance.interactive.Count; i++) { if (GameManager.Instance.interactive[i]) { GameManager.Instance.interactive[i].GetComponent().启用交互 = false; if (GameManager.Instance.interactive[i].GetComponent().是否开门) { GameManager.Instance.interactive[i].GetComponent().animator.Play(GameManager.Instance.interactive[i].GetComponent().关门动画); } } } } } }