void Start()
{
oldRealLife = -50f;
matCube = new Material[lifebar.Length];
lerpDanger = 0f;
realLife = 40f;
objectivLife = 50f;
numberStep = (75f/(float)(lifebar.Length - 1));
var index = realLife <= 25 ? 0 : ((int)((realLife - 25f)/numberStep) + 1);
for(int i=0; i<lifebar.Length; i++){
matCube[i] = lifebar[i].renderer.material;
if(i < index){
lifebar[i].transform.localScale = baseScale[i];
}else if(i > index){
lifebar[i].transform.localScale = baseScale[i]*0f;
}else if(index == i && i == 0){
lifebar[index].transform.localScale = baseScale[index]*(realLife/25f);
}else{
lifebar[index].transform.localScale = baseScale[index]*(((realLife - 25f)%numberStep)/numberStep);
}
}
lifeUpPlayin = false;
lifeMaxPlayin = false;
lifeLowPlayin = false;
}
public void Select() { if (!objscript.building) { origX = transform.position.x; origZ = transform.position.z; formscript.LX.Add(origX); formscript.LZ.Add(origZ); } CHselected.Play(); //LIFE BAR OPTIMIZATIONS BEGIN lifebarr.SetActive(true); Lbar.Start(); Lbar.Upd8Life(); //LIFE BAR OPTIMIZATIONS END //INFORM SELECTEDTROOPS SCRIPT BEGIN SelectedTroops.TotalNB++; if (objscript.tip == "Villager") { SelectedTroops.ChangelingsNB++; } if (objscript.tip == "Ponies-At-Arms") { SelectedTroops.PAANB++; } //INFORM SELECTEDTROOPS SCRIPT END mothership.transform.tag = "troopsel"; //SET SEL TAG mothership.transform.SetParent(formationSupplicant.transform.parent); selection.gameObject.SetActive(true); selected = true; }