// Checks the cube location and if it stopped moving and then passing the turn void CheckLocation() { if (rb != null) { if (rb.velocity.magnitude == 0) { var lastPos = transform.position; if (lastPos == transform.position) { if (count == 4) { obsticlesReorganize (); CleanAndInit(); RandomCpMovment(); currentPlayer = Defined_Vars.player.playerTwo; } else { CalculateWin(); } count = count + 1; } } } }
// Rematch void Rematch() { GameObj["CanvasWinLose"].SetActive(false); count = 0; CleanAndInit(); LeftMax = false; currentPlayer = Defined_Vars.player.playerOne; obsticlesReorganize (); StartCoroutine(MoveCubeLeft()); }