/// <summary> /// Clear penguin selection /// </summary> /// public void UnselectPenguin() { if (CurrentPenguin) { CurrentPenguin.OnSelectOff(); } CurrentPenguin = null; }
/* * /// <summary> * /// Internal move execution routine * /// </summary> * /// <param name="tile">Destination tile</param> * /// <param name="bHumanMove">Did a human (rather than the AI make this move?)</param> * /// * void ExecuteMove(GameTile tile, bool bHumanMove) * { * if (CurrentPenguin.MoveTo(tile)) // If a legal move was selected, start animating the penguin's move * { * // Player acquires this tile's fish * // * CurrentPlayer.AddFish(CurrentTile.FishScoreValue); * * // Start tile sinking animation for the tile just departed * // TODO: *** This may be a bug -- Shouldn't CurrentTile be the *selected* (destination) tile?? * // * CurrentTile.Sink(); * * // If a human just moved, update the internal board the AI uses * // (If the AI moved, the board is updated by the AI algorithms, so we need not do it here.) * // * if (IsUsingAI && bHumanMove) * { * m_refAIBoard.UpdateAIBoard(CurrentPlayer.Color, PortmanteauMovePenguin(CurrentTile, tile)); * } * * // Go to "MovePending" state until all animations complete * // * StateParam_AIMove = false; * StateParam_MovePending = true; * * // Clear selections * // * CurrentPenguin = null; * CurrentTile = null; * } * // Else continue to wait for a valid tile to be clicked * } */ /// <summary> /// If user selected a valid normal penguin move, execute that move, both onscreen and internally /// </summary> /// <param name="tile">Destination tile</param> /// <remarks> /// CALLED BY: SubStateMach_MainGame->State_Move_Human::OnTileClicked() /// </remarks> /// public void ExecuteHumanMove(GameTile tile) { if (CurrentPenguin.ValidateDestination(tile)) // First check that selected tile is a legal move { ExecuteMove_GameWorld(CurrentPenguin, tile); if (IsUsingAI) // Only need to do this bit if AI is in this Game { // Instantiate a command to send to the internal board // Command.GameMove move = PortmanteauMovePenguin(CurrentPenguin.CurrentTile, tile); // Tell the internal board to update to reflect the new move // ExecuteMove_Internal(move); } } }