Пример #1
0
    public IEnumerator FallHexes(byte verticalGridCount, float yPosMax, float fixedYposMax)
    {
        GameObject[] hexes = GameObject.FindGameObjectsWithTag("Hexagon");

        if (GameObject.FindGameObjectsWithTag("Bomb").Length != 0)
        {
            StartCoroutine(GameObject.FindGameObjectsWithTag("Bomb")[0].GetComponent <BombManager>().Fall());
        }
        for (int j = 0; j < verticalGridCount; j++)
        {
            yPosMax = fixedYposMax;
            for (int k = 0; k < verticalGridCount + 1; k++)
            {
                foreach (GameObject item in hexes)
                {
                    item.GetComponent <HexagonController>().CheckDown();
                }

                yPosMax += 0.25f;
            }
            yield return(new WaitForSeconds(0.15f));
        }
        if (GameObject.FindGameObjectsWithTag("Bomb").Length != 0)
        {
            StartCoroutine(GameObject.FindGameObjectsWithTag("Bomb")[0].GetComponent <BombManager>().Fall());
        }
        Debug.LogWarning("Done");
        GameObject[] go = GameObject.FindGameObjectsWithTag("Obstacle");

        bool a = false;

        foreach (GameObject item in go)
        {
            ObstacleController obstacleController = item.GetComponent <ObstacleController>();
            if (obstacleController.RayCast_().collider == null && score > fixedScore && !a && GameObject.FindGameObjectsWithTag("Bomb").Length == 0)
            {
                fixedScore += fixedScore;
                obstacleController.SpawnBomb();
                a = true;
                yield return(new WaitForSeconds(0.5f));
            }

            obstacleController.Spawn();
        }
        StartCoroutine(IsGameOver());
    }