public void Die() { IsDead = true; if (this is Unit) { UnitAnimation a = new UnitAnimation((Unit)this, Width, .5f, true, Unit.Explosion1Textures); a.Start(); } }
public static void UpdateAll() { for (int i = 0; i < UnitAnimations.Count; i++) { UnitAnimation a = UnitAnimations[i]; a.Update(); if (!a.IsRunning || (!a.StayAfterDeath && a.Unit.IsDead)) { UnitAnimations.Remove(a); i--; } } }
void giveAttackCommand(Vector2 mousePosition) { foreach (Unit unit in Unit.Units) { if (unit.Contains(mousePosition)) { UnitAnimation a = new UnitAnimation(unit, unit.Width, .75f, 8, false, redCircleTexture, transparentTexture); a.Start(); foreach (Unit u in SelectedUnits) { if (u != unit) { if (keyboardState.IsKeyUp(Keys.LeftShift)) { AttackCommand command = new AttackCommand(unit); u.GiveCommand(command); Unit.PathFinder.AddPathFindRequest(u, command, u.CurrentPathNode, false); //u.GiveCommand(new AttackCommand(unit)); } else u.QueueCommand(new AttackCommand(unit)); } } return; } } giveMoveCommand(mousePosition); }