28 lines
578 B
C#
28 lines
578 B
C#
using Unity.Burst.Intrinsics;
|
|
using UnityEngine;
|
|
|
|
public class NewMonoBehaviourScript : MonoBehaviour
|
|
{
|
|
[SerializeField] private Animator myDoor = null;
|
|
|
|
// [SerializeField] private bool doorState = false; // open state
|
|
private void OnTriggerEnter(Collider other)
|
|
{
|
|
if (other.CompareTag("Player"))
|
|
{
|
|
|
|
myDoor.Play("DoorOpen", 0,0.0f);
|
|
|
|
}
|
|
}
|
|
|
|
private void OnTriggerExit(Collider other)
|
|
{
|
|
if (other.CompareTag("Player"))
|
|
{
|
|
myDoor.Play("DoorClose", 0, 0.0f);
|
|
|
|
}
|
|
}
|
|
}
|