DET25-Psychosis/Assets/Scenes/Alex/FakeGuy1Trigger.cs
Alexandros Dianellos 156108a2d5 Menu/Guy1Script/Audio
2025-03-16 22:21:45 +02:00

35 lines
906 B
C#

using UnityEngine;
public class FakeGuy1Trigger : MonoBehaviour
{
public AudioSource creepyLaugh;
void OnTriggerEnter(Collider other)
{
Debug.Log("Trigger Entered by: " + other.gameObject.name);
if (IsHandOrController(other))
{
Debug.Log("Controller or hand detected! Attempting to play creepy laugh...");
if (!creepyLaugh.isPlaying)
{
creepyLaugh.Play();
Debug.Log("Sound should be playing now!");
}
else
{
Debug.Log("Sound was already playing!");
}
}
}
private bool IsHandOrController(Collider other)
{
return other.CompareTag("LeftController") ||
other.CompareTag("RightController") ||
other.CompareTag("LeftHand") ||
other.CompareTag("RightHand");
}
}