Beispiel #1
0
 // Start is called before the first frame update
 void Start()
 {
     selfReference = this;
 }
Beispiel #2
0
    // Update is called once per frame
    void Update()
    {
        switch (MenuRightNow)
        {
        case MenuLocation.Main:
            MainMenuItself.SetActive(true);
            LevelSelectMenu.SetActive(false);
            SettingMenu.SetActive(false);
            ExtrasMenu.SetActive(false);
            UnknownMenu.SetActive(false);
            GameplayMenu.SetActive(false);
            break;

        case MenuLocation.LevelSelect:
            MainMenuItself.SetActive(false);
            LevelSelectMenu.SetActive(true);
            SettingMenu.SetActive(false);
            ExtrasMenu.SetActive(false);
            UnknownMenu.SetActive(false);
            GameplayMenu.SetActive(false);
            break;

        case MenuLocation.Setting:
            MainMenuItself.SetActive(false);
            LevelSelectMenu.SetActive(false);
            SettingMenu.SetActive(true);
            ExtrasMenu.SetActive(false);
            UnknownMenu.SetActive(false);
            GameplayMenu.SetActive(false);
            break;

        case MenuLocation.Extras:
            MainMenuItself.SetActive(false);
            LevelSelectMenu.SetActive(false);
            SettingMenu.SetActive(false);
            ExtrasMenu.SetActive(true);
            UnknownMenu.SetActive(false);
            GameplayMenu.SetActive(false);
            break;

        case MenuLocation.Unknown:
            MainMenuItself.SetActive(false);
            LevelSelectMenu.SetActive(false);
            SettingMenu.SetActive(false);
            ExtrasMenu.SetActive(false);
            UnknownMenu.SetActive(true);
            GameplayMenu.SetActive(false);
            break;

        case MenuLocation.Gameplay:
            MainMenuItself.SetActive(false);
            LevelSelectMenu.SetActive(false);
            SettingMenu.SetActive(false);
            ExtrasMenu.SetActive(false);
            UnknownMenu.SetActive(false);
            GameplayMenu.SetActive(true);
            break;
        }

        if (OnGoingLoading)
        {
            if (rawProgress >= 90f)
            {
                OnGoingLoading = false;
            }
            if (loadingScreen)
            {
                loadingScreen.SetActive(true);
            }
        }
        else
        {
            if (loadingScreen)
            {
                loadingScreen.SetActive(false);
            }
        }

        if (!cameraing)
        {
            GameObject go = GameObject.FindGameObjectWithTag("MainCamera");
            if (go)
            {
                cameraing = go.GetComponent <PersonCamera2D>();
            }
        }

        if (isPlayingGame)
        {
            //Titler.SetActive(false);
            Titler.transform.position = new Vector3(cameraing.transform.position.x, cameraing.transform.position.y, 0f);
            LoopingArea.SetActive(false);
            LoopingArea.transform.position = new Vector3(cameraing.transform.position.x, cameraing.transform.position.y, 0f);
            MainMenuItself.GetComponent <MenuArea>().pauseMenuMode = true;
        }
        else
        {
            Titler.transform.position = Vector3.zero;
            LoopingArea.SetActive(true);
            LoopingArea.transform.position = Vector3.zero;
            MainMenuItself.GetComponent <MenuArea>().pauseMenuMode = false;

            cameraing.ZeroCamera();
        }

        if (MenuRightNow != MenuLocation.Main)
        {
            Titler.SetActive(false);
        }
        else
        {
            Titler.SetActive(true);
        }
    }