/// <summary> /// Sets the whoseturn correctly and handles winning condition /// </summary> /// <param name="gridPos">Where the previous sign has been placed</param> public virtual void NextTurn(int[] gridPos, out Cell.CellOcc won) { NextPerson(); // Check whether someone has won GameWonData cellWon = grid.DidWinGame(gridPos); // Someone has won if (cellWon.gameWon) { cellWon = grid.StopCurrentGame(cellWon); gameStarted = false; if (SomeoneWonGameEvent != null) SomeoneWonGameEvent(cellWon.winType); StartCoroutine("DrawBorderToGame", cellWon); } won = cellWon.gameWon ? cellWon.winType : Cell.CellOcc.BLOCKED; }
protected void DrawBorderToGame(GameWonData cellWon) { int[,] points = cellWon.GetShapePoints(); float[,] winLinePoints = cellWon.GetWinLinePoints(); AddBorderToGame(points, winLinePoints, cellWon.winType); }