public void DecideTurn() { int turn = Random.Range(0, 2); currentPlayer = turn > 0 ? rival : player; MessageScript msg = Instantiate(messagePrefab, canvas.transform); msg.SetText(currentPlayer.name + " goes first!"); StartCoroutine(PerformAction(1f, DiceThrow)); }
public void ChangePlayerTurn() { if (rival.GetHealth() <= 0 || player.GetHealth() <= 0) { string pnme = rival.GetHealth() <= 0 ? player.name : rival.name; MessageScript msg = Instantiate(messagePrefab, canvas.transform); msg.SetText(pnme + " won the game!"); StartCoroutine(PerformAction(2f, ChangeScene)); } else { currentPlayer = currentPlayer == player ? rival : player; MessageScript msg = Instantiate(messagePrefab, canvas.transform); msg.SetText("Ready " + currentPlayer.name); StartCoroutine(PerformAction(1f, DiceThrow)); } }