void OnControllerColliderHit(ControllerColliderHit hit) { //Debug.Log(hit.gameObject.tag); if (hit.gameObject.tag == "Door") { DoorBehavior doorBehavior = hit.gameObject.GetComponent <DoorBehavior>(); if (!doorBehavior.isOpen) { doorBehavior.OpenDoor(); } } }
public void Toggle(bool state) { trig = state; if (state) { door.OpenDoor(); door.CollDisable(); } else { door.CloseDoor(); door.CollEnable(); } }