• Benvenuto in Making Videogames!
  • Dai sfogo alla tua fantasia!
  • Crea il tuo Videogioco!
Benvenuto ospite! Login Registrati




Valutazione discussione:
  • 0 voto(i) - 0 media
  • 1
  • 2
  • 3
  • 4
  • 5
Script Timer
#1
Questo è un semplice script per un timer! L'ho fatto io Big Grin Me l'aveva chiesto un utente sul mio forum...
Se vi servirà usatelo xD

Codice:
/*------------------Script by KillerZ :D -----------------*/
var passedTime : int = 0;
var startFunction : boolean = false;
var activate : boolean = false;

function Start()
{
    activate = true;
    startFunction = true;
}

function Update()
{
    if(startFunction)
    {
        startFunction = false;
        CalcTime();
    }
}

function OnGUI()
{
    GUILayout.Label(passedTime.ToString());
    if(GUILayout.Button("Stop Timer") && activate)
    {
        activate = false;
    }
    if(GUILayout.Button("Start Timer") && !activate)
    {
        startFunction = true;
        activate = true;
    }
    if(GUILayout.Button("Restart Timer"))
    {
        passedTime = 0;
    }
}

function CalcTime()
{
    while(activate)
    {
        passedTime += 1;
        yield WaitForSeconds(1);
    }
}
 
Rispondi
#2
bello! lo hai fatto tu??
 
Rispondi
#3
si l'avevo scritto già xD
 
Rispondi
  


Discussioni simili
Discussione Autore Risposte Letto Ultimo messaggio
  Tutorial Timer KillerZ 3 729 01-12-2010, 03:36 PM
Ultimo messaggio: KillerZ

Vai al forum:


Browsing: 1 Ospite(i)