Esempio n. 1
0
    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;
		}
Esempio n. 3
0
        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;
        }