public void ChangeTurn() { turn = !turn; if (turn != playerTurn) { OthelloHUDManager.Prompt(GetCurrentTurnText + "AI's turn!"); EventManager.instance.FreezeControl(); AIPlay(); } else { OthelloHUDManager.Prompt(GetCurrentTurnText + "Player's turn!"); EventManager.instance.GrantControl(); } foreach (OthelloZoneBehaviour z in possibleZones) { if (PutPieceCheck(z, turn)) { return; } } if (skipped) { Debug.Log("Ended?"); EndGame(); } else { skipped = true; OthelloHUDManager.Prompt("No valid move for " + GetCurrentTurnText + "player, turn skipped!"); ChangeTurn(); } }
public void OnTap() { if (!OthelloGameManager.Instance.PutPieceCheck(this, OthelloGameManager.Instance.GetCurrentTurn)) { Debug.Log("illegal"); OthelloHUDManager.Prompt("Illegal Move!"); return; } OthelloGameManager.Instance.PutPiece(this, OthelloGameManager.Instance.GetCurrentTurn); }
private void InitializeGame() { White = 4; Black = 4; skipped = false; int m = SizeOption / 2; ForcePut(boardReference.GetZone(m - 1, m - 1, m - 1), false); ForcePut(boardReference.GetZone(m, m, m), true); ForcePut(boardReference.GetZone(m - 1, m, m), false); ForcePut(boardReference.GetZone(m, m - 1, m - 1), true); ForcePut(boardReference.GetZone(m, m, m - 1), false); ForcePut(boardReference.GetZone(m - 1, m - 1, m), true); ForcePut(boardReference.GetZone(m, m - 1, m), false); ForcePut(boardReference.GetZone(m - 1, m, m - 1), true); OthelloHUDManager.ClearDisplayOnStart(); ExpandBoard(); if (turn != playerTurn) { AIPlay(); } }
private void EndGame() { boardReference.DestroyBoard(); OthelloHUDManager.DisplayEndgame(White > Black); }