public override void Update(float TimeEllapsed) { AnimationPosition += 0.2f; if (AnimationPosition >= AnimationFrameCount) { AnimationPosition -= AnimationFrameCount; } SpriteSource.X = (int)Math.Floor(AnimationPosition) * SpriteWidth; if (Position.Y < 640) { Angle = SuperTank2.TurnToFace(Position, Near.Position, Angle, TurnSpeed); } Speed.X = (float)Math.Cos(Angle) * 3 * TimeEllapsed; Speed.Y = (float)Math.Sin(Angle) * 3 * TimeEllapsed; Position += Speed; UpdateTransformationMatrix(); if (Position.Y > 740) { for (int i = 0; i < 5; i++) { new FlameParticle(Position, (60 + SuperTank2.Randomizer.Next(60)) * SuperTank2.DegToRad, 2 + SuperTank2.Randomizer.NextDouble() * 5).AddParticule(); Smoke.AddSmoke(new BombSmoke(Position, (80 + SuperTank2.Randomizer.Next(20)) * SuperTank2.DegToRad, 0)); } GroundExplosion.AddGroundExplosion(new GroundExplosion(new Vector2(Position.X, 730))); Resist = 0; } new Propulsor(Position, Angle, -SuperTank2.Randomizer.NextDouble() * 5).AddParticule(); }
public static void AddSmoke(Smoke NewSmoke) { for (int B = 0; B < Smoke.ListSmoke.Count; B++) { if (!Smoke.ListSmoke[B].IsAlive) { Smoke.ListSmoke[B] = NewSmoke; return; } } Smoke.ListSmoke.Add(NewSmoke); }
public override void Destroyed(Vehicule Destroyer) { ActiveLaser.Resist = 0; IsAlive = false; if (Destroyer == null) { return; } for (int i = 0; i < 10; i++) { new FlameParticle(Position, SuperTank2.Randomizer.Next(360) * SuperTank2.DegToRad, SuperTank2.Randomizer.NextDouble() * 5).AddParticule(); } if (SuperTank2.Randomizer.Next(10 - ((int)SuperTank2.Difficulty * 4)) == 1) { PowerUp.AddPowerUp(new PowerUp(new Vector2(Position.X, Position.Y), PowerUp.ArrayPowerUpChoice[SuperTank2.Randomizer.Next(18)])); } Explosion.AddExplosion(new Explosion1(Position, 0, 0)); for (int i = 0; i < 4; i++) { Smoke.AddSmoke(new PlaneSmoke(Position, (float)(Math.Sign(Speed.X) * Math.PI - 10 * SuperTank2.DegToRad + SuperTank2.Randomizer.Next(20) * SuperTank2.DegToRad), 1 + SuperTank2.Randomizer.Next(4))); } if (SuperTank2.Difficulty == DifficultyChoices.Normal) { Destroyer.Points += 20; Destroyer.Argent += 10; } else if (SuperTank2.Difficulty == DifficultyChoices.Hard) { Destroyer.Points += 30; Destroyer.Argent += 15; } else if (SuperTank2.Difficulty == DifficultyChoices.Expert) { Destroyer.Points += 40; Destroyer.Argent += 20; } }
public override void Destroyed(Vehicule Destroyer) { for (int i = 0; i < 5; i++) { new FlameParticle(Position, SuperTank2.Randomizer.Next(360) * SuperTank2.DegToRad, SuperTank2.Randomizer.NextDouble() * 5).AddParticule(); Smoke.AddSmoke(new PlaneSmoke(Position, (float)(Angle - 10 * SuperTank2.DegToRad + SuperTank2.Randomizer.Next(20) * SuperTank2.DegToRad), 1 + SuperTank2.Randomizer.Next(4))); } if (SuperTank2.Difficulty == DifficultyChoices.Normal) { Destroyer.Points += 6; Destroyer.Argent += 3; } else if (SuperTank2.Difficulty == DifficultyChoices.Hard) { Destroyer.Points += 10; Destroyer.Argent += 5; } else if (SuperTank2.Difficulty == DifficultyChoices.Expert) { Destroyer.Points += 16; Destroyer.Argent += 8; } }