public GameMove(GamePeice peice, GameMoveType move, GamePoint point) { Peice = peice; MoveType = move; DestinationPoint = point; IsDefined = true; }
public bool CanMove(GameFieldGrid grid, GameMoveType move) { var emptylocation = grid.GetUnusedItemLocation (); // There always must be an empty field! if(emptylocation == null) { throw new InvalidOperationException ("Game field does not have an empty item location!"); } switch(move) { case GameMoveType.MoveItemAbove: return emptylocation.Row > 0; case GameMoveType.MoveItemBelow: return emptylocation.Row < grid.Rows - 1; case GameMoveType.MoveItemLeft: return emptylocation.Column > 0; case GameMoveType.MoveItemRight: return emptylocation.Column < grid.Columns - 1; default: return false; } }
public void UpdatePlayer(GameMoveType move, TreasureType treasure, GridLocation location) { }
public void UpdatePlayer(GameMoveType move, TreasureType treasure, GridLocation location) { // TODO: Implementation required? this.visualizationService.Write(this.visualizationService.screen.Rows - 1, 0, ConsoleColor.White, "Other player's move '{0}' discovered item {1} at location {2}", move, treasure, location); }
public GameMove(Vector2Int start, Vector2Int end, GameMoveType moveType) { StartPosition = start; EndPosition = end; MoveType = moveType; }
public GameMove(GameMoveType gameMoveType) { }
public virtual void UpdatePlayer(GameMoveType move, TreasureType treasure, GridLocation location) { // If it's the other player's turn, we can't have a target to move to. this.currentPath = null; // Forget a bit about treasures every time a move was made. this.ForgetTreasures (); // Remember the treasure that has just been discoverd fully. this.LearnAboutTreasure (treasure, location); }
public GameFieldItem Move(GameState gameState, GameMoveType move) { // The item that was discovered by moving a pyramid. GameFieldItem itemToMove = null; var location = gameState.GameField.GetUnusedItemLocation (); // There always must be an empty field! if(location == null) { throw new InvalidOperationException ("Game field does not have an empty item location!"); } var emptyItem = gameState.GameField.GetItem (location.Row, location.Column); switch(move) { case GameMoveType.MoveItemAbove: // Get the pyramid above the empty field and move it down. itemToMove = gameState.GameField.GetItem (location.Row - 1, location.Column); break; case GameMoveType.MoveItemBelow: // Get the pyramid below the empty field and move it up. itemToMove = gameState.GameField.GetItem (location.Row + 1, location.Column); break; case GameMoveType.MoveItemLeft: // Get the pyramid left of the empty field and move it right. itemToMove = gameState.GameField.GetItem (location.Row, location.Column - 1); break; case GameMoveType.MoveItemRight: // Get the pyramid right of the empty field and move it left. itemToMove = gameState.GameField.GetItem (location.Row, location.Column + 1); break; } // The pyramid that was on the moved item is now where the empty spot was. emptyItem.Pyramid = itemToMove.Pyramid; itemToMove.Pyramid = PyramidType.None; return itemToMove; }