virtual public bool GetDamage(float damage, float power, bool showFlyHit) { if (showFlyHit == true) { ShowDebugText(transform.position + Vector3.up * 2, "", " / " + damage.ToString("f1") + " / " + power.ToString("f1") + " / " + healthModul.ToString("f1"), 1); } if (power > armoreModul) { healthModul -= damage; } if (healthModul < 50 && smokeObj == null) { smokeObj = Instantiate(Resources.Load("Prefabs/Effects/SmokeLight") as GameObject); smokeObj.transform.parent = this.transform; smokeObj.transform.localPosition = Vector3.zero; sparkleObj = Instantiate(Resources.Load("Prefabs/Effects/Sparkle") as GameObject); sparkleObj.transform.parent = this.transform; sparkleObj.transform.localPosition = Vector3.zero; } if (healthModul < 0) { healthModul = 0; modulStatus = ModulStatus.Off; } return(false); }
virtual public void CheckMenuState(ModulStatus modulStatus) { if (modulStatus == ModulStatus.On) { currentColor = enableColor; } if (modulStatus == ModulStatus.Off) { currentColor = disableColor; } }
public void OnEnable() { healthModul = 100; modulStatus = ModulStatus.Off; thisTransform = GetComponent <Transform>(); if (information.Length == 0) { information = new string[10]; information[0] = "Name modul " + gameObject.name; information[1] = "About modul "; information[2] = "State modul " + modulStatus.ToString(); information[3] = "Health modul " + healthModul.ToString(); information[4] = "Armore modul " + armoreModul.ToString(); } }
public override void CheckMenuState(ModulStatus modulStatus) { base.CheckMenuState(modulStatus); if (modul.EnergyValue <= modul.energyMinToAction) { reloadImage.color = allarmColor; } else { reloadImage.color = defaultColor; } reloadTimeText.color = currentColor; nameWeaponText.color = currentColor; reloadSlider.maxValue = modul.energyMaxValue; reloadSlider.value = modul.EnergyValue; reloadTimeText.text = modul.EnergyValue.ToString("f0"); }
void OnDisable() { modulStatus = ModulStatus.None; }