Beispiel #1
0
 /// <summary>
 /// Finds the longest Move which matches the given input, if any.
 /// </summary>
 public Move DetectMove(InputManager input)
 {
     if (input.Buffer.Count > 0)
     {
         // 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;
 }
Beispiel #2
0
        public static void AddInputManager(int playerIndex)
        {
            inputManagers[playerIndex] = new InputManager((PlayerIndex)playerIndex, 2);//, moveList.LongestMoveLength);

#if !(WINDOWS_PHONE)
            if (NetworkManager.Session != null)
            {
                foreach (LocalNetworkGamer lng in NetworkManager.Session.LocalGamers)
                {
                    if (lng.SignedInGamer != null && lng.SignedInGamer.PlayerIndex == (PlayerIndex)playerIndex)
                    {
                        inputManagers[playerIndex].NetworkGamer = lng;
                        break;
                    }
                }
            }
#endif
        }