// Update is called once per frame void Update() { timeElapsed += Time.deltaTime; if (timeElapsed >= timeOut) { diceObjs.Add(rolldice.RollDie(0)); timeElapsed = 0.0f; } foreach (GameObject diceObj in diceObjs) { diceValue = diceObj.GetComponent <DiceValue>(); if (diceValue.stoped) { dpm.AddDP(diceValue.value); stopDice.Add(diceObj); } } foreach (GameObject stopdie in stopDice) { diceObjs.Remove(stopdie); Destroy(stopdie, 1.0f); } }
// Update is called once per frame void Update() { if (Input.GetButtonUp("Fire1")) { StartCoroutine(RollMultiDice(rollIndex, rollList.Count)); rollIndex = rollList.Count; } foreach (GameObject diceObj in diceObjs) { diceValue = diceObj.GetComponent <DiceValue>(); if (diceValue.stoped) { dpm.AddDP(diceValue.value); stopDice.Add(diceObj); } } foreach (GameObject stopDie in stopDice) { diceObjs.Remove(stopDie); Destroy(stopDie, 1.0f); } }