// Update is called once per frame void Update() { switch (gameManager.GetStage()) { case 0: break; case 1: if (isPlayer && needToGetResult) { Debug.Log("Checking stage 1.."); GetResult(); //sprawdzam rowniez ilosc wynikow w list result needToGetResult = CheckNeedToGetResults(); Debug.Log("Need to get result: " + needToGetResult); if (!needToGetResult) { manipulator.PlaceSelectedDicesOnBoardAndRotate(ref dices, results, diceSpawners); gameManager.SetStageAndChangeUIMessages(2); UnselectAllDices(); } } break; case 2: if (!enemyRoll && !isPlayer) { StartCoroutine(Wait()); SelectAllDices(); RollDices(); //manipulator.SetIsKineticForSelectedDices(ref dices, true); enemyRoll = true; } //Debug.Log("Enemy's Turn: isPlayer: "+isPlayer+" needToGetResult: "+needToGetResult); if (!isPlayer && needToGetResult) { Debug.Log("Checking stage 2.."); GetResult(); //sprawdzam rowniez ilosc wynikow w list result needToGetResult = CheckNeedToGetResults(); Debug.Log("Need to get ENEMY result: " + needToGetResult); if (!needToGetResult) { manipulator.PlaceSelectedDicesOnBoardAndRotate(ref dices, results, diceSpawners); gameManager.SetStageAndChangeUIMessages(3); UnselectAllDices(); enemyRoll = false; } } break; case 3: if (stage3Startup && isPlayer) { Debug.Log("stage 3 startUp"); manipulator.SetInteractableForAllDices(ref dices, true); stage3Startup = !stage3Startup; } //Debug.Log("players Reroll: isPlayer: " + isPlayer + " needToGetResult: " + needToGetResult); if (isPlayer && needToGetResult) { Debug.Log("Checking stage 3.."); GetResult(); //sprawdzam rowniez ilosc wynikow w list result needToGetResult = CheckNeedToGetResults(); if (!needToGetResult) { manipulator.PlaceSelectedDicesOnBoardAndRotate(ref dices, results, diceSpawners); //SaveResults(); gameManager.SetStageAndChangeUIMessages(4); UnselectAllDices(); manipulator.SetInteractableForAllDices(ref dices, false); ShowFinalResults(); } } break; case 4: // Debug.Log("players Reroll: isPlayer: " + isPlayer + " enemyRoll: " + enemyRoll); if (!isPlayer && !enemyRoll) { Debug.Log("Enemy is selecting dices"); enemyAI.SelectRandomDices(ref dices); enemyRoll = true; manipulator.PlaceSelectedDicesFromObjectAndRandomRotate(ref dices, board.position); manipulator.SetIsKineticForSelectedDices(ref dices, false); manipulator.AddForceToSelectedDices(ref dices, 15f); manipulator.AddRandomTorqueToSelectedDices(ref dices); needToGetResult = true; Debug.Log("Need to get result: " + needToGetResult); if (gameManager.GetStage() == 3 || gameManager.GetStage() == 4) { ResetResultForSelectedDices(); } //RollDices(); } Debug.Log("players Reroll: isPlayer: " + isPlayer + " needToGetResult: " + needToGetResult); if (!isPlayer && needToGetResult) { Debug.Log("Checking stage 4.."); GetResult(); //sprawdzam rowniez ilosc wynikow w list result needToGetResult = CheckNeedToGetResults(); Debug.Log("Need to get ENEMY result: " + needToGetResult); if (!needToGetResult) { manipulator.PlaceSelectedDicesOnBoardAndRotate(ref dices, results, diceSpawners); gameManager.SetStageAndChangeUIMessages(5); UnselectAllDices(); enemyRoll = false; } } break; case 5: if (getScore) { score = scoreCounter.CountScore(results); handName = scoreCounter.GetHandName(score); if (isPlayer) { Debug.Log("PLAYER Score: " + score + " Hand name: " + handName); gameManager.playerScore = score; gameManager.playerHand = handName; } else { Debug.Log("Enemy Score: " + score + " Hand name: " + handName); gameManager.enemyScore = score; gameManager.enemyHand = handName; } if (score > -1) { getScore = false; } } break; default: break; } }