Пример #1
0
 /// <summary>
 /// Finds the longest Move which matches the given input, if any.
 /// </summary>
 public Move DetectMove(GamePlayInput input)
 {
     // Perform a linear search for a move which matches the input. This relies
     // on the moves array being in order of decreasing sequence length.
     foreach (Move move in moves)
     {
         if (input.Matches(move))
         {
             return move;
         }
     }
     return null;
 }
Пример #2
0
        /// <summary>
        /// Constructors a new player.
        /// </summary>
        public LevelPlayer(Vector2 position)
        {
            movePlayer = new MovePlayer();

            #region Moves List
            // Construct the master list of moves.
            moves = new Move[]
            {
                new Move(Enums.MoveState.Punch, Buttons.X),
                new Move(Enums.MoveState.Kick, Buttons.A),
                new Move(Enums.MoveState.SpecialCombo, Buttons.X | Buttons.A),
                new Move(Enums.MoveState.ComboKick, Direction.Down, Direction.DownRight, Direction.Right | Buttons.A),
                new Move(Enums.MoveState.ComboKick, Direction.Down, Direction.DownLeft, Direction.Left | Buttons.A),
                new Move(Enums.MoveState.FirePunch1, Direction.Down, Direction.DownRight, Direction.Right | Buttons.X),
                new Move(Enums.MoveState.FirePunch1, Direction.Down, Direction.DownLeft, Direction.Left | Buttons.X),
                new Move(Enums.MoveState.FinalCombo2,  Buttons.B),
            };
            #endregion

            // Construct a move list which will store its own copy of the moves array.
            moveList = new MoveList(moves);

            // Create an InputManager for player with a sufficiently large buffer.
            inputManager = new GamePlayInput((PlayerIndex)0, moveList.LongestMoveLength);

            Alive = true;
            Lives = 3;
            ComboCount = 3;
            Lv = 1;
            AttackStrength = 3;
            chainMoves.Capacity = 3;
            LoadContent();
            Reset(position);
        }