Пример #1
0
        public void Clear()
        {
            _nextSpawn      = Vector3.zero;
            _buildingsCount = 0;

            while (transform.childCount > 0)
            {
                DestroyImmediate(transform.GetChild(0).gameObject);
            }

            tilemapGenerator.Clear();
        }
Пример #2
0
    public IEnumerator StartingGame()
    {
        StartingOverlayPanel.SetActive(true);

        // done on start because otherwise there would be problem with retained Entitas entities (solvable of course)
        GeneratingText.text += Environment.NewLine + "...";
        yield return(new WaitForSeconds(0.3f));

        if (Difficulty.value == 0)         // easy
        {
        }

        float enemyCountRate = Difficulty.value == 0 ? 0.9f : Difficulty.value == 1 ? 1f : 1.1f;

        _worldActorFiller.FillWithActors(enemyCountRate);

        yield return(new WaitForSeconds(0.3f));

        _tilemapGenerator.Clear();
        yield return(new WaitForSeconds(0.3f));

        _tilemapGenerator.Generate();

        yield return(new WaitForSeconds(0.1f));

        foreach (GameObject gameObjectToEnable in ToEnableWhenStarting)
        {
            gameObjectToEnable.SetActive(true);
            yield return(new WaitForSeconds(0.05f));            // without this objects may start in wrong order, causing data to be corrupted
        }

        StartingOverlayPanel.SetActive(false);
        _uiFacade.AddLogEntry("<color=#adf>Welcome!</color> \nHave fun working with Osnowa.");
        _uiFacade.AddLogEntry("Feel free to play around with the engine.");

        gameObject.SetActive(false);
    }