public override void Atack(Player player, GameTime gameTime) { if (!IsReloading) { MissileBase missile = new MissileBase(player, AtackPoints, Random.NextDouble() <= Accuracy, new Point((int)(2 * (500 - PosX) * (1.5 - (double)player.PlayerID) + 500), (int)Force.PosY + (int)(170 * 0.2)), new Point((int)(2 * (500 - player.PlayerBase.PosX) * ((double)player.PlayerID - 1.5) + 500), (int)Force.PosY + (int)(170 * 0.2))); MissileBase missile2 = new MissileBase(player, AtackPoints, Random.NextDouble() <= Accuracy, new Point((int)(2 * (500 - PosX) * (1.5 - (double)player.PlayerID) + 500), (int)Force.PosY + (int)(170 * 0.2)), new Point((int)(2 * (500 - player.PlayerBase.PosX) * ((double)player.PlayerID - 1.5) + 500), (int)Force.PosY + (int)(170 * 0.2))); MissileBase missile3 = new MissileBase(player, AtackPoints, Random.NextDouble() <= Accuracy, new Point((int)(2 * (500 - PosX) * (1.5 - (double)player.PlayerID) + 500), (int)Force.PosY + (int)(170 * 0.2)), new Point((int)(2 * (500 - player.PlayerBase.PosX) * ((double)player.PlayerID - 1.5) + 500), (int)Force.PosY + (int)(170 * 0.2))); GameEffectsEngine.Add(missile); GameEventEngine.Add(new GameEventDelayed(() => { GameEffectsEngine.Add(missile2); }, 0.04)); GameEventEngine.Add(new GameEventDelayed(() => { GameEffectsEngine.Add(missile3); }, 0.08)); GameEventEngine.Add(new GameEventDelayed(() => { IsReloading = false; }, ReloadTime)); IsReloading = true; } }
public void Defend(MissileBase missileBase) { if (missileBase.IsAccurate) { Hp -= missileBase.Damage * Armor; if (Hp < 0) { Hp = 0; } } }