Timer avec son
Page 1 sur 1
Timer avec son
#pragma strict
var timer : float = 60.0;
var timebase : float = 60.0;
var soundshot : AudioClip;
function Update () {
timer -= Time.deltaTime;
if (timer <= 0) {
timer = 0;
GetComponent.<AudioSource>().PlayOneShot(soundshot);
Debug.Log("Timer = 0");
timer += timebase;
}
}
function OnGUI () {
GUI.Box(new Rect(420,40,50,25),timer.ToString("0"));
}
var timer : float = 60.0;
var timebase : float = 60.0;
var soundshot : AudioClip;
function Update () {
timer -= Time.deltaTime;
if (timer <= 0) {
timer = 0;
GetComponent.<AudioSource>().PlayOneShot(soundshot);
Debug.Log("Timer = 0");
timer += timebase;
}
}
function OnGUI () {
GUI.Box(new Rect(420,40,50,25),timer.ToString("0"));
}
Page 1 sur 1
Permission de ce forum:
Vous ne pouvez pas répondre aux sujets dans ce forum
|
|