Ejemplo n.º 1
0
 public void Update(Actor caller)
 {
     if (CycleCount < 120)
     {
         ++CycleCount;
         caller.StopMovement();
         switch (direction)
         {
             case 0:
                 caller.MoveDown();
                 break;
             case 1:
                 caller.MoveLeft();
                 break;
             case 2:
                 caller.MoveRight();
                 break;
             case 3:
                 caller.MoveUp();
                 break;
         }
     }
     else if (PauseCount < 60)
     {
         ++PauseCount;
         caller.StopMovement();
     }
     else
     {
         CycleCount = 0;
         PauseCount = 0;
         direction = rand.Next(0, 3);
     }
 }
Ejemplo n.º 2
0
        public void Update(Actor caller)
        {
            caller.StopMovement();

            if (InputHelper.KeyDown(Keys.W))
            {
                caller.MoveUp();
            }
            else if (InputHelper.KeyDown(Keys.S))
            {
                caller.MoveDown();
            }

            if (InputHelper.KeyDown(Keys.A))
            {
                caller.MoveLeft();
            }
            else if (InputHelper.KeyDown(Keys.D))
            {
                caller.MoveRight();
            }
        }