using System.Collections; using System.Collections.Generic; using UnityEngine; public class Doorchange : MonoBehaviour { public door_control[] door_Control; // Start is called before the first frame update void Start() { } // Update is called once per frame void Update() { } private void OnTriggerExit(Collider other) { if (other.name == "Player") { for (int i = 0; i < door_Control.Length; i++) { door_Control[i].启用交互 = false; if (door_Control[i].是否开门 == true) { door_Control[i].animator.Play(door_Control[i].关门动画); } } } } private void OnTriggerEnter(Collider other) { if (other.name == "Player") { for (int i = 0; i < door_Control.Length; i++) { door_Control[i].启用交互 = true; //door_Control[i].animator.Play(door_Control[i].关门动画); } } } }