コード例 #1
0
ファイル: Game1.cs プロジェクト: melware/fanorona
        private bool MakePlayerMove(Tile start, Tile dest)
        {
            Direction d = Board.GetDirection(start, dest);

            // check whether the direction has already been used
            // and whether moving was successful
            var move = GameBoard.MovePiece(start, dest);
            if (!CurrentMoveChain.Contains(d) && move!=null)
            {

                //CurrentMoveChain.Add(d);
                if (move.CapturedTiles.Keys.Count > 1)
                {
                    possibleMove = move;
                    GameBoard.MakeMove(move, move.CapturedTiles.Keys.First());
                }
                else
                {
                    //CurrentPlayerTurnState = PlayerTurnState.Moved;
                    if (move.CapturedTiles.Keys.Any())
                    {
                        var dir = move.CapturedTiles.Keys.First();
                        GameBoard.MakeMove(move, dir);
                    }
                }
                EndTurn();
                Console.WriteLine("Added "+ d.ToString());
                return true;
            }

            return false;
        }
コード例 #2
0
ファイル: Game1.cs プロジェクト: melware/fanorona
 private void EndTurn()
 {
     CurrentPlayerTurnState = PlayerTurnState.NoMove;
     SelectedPiece = null;
     CurrentPlayer = Player.Computer;
     possibleMove = null;
 }