Beispiel #1
0
 public void Die()
 {
     IsDead = true;
     if (this is Unit)
     {
         UnitAnimation a = new UnitAnimation((Unit)this, Width, .5f, true, Unit.Explosion1Textures);
         a.Start();
     }
 }
Beispiel #2
0
        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--;
                }
            }
        }
Beispiel #3
0
 public void Die()
 {
     IsDead = true;
     if (this is Unit)
     {
         UnitAnimation a = new UnitAnimation((Unit)this, Width, .5f, true, Unit.Explosion1Textures);
         a.Start();
     }
 }
Beispiel #4
0
        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);
        }