Example #1
0
    // Interface functions
    void StartGame()
    {
        // Pre-initialization event clearing
        eventManager.ClearListeners();
        cursorManagement.ClearListeners();
        achievementManager.ClearListeners();

        // Initialize and shut down
        GameInterfaces gi = FindObjectOfType <GameInterfaces>();

        if (gi != null)
        {
            gi.gameObject.SetActive(true);
            gi.StartGameInterfaces();
        }
        cursorManagement.InitializeGameCursor();

        temporality.SetDate(0);
        temporality.SetTimeOfDay(20);
        temporality.SetTimeScale(1);

        // Initialize only
        gridManagement.InitializeGridManager();
        cinematicManager.GetReferences();
        timelineController.LoadCycles();
        DifferStart(delegate { eventManager.LoadEvents(); });
        achievementManager.stats.gamesPlayed++;
        cityManager.GenerateEnvironmentBlocks();

        // TUTORIAL RUN ONLY

        if (cityManager.isTutorialRun)
        {
            // Lock every building
            foreach (BlockScheme scheme in library.blocks)
            {
                cityManager.LockBuilding(scheme.ID);
            }
        }

        // NEW GAME ONLY
        if (isNewGame)
        {
            // First citizen arrival and cycle loading
            timelineController.UpdateCycle(0);
            // CINEMATIC
            Instantiate(library.spatioportSpawnerPrefab);
        }

        GameManager.instance.soundManager.musicPlayer.Play(GameManager.instance.soundManager.FindClipByName("MusicGame"));
        // Ingame switch
        inGame = true;
    }