How to trigger sound with key and gui element displayed?
Hi guys,
I have a question I really can't get an answer on the internet. The point is, I have no experience in programming so... I try to understand as well as I can. I would like to have a script that triggers a sound but only if you're in the trigger area and if you press a random key. I also need a gui element on screen to say "press X key to play sound".
Can someone help me?
I already have a script that play sound when I enter the trigger zone but I want it to need to press a key to make it works and have this gui element... Here it is:
pragma strict
var sound : AudioClip;
function Start () {
}
function OnTriggerEnter(Col : Collider) {
if(Col.CompareTag("Player")) { GetComponent.().PlayOneShot(sound); }
}
(by the way, I don't care if you can help in JV or C#, I'll take what you could give me.)
Thanks ! Florian