using System.Collections; using System.Collections.Generic; using UnityEngine; public class flow3_InteractiveObject : ToolBase { public GameObject mubiao; public Animator 柜门开关; // Start is called before the first frame update void Start() { } // Update is called once per frame void Update() { } //private void OnTriggerEnter(Collider other) //{ // if (other.name == "Player") // { // Debug.Log("up"); // other.transform.position = mubiao.transform.position; // } //} private void OnCollisionEnter(Collision collision) { if (collision.gameObject.name == "Player") { Debug.Log("up"); collision.transform.position = mubiao.transform.position; //collision.rigidbody.AddForce(0, 100, 10); 柜门开关.Play("配电箱门打开"); } } private void OnTriggerExit(Collider other) { if (other.name == "Player") { 柜门开关.Play("配电箱门关闭"); } } }