Esempio n. 1
0
    /// <summary>
    /// Tiles go down.
    /// </summary>
    private IEnumerator TileDown()
    {
        while (true)
        {
            yield return(new WaitForSeconds(0.2f));

            for (int i = 0; i < maplist[index].Length; i++)
            {
                Rigidbody rb = maplist[index][i].AddComponent <Rigidbody>();
                rb.angularVelocity = new Vector3(Random.Range(0.0f, 1.0f), Random.Range(0.0f, 1.0f), Random.Range(0.0f, 1.0f))
                                     * Random.Range(1, 20);
                GameObject.Destroy(maplist[index][i], 1.0f);
            }
            if (m_CubeController.z == index)
            {
                StopTileDown();
                Rigidbody m_rb = m_CubeController.gameObject.AddComponent <Rigidbody>();
                m_rb.angularVelocity = new Vector3(Random.Range(0.0f, 1.0f), Random.Range(0.0f, 1.0f), Random.Range(0.0f, 1.0f)) * Random.Range(1, 20);
                m_CubeController.StartCoroutine("GameOver", true);
            }
            index++;
        }
    }