public void Remove(Powerup powerup) { if (powerup.type == PickupType.Shield) { shieldPowerup = (ShieldPowerup)powerup; if (shieldPowerup.currentHealth <= 0) { if (shieldPowerup.visualModifier) { RestoreMaterial(tankRenderer, shieldPowerup); } shieldPowerup.Deactivate(tankData); activePowerups[shieldPowerup.type] = null; } } // Assemble a list of expired powerups if (powerup.duration <= 0) { if (powerup.visualModifier) { RestoreMaterial(tankRenderer, powerup); } powerup.Deactivate(tankData); activePowerups[powerup.type] = null; } }
public void ShieldPowerupIdentifier() { var shield = Substitute.For <IShield>(); ShieldPowerup powerup = new ShieldPowerup(shield, null); Assert.AreEqual(Powerups.Shield, powerup.Identifier()); }
public void ShieldPowerupCanBeInstnatiatedWithoutDuration() { var shield = Substitute.For <IShield>(); ShieldPowerup powerup = new ShieldPowerup(shield, null); Assert.AreEqual(null, powerup.Duration()); }
public void ShieldPowerupCanBeInstantiated() { var shield = Substitute.For <IShield>(); ShieldPowerup powerup = new ShieldPowerup(shield); Assert.AreEqual(10f, powerup.Duration()); }
public void AddShield(GameObject shieldPrefab, ShieldPowerup powerup) { Destroy(_shield); MessageManager.Instance.ShowShield(); _shield = Instantiate(shieldPrefab, transform); currentShieldHealth = Mathf.Clamp(currentShieldHealth + powerup.shieldHealth, 0, maxShieldHealth); shieldClip.Play(); }
public void ShieldPowerupRemovesShield() { var player = Substitute.For <IShieldable>(); var shield = Substitute.For <IShield>(); ShieldPowerup powerup = new ShieldPowerup(shield); powerup.Remove(player); player.Received().RemoveShield(); }
public void ShieldPowerupAppliesShield() { var player = Substitute.For <IShieldable>(); var shield = Substitute.For <IShield>(); ShieldPowerup powerup = new ShieldPowerup(shield); powerup.Apply(player); player.Received().ApplyShield(shield); }
protected override List <Powerup> GetPowerUps() { float w = GetWidth() / 5; float h = GetHeight() / 5; List <Powerup> lstRetour = new List <Powerup>(); ShotgunPowerup shotgun = new ShotgunPowerup(); FrostOrbPowerup frostOrb = new FrostOrbPowerup(); TimeFreezePowerup timeFreeze = new TimeFreezePowerup(); RandomPowerup rand = new RandomPowerup(); WeaponsLockPowerup wpLock = new WeaponsLockPowerup(); ShieldPowerup shield = new ShieldPowerup(); frostOrb.Position = new Vector2(w + 100, h + 100); shotgun.Position = new Vector2(4 * w - 100, h + 100); timeFreeze.Position = new Vector2(GetWidth() / 2 - 111, GetHeight() / 2 - 111); rand.Position = new Vector2(GetWidth() / 2, GetHeight() / 2 + 100); wpLock.Position = new Vector2(w + 100, 4 * h - 100); shield.Position = new Vector2(4 * w - 100, 4 * h - 100); List <Wall> retour = new List <Wall>(); retour.Add(new Wall(new Vector2(w, h), new Vector2(w, 0))); retour.Add(new Wall(new Vector2(w, h), new Vector2(0, h))); retour.Add(new Wall(new Vector2(3 * w, h), new Vector2(w, 0))); retour.Add(new Wall(new Vector2(4 * w, h), new Vector2(0, h))); retour.Add(new Wall(new Vector2(w, 4 * h), new Vector2(0, -h))); retour.Add(new Wall(new Vector2(w, 4 * h), new Vector2(w, 0))); retour.Add(new Wall(new Vector2(4 * w, 4 * h), new Vector2(-w, 0))); retour.Add(new Wall(new Vector2(4 * w, 4 * h), new Vector2(0, -h))); lstRetour.Add(shotgun); lstRetour.Add(frostOrb); lstRetour.Add(timeFreeze); lstRetour.Add(rand); lstRetour.Add(wpLock); lstRetour.Add(shield); return(lstRetour); }