private void RollDicesAgain() { rollScreen.SetActive(false); dicePlayer1.RollAgain(startPos1); dicePlayer2.RollAgain(startPos2); }
private void Update() { if (currentDice == null && generatedDices.Count < DICE_MAX_LIMIT) { var dicePrefab = (generatedDices.Count & 1) == 0 ? blackDicePrefab : whiteDicePrefab; var(location, direction) = GenerateRandom(); dicePrefab.rollSpeed = Random.Range(1f, 5f); dicePrefab.moveSpeed = UnityEngine.Random.Range(3f, 6f); dicePrefab.direction = direction; currentDice = Instantiate(dicePrefab, location, Quaternion.identity); currentDice.RollAgain(); generatedDices.Add(currentDice); } if (currentDice != null && diceTimer > 0f) { diceTimer -= Time.deltaTime; } if (currentDice != null && currentDice.animationFinished) { diceTimer = DICE_REROLL; currentDice = null; } if (generatedDices.Count >= DICE_MAX_LIMIT) { KillGeneratedDices(); } }