void OnTriggerEnter(Collider other) { if (other.tag == "Player" && !isPlayed) { AnimationObject.Play(); if (AnimationSound) { Tools.PlayOneShot2D(transform.position, AnimationSound, SoundVolume); } effects.Scare(ScareLevelSec); isPlayed = true; } }
void OnTriggerEnter(Collider other) { if (other.tag == "Player" && !isPlayed) { AnimationObject.Play(); if (AnimationSound) { AudioSource.PlayClipAtPoint(AnimationSound, Camera.main.transform.position, SoundVolume); } effects.Scare(ScareLevelSec); isPlayed = true; } }
private void OnTriggerEnter(Collider other) { if (other.gameObject.tag == "Player" && !isPlayed) { Box1 = Instantiate(Box, spawnposition.transform.position, Quaternion.identity) as GameObject; boxRB = Box1.GetComponent <Rigidbody>(); boxRB.AddForce(transform.forward * 1000); Box1 = Instantiate(Box, spawnposition.transform.position, Quaternion.identity) as GameObject; boxRB = Box1.GetComponent <Rigidbody>(); boxRB.AddForce(transform.forward * 1000); if (AnimationSound) { Tools.PlayOneShot2D(transform.position, AnimationSound, SoundVolume); } effects.Scare(ScareLevelSec); isPlayed = true; } }