Once again hello beautiful Unity Answers members!
I have been biting my lip over this for an hour now. In my short demo level, I want a fireball to appear when the player holds down the right mouse key, and disappear when he releases this key. I got the particle system to work, but no matter how i edit this script for the sound, I cant get it to work! I need the sound to loop if the right mouse key is held down, and to stop playing when the right mouse key is released.
Script:
var firesound : AudioClip;
function Start () {
particleEmitter.emit = false;
}
function Update ()
{
if (Input.GetMouseButtonDown (1)){
particleEmitter.emit = true;
audio.PlayOneShot(firesound);
if (Input.GetMouseButtonUp (1))
particleEmitter.emit = false;
audio.stop(firesound);
}
}
Halp?