i made some thing from one tutrial…no make lot of changes in it… and gonna make more…
now i got some problem in here…
i wanan define one wariable but for all …
please some one help me :
this give me error… and i dunno where should i fix that…
private var creationTime=Time.time;
var LifeTime=3;
var DoDamageRange=10;
var explosionPrefab:Transform;
function Awake ()
{
creationTime=Time.time;
}
function Update()
{
if(Time.time>creationTime+LifeTime)
{
Destroy(gameObject);
Instantiate(explosionPrefab,transform.position,Quaternion.identity);
//destroy around obj
var cols = Physics.OverlapSphere(transform.position, DoDamageRange);
for (i = 0; i < cols.Length; i++)
{
if (cols[i].gameObject.tag=="turret")
{
GameObject.Find("GUI Text").guiText.text=""+ cols[i].GetComponent("TurretControl").TURRET_HEALTH;
cols[i].gameObject.GetComponent("TurretControl").TURRET_HEALTH = cols[i].GetComponent("TurretControl").TURRET_HEALTH - 25;//Destroy(cols[i].gameObject);
}
}
}
}
[/code]