예제 #1
0
    public void newGame()
    {
        if (updateSeed && prefabIndex % 3 == 0)
        {
            seed++;
        }

        Random.InitState(seed);

        AudioController.GetSource("/Audio/GenericButton").Play();
        StartCoroutine(AudioController.FadeOut(AudioController.GetSource("/Audio/MenuLoop"), 0.1f));
        currentLoopIndex = prefabIndex + 1;
        StartCoroutine(AudioController.FadeIn(AudioController.GetSource("/Audio/InGameLoop" + currentLoopIndex), 0.1f));

        if (boardInstance != null)
        {
            Destroy(boardInstance);
        }

        WeatheredTile.ClearWeatherEffect();

        boardInstance = Instantiate(boardPrefabs[prefabIndex]);
        prefabIndex   = (prefabIndex + 1) % boardPrefabs.Count;

        turn = -1;

        ui.setTurnNumberText(0, numberOfTurns);

        ui.showGameEnd(false);
        ui.showMenu(false);
        ui.showGameUI(true);

        ui.showNextTurnButton(false);
        ui.showBeginButton(true);
    }
예제 #2
0
    public void nextTurn()
    {
        WeatheredTile.ClearWeatherEffect();
        turn++;

        var weather = boardInstance.GetComponentInChildren <WeatherControl>(true);

        if (turn == 0)
        {
            weather.StartForecasting();

            // Hide numbers
            {
                var go = GameObject.Find("NumberTilemap");
                go.SetActive(false);
            }
            // Show Burn
            {
                var go = GameObject.Find("BuildingsTilemap");
                go.GetComponent <Tilemap>().color = new Color(1.0f, 1.0f, 1.0f, 1.0f);
            }
        }

        if (turn >= 0 && turn < numberOfTurns)
        {
            ui.setTurnNumberText(turn, numberOfTurns);
        }

        if (turn >= numberOfTurns)
        {
            ui.showGameEnd(true);
            ui.showMenu(false);
            ui.showGameUI(false);
        }
        else
        {
            weather.Step();
            var refresher = boardInstance.GetComponentInChildren <TilemapRefresher>(true);
            refresher.Step();
        }
    }