Exemplo n.º 1
0
        void Start()
        {
            Debug.Log("Parent: " + gameObject.name);
            //Get references;
            disableShadows = GetComponent <DisableShadows>();
            fpsCounter     = GetComponent <FPSCounter>();

            //Hide menu;
            SetMenuEnabled(false);

            //Enable/Disable shadows based on last player selection;
            disableShadows.SetShadows(PlayerData.enableShadows);
            shadowToggle.isOn = PlayerData.enableShadows;

            //Deactivate all controller presets in the scene;
            for (int i = 0; i < controllers.Count; i++)
            {
                controllers[i].SetActive(false);
            }

            //Activate the correct controller preset based on the preset index;
            controllers[PlayerData.controllerIndex].SetActive(true);

            //Activate the correct level area based on preset index;
            if (PlayerData.controllerIndex >= 4)
            {
                regularArea.SetActive(false);
            }
            else
            {
                topDownArea.SetActive(false);
            }

            //Colorize the correct button based on controller index;
            ColorBlock c = buttons[PlayerData.controllerIndex].colors;

            c.normalColor      = activeButtonColor;
            c.highlightedColor = activeButtonColor;
            c.pressedColor     = activeButtonColor;
            buttons[PlayerData.controllerIndex].colors = c;

            Cursor.lockState = CursorLockMode.None;
        }