Пример #1
0
    //fixed update
    void FixedUpdate()
    {
        UnityEngine.UI.Toggle t = gameObject.GetComponent <UnityEngine.UI.ToggleGroup>().ActiveToggles().FirstOrDefault();

        if (t.name.Equals("MoonJellyToggle"))
        {
            MainGameHandler.type = MainGameHandler.CreatureTypes.MoonJelly; ShopMenuHandler.ChangeBackground();
        }
        if (t.name.Equals("CannonballJellyToggle"))
        {
            MainGameHandler.type = MainGameHandler.CreatureTypes.CannonballJelly; ShopMenuHandler.ChangeBackground();
        }
        if (t.name.Equals("BluefireJellyToggle"))
        {
            MainGameHandler.type = MainGameHandler.CreatureTypes.BluefireJelly; ShopMenuHandler.ChangeBackground();
        }
    }
Пример #2
0
    public void OnButtonPressed(string button)
    {
        //main menu
        if (button.Equals("Play"))
        {
            MainGameHandler.IP = GameObject.Find("IPField").transform.Find("Text").GetComponent <UnityEngine.UI.Text>().text;
            SceneManager.LoadScene("Game");
        }
        else if (button.Equals("Shop"))
        {
            SceneManager.LoadScene("Shop");
        }
        else if (button.Equals("Quit"))
        {
            MainGameHandler.Disconnect();
            MainGameHandler.ExitAndSave();
        }

        //shop
        if (button.Equals("Back"))
        {
            SceneManager.LoadScene("MainMenu");
        }
        else if (button.Equals("GoWhale"))
        {
            GameObject.Find("GoWhaleButton").GetComponent <UnityEngine.UI.Button>().interactable = false;
            MainGameHandler.isWhale = true;
            MainGameHandler.type    = MainGameHandler.CreatureTypes.BottleNose;
            ShopMenuHandler.ChangeBackground();
        }

        //game
        if (button.Equals("Return"))
        {
            MainGameHandler.escapeMenuPanel.SetActive(false);
        }
        else if (button.Equals("DC"))
        {
            MainGameHandler.Disconnect();
            SceneManager.LoadScene("MainMenu");
        }
    }