Пример #1
0
 private void HandleSpriteState()
 {
     if (CurrentAccelerationDirection == DirectionEnum.NoDirection)
     {
         for (int i = 0; i < _inputHandler.OldEvents.Count; i++)
         {
             if (_inputHandler.OldEvents[i] is MoveEvent)
             {
                 var moveEvent = (MoveEvent)_inputHandler.OldEvents[i];
                 if (moveEvent.Direction == DirectionEnum.Right)
                 {
                     SpriteHandler.ChangeState(SpriteKeys.Quote.StandRight);
                     break;
                 }
                 else if (moveEvent.Direction == DirectionEnum.Left)
                 {
                     SpriteHandler.ChangeState(SpriteKeys.Quote.StandLeft);
                     break;
                 }
             }
         }
     }
     else if (CurrentAccelerationDirection == DirectionEnum.Right)
     {
         if (_pushDirection == DirectionEnum.Right)
         {
             SpriteHandler.ChangeState(SpriteKeys.Quote.PushRight);
             _pushDirection = DirectionEnum.NoDirection;
         }
         else
         {
             SpriteHandler.ChangeState(SpriteKeys.Quote.RunRight);
         }
     }
     else if (CurrentAccelerationDirection == DirectionEnum.Left)
     {
         if (_pushDirection == DirectionEnum.Left)
         {
             SpriteHandler.ChangeState(SpriteKeys.Quote.PushLeft);
             _pushDirection = DirectionEnum.NoDirection;
         }
         else
         {
             SpriteHandler.ChangeState(SpriteKeys.Quote.RunLeft);
         }
     }
 }