示例#1
0
    IEnumerator Delay_Start_Of_Level()
    {
        if (!tutorial_Level)
        {
            local_UI_Manager.Display_Current_Level("Level " + SceneManager.GetActiveScene().buildIndex);
            local_UI_Manager.Display_Bonus_Objective();
        }

        yield return(new WaitForSeconds(time_To_Wait_Before_Starting_Level));

        local_UI_Manager.Hide_Bonus_Objective();
        local_UI_Manager.Hide_Current_Level();
        if (tutorial_Level)
        {
            local_UI_Manager.Display_Bonus_Objective();
        }
        StartCoroutine("Pick_Enemy_Type_To_Spawn");
        local_UI_Manager.Display_Current_Wave("Wave " + current_Wave_Number);
        yield return(new WaitForSeconds(5f));

        local_UI_Manager.Hide_Current_Wave();
        if (tutorial_Level)
        {
            local_UI_Manager.Hide_Bonus_Objective();
        }
    }
    /// <summary>
    /// pauses the game or unpauses it by setting the timescale and bringing up pause menu UI elements
    /// </summary>
    public void Pause_Game()
    {
        if (!isPaused)
        {
            Cursor.visible = true;
            cursor_Image.SetActive(false);
            pause_Panel.SetActive(true);
            local_Player_Input.enabled             = false;
            local_Player_Movement_Controls.enabled = false;
            isPaused = true;
            local_UI_Manager.Display_Bonus_Objective();
            if (local_Tutorial_Manager != null)
            {
                if (is_Tutorial_Level && !local_Tutorial_Manager.tutorial_Finished)
                {
                    local_UI_Manager.tutorial_Panel.SetActive(false);
                }
            }

            // Gameplay.SetActive(false);
            Time.timeScale = 0f;
        }

        else
        {
            Time.timeScale = 1f;
            cursor_Image.SetActive(true);
            Cursor.visible = false;
            Options_Menu.SetActive(false);
            // Gameplay.SetActive(true);
            local_UI_Manager.Hide_Bonus_Objective();
            if (local_Tutorial_Manager != null)
            {
                if (is_Tutorial_Level && !local_Tutorial_Manager.tutorial_Finished)
                {
                    local_UI_Manager.tutorial_Panel.SetActive(true);
                }
            }

            pause_Panel.SetActive(false);
            local_Player_Input.enabled             = true;
            local_Player_Movement_Controls.enabled = true;
            isPaused = false;
        }
    }