using System.Collections; using System.Collections.Generic; using UnityEngine; using Aura2API; public class TriggerSpook : MonoBehaviour { public AudioSource aSource; public GameObject lightSource; private bool playedAudio; public bool audioSpook; public bool lightSpook; private void OnTriggerEnter(Collider other) { if(audioSpook) { if(aSource != null) { if (!playedAudio && other.gameObject.name == "FPSController") { aSource.Play(); playedAudio = true; } } else Debug.LogWarning("A sound spook tried to activate but no audio source was given."); } if(lightSpook) { if (lightSource != null) { if(other.gameObject.name == "FPSController") lightSource.GetComponent<Flicker>().flicker = true; } else Debug.LogWarning("A light spook tried to activate but no light source object was given."); } } public void ResetSpook() { playedAudio = false; } public void ManualTriggerSpook() { if (audioSpook) { if (aSource != null) { if (!playedAudio) { aSource.Play(); playedAudio = true; } } else Debug.LogWarning("A sound spook tried to activate but no audio source was given."); } if (lightSpook) { if (lightSource != null) { lightSource.GetComponent<Flicker>().flicker = true; } else Debug.LogWarning("A light spook tried to activate but no light source object was given."); } } }