private void OnEnable() { fuelUI = GetComponent <Text>(); RocketMove player = GameObject.FindGameObjectWithTag("Player").GetComponent <RocketMove>(); player.FuelLevelChange += UpdateUI; }
public void Defend(RocketMove rocket) { // reduce hitpoints Defend(rocket.AttackDamage); // spawn shield if (shield == null) { shield = Prefabs.Instance.GetNewShield(); shield.renderer.material.SetColor("_Tint", Color.red); } else shield.GetComponent<FadeOutAndDestroy>().Reset(); shield.transform.forward = -rocket.dir; shield.transform.position = transform.position - rocket.dir * ShieldDistance; shield.transform.parent = transform; }
public void Defend(RocketMove rocket) { // reduce hitpoints Defend(rocket.AttackDamage); // spawn shield if (shield == null) { shield = Prefabs.Instance.GetNewShield(); shield.renderer.material.SetColor("_Tint", Color.red); } else { shield.GetComponent <FadeOutAndDestroy>().Reset(); } shield.transform.forward = -rocket.dir; shield.transform.position = transform.position - rocket.dir * ShieldDistance; shield.transform.parent = transform; }