- Home /
how to make scary sound if player look and close with enemy ?
BOO !!!
how to make scary sound if player look and close with enemy ?
how to play a sound when players see enemies and close to the players ...? and sound just spinning one time ... and when palyer does not see the sound being off ... and when players see the enemy, the sound comes back on?
allowing the player to shout / surprised ...?
Answer by $$anonymous$$ · Aug 14, 2013 at 06:26 PM
attach this to a cube , then make the cube tiny but make it have a large collider (this is the area in which the sound can be heard) then make it a trigger and child it to your enemy. On this game object you must have an audio source, also make sure your scene view camera is not on your enemy when you use renderer.isVisible your player should be tagged as Player
function OnTriggerEnter(other : Collider){
if(other.gameObject.tag == "Player" && renderer.isVisible){
audio.Play();
}
}
Your answer
Follow this Question
Related Questions
Play sound when looking at enemy? 1 Answer
Enemy follows the only player in rotation 2 Answers
can foe hear us? 1 Answer
Attack Enemy if looking at C# 2 Answers
Problem with Flashlight in Horror Game 2 Answers