//*************************************************************************** // Function Name: MakeMove // Purpose: Finalizes a move. // Paramaters: target - The end target hex of the move. // Returns: None //*************************************************************************** private void MakeMove(Hexagon target) { int numPegsLeft = 0; Jump jump = mBoard.GetJump(mSelectedHexagon, target); jump.GetStartHex().EnablePeg(false); jump.GetJumpedHex().EnablePeg(false); jump.GetEndHex().EnablePeg(true); mBoard.ClearSelections(); GameDataManager.mSingleton.AddJump(jump); mbSelectionLocked = false; if (mBoard.IsGameOver(out numPegsLeft)) { if (numPegsLeft > 1) { // Lose the game mGameplayUI.GameOver(false); } else if (numPegsLeft == 1) { // Win the game mGameplayUI.GameOver(true); } GameDataManager.mSingleton.WriteGameToFile(GameDataManager.TRIANGLE, Board.mBoardSize); } }
public void RetractMove() { Jump move = GameDataManager.mSingleton.GetPreviousMove(); if (move != null) { move.GetStartHex().EnablePeg(true); move.GetJumpedHex().EnablePeg(true); move.GetEndHex().EnablePeg(false); mRemainingTimeText.text = GameplayUIHandler.FormatRemainingTime(move.GetRemainingTime()); } }