1
0
Files
LupiNexMedia f84f5c592b initial commit
2026-04-28 09:32:03 +02:00

27 lines
708 B
C#

using UnityEngine;
public class DoorOpener : MonoBehaviour
{
private Animator doorAnimator;
void Start()
{
// Get the Animator component attached to the same GameObject as this script
doorAnimator = GetComponent<Animator>();
}
private void OnTriggerEnter(Collider other)
{
// Check if the object entering the trigger is the player (or another specified object)
if (other.CompareTag("Player")) // Make sure the player GameObject has the tag "Player"
{
if (doorAnimator != null)
{
// Trigger the Door_Open animation
doorAnimator.SetTrigger("Door_Open");
}
}
}
}