using System; using System.Collections; using System.Collections.Generic; using UnityEngine; using UnityEngine.PlayerLoop; public class CarTempManager : MonoBehaviour { private bool isTrgg = false; private void OnTriggerStay(Collider other) { if (other.name == "动物") { if(isTrgg) return; isTrgg = true; errorUI.SetActive(true); che.GetComponent().isKinematic = true; che.transform.position = new Vector3(che.transform.position.x-0.1f, che.transform.position.y, che.transform.position.z-0.1f); Debug.Log(other.name); MBOXManager.Instance.Bonk(); } } void Update() { if (Input.GetKeyDown(KeyCode.JoystickButton4)) { errorUI.SetActive(false); che.GetComponent().isKinematic = false; } } private void OnTriggerExit(Collider other) { isTrgg = false; } private void OnTriggerEnter(Collider other) { } public GameObject errorUI; public GameObject che; // private void OnCollisionEnter(Collision other) // { // // // Debug.Log(other.transform.name); // } }