コード例 #1
0
 private void Update()
 {
     if (transform.position.z > 100)
     {
         m_PhysicsDie.RollDie();
     }
 }
コード例 #2
0
    public void SpawnDice(int diceToSpawn)
    {
        for (int i = 0; i < diceToSpawn; ++i)
        {
            PhysicsDie currentDie = m_PhysicsDice[i];

            currentDie.gameObject.SetActive(true);

            // Spawn dice in random area in the spawn point.
            currentDie.transform.position = new Vector3
                                            (
                Random.Range(-m_SpawnPointExtentsX, m_SpawnPointExtentsX),
                0,
                Random.Range(-m_SpawnPointExtentsZ, m_SpawnPointExtentsZ)
                                            ) + m_DiceSpawnPoint.position;

            currentDie.RollDie();
        }
    }