How can I add a countdown in this script, by pressing the left mouse button? Every click counts minus 1. 10,9,8,7,6,5,4,3,2,1,0 example. ?
This currently does not work in this script does not understand the problem.
![alt text][1]
![alt text][2]
#pragma strict
var myTrigger : GameObject;
var myObject : GameObject;
var countAmmo : int = 10 ;
private var score : int = 10;
var guiScore : GUIText;
function Start ()
{
guiScore.text = "Score: 10";
}
function Update()
{
if(Input.GetButtonDown("Fire1"))
countAmmo = countAmmo -1;
score = countAmmo -1;
if(countAmmo == 0)
if(score == -1)
{
myObject.SetActive(false);
}
else
{
guiScore.text = "Score: -1";
myObject.SetActive(true);
}
// score -= 10;
// guiScore.text = "Score: " + score;
}
[1]: /storage/temp/45724-countdown.jpg
[2]: /storage/temp/45725-image-es.jpg
↧