/// <summary> /// When a penguin has no legal moves (i.e. is blocked by other penguins, or is alone on a single isloated tile), /// clicking on it triggers removal of it and the single tile it's standing on from the board. /// </summary> /// <param name="penguin">Selected penguin to remove</param> /// <remarks> /// CALLED BY: SubStateMach_MainGame->State_Move_xxx::OnPenguinClicked() /// </remarks> /// public void RemoveUnmovablePenguin(GamePenguin penguin) { CurrentPlayer.AddFish(penguin.CurrentTile.FishScoreValue); // Player wins fish on this tile penguin.CurrentTile.Sink(); // Animate sinking tile, and then remove it ExpungePenguin(penguin, penguinDepartPrefab); // Remove Penguin // Update the internal board the AI uses // if (IsUsingAI) { Command.GameMove move = PortmanteauRemovePenguin(penguin.CurrentTile); ExecuteMove_Internal(move); } // TODO: Delete? -- StateParam_MovePending = true; // Go to animation state while sinking tile anim plays // No point in waiting for the tile to vanish, so go directly to "NextPlayer" state // StateParam_PenguinRemoved = true; // StateTrigger_NextPlayer(); }
/// <summary> /// Apply a move to the penguins and board in Game World /// </summary> /// <param name="penguin">Penguin to move</param> /// <param name="tile">Destination tile</param> /// <remarks> /// CALLED BY: ExecuteHumanMove(), ExecuteAIMove() /// </remarks> /// void ExecuteMove_GameWorld(GamePenguin penguin, GameTile tile) { GameTile startTile = penguin.CurrentTile; if (penguin.MoveTo(tile)) // If a legal move was selected, start animating the penguin's move { // Player acquires this tile's fish // CurrentPlayer.AddFish(startTile.FishScoreValue); // Set flag for tile just departed to sink (not until penguin has left it, else it will look like // it's "walking on water"! // m_condemnedTile = startTile; // Go to "MovePending" state until all animations complete // StartAnimateMove(); } }