コード例 #1
0
    // Changes audio snapshot based on game states

    void Update()
    {
        if (GameStateManager.isStartMenu())
        {
            startMenu.TransitionTo(1f);
        }

        if (GameStateManager.isIntro() && !GameStateManager.isPaused())
        {
            if (!introAudio.isPlaying)
            {
                introAudio.Play();
            }
            intro.TransitionTo(0f);
        }

        if (GameStateManager.isTutorial())
        {
            if (!tutorialAudio.isPlaying)
            {
                tutorialAudio.Play();
            }
            tutorial.TransitionTo(0.3f);
        }
        else if (!GameStateManager.isPaused())
        {
            tutorialAudio.Stop();
        }

        if (GameStateManager.isPaused())
        {
            pause.TransitionTo(0.3f);
        }

        if (GameStateManager.isGameover())
        {
            gameOver.TransitionTo(0.4f);
        }


        if (EnemiesManager.isDanger() && !GameStateManager.isPaused())
        {
            danger.TransitionTo(1f);
        }

        if (EnemiesManager.isExtremeDanger() && extremeDangerAudio.isPlaying && !GameStateManager.isPaused())
        {
            extremeDanger.TransitionTo(1f);
        }
    }
コード例 #2
0
    void Update()
    {
        if (GameStateManager.isStartGame())
        {
            startGameObjects.SetActive(true);
            midGameObjects.SetActive(false);
        }

        if (GameStateManager.isMidGame())
        {
            mainNavigationSystem.SetTarget(Mars);
            midGameObjects.SetActive(true);
            startGameObjects.SetActive(false);
        }

        if (GameStateManager.isInGame() && !GameStateManager.isTutorial())
        {
            GameStateManager.AllowStarShipHook();
            GameStateManager.ShowPlanetNavigationSystem();
            GameStateManager.ShowFuelNavigationSystem();
            GameStateManager.ShowVestaNavigationSystem();

            if (!comunicationsWriter.HasAlreadyWritten() && !GameStateManager.isCheckpoint())
            {
                comunicationsWriter.Write(sentence0_1);
            }

            // Liftoff
            if (!gameStarted && Input.GetAxis("Vertical") > 0)
            {
                gameStarted = true;
                GameStateManager.AllowStarShipMovements();
                GameStateManager.ShowHUD();
                if (!GameStateManager.isCheckpoint())
                {
                    comunicationsWriter.Write(sentence0_2);
                }
            }

            // end extreme danger message
            if (extremeDangerAudio.isPlaying && !EnemiesManager.isExtremeDanger())
            {
                if (!extremeDangerEndWriter.HasAlreadyWritten())
                {
                    extremeDangerEndWriter.Write(sentence_extreme_danger_end);
                }
            }
        }
    }