Exemple #1
0
        private void Awake()
        {
            Instance = this;

            if (!GameObject.FindObjectOfType <PlayerSelectionManager>())
            {
                SceneManager.LoadScene(0);
            }


            vehicles = GameObject.FindObjectsOfType <VehicleBehavior>();
            AssignedJoyStickNumbers = new int[vehicles.Length];
            foreach (VehicleBehavior v in vehicles)
            {
                if (v.PlayerID == 1)
                {
                    vehicle1 = v;
                    AssignedJoyStickNumbers[0] = v.JoyStick;
                }
                if (v.PlayerID == 2)
                {
                    vehicle2 = v;
                    AssignedJoyStickNumbers[1] = v.JoyStick;
                }
                if (v.PlayerID == 3)
                {
                    vehicle3 = v;
                    AssignedJoyStickNumbers[2] = v.JoyStick;
                }
                if (v.PlayerID == 4)
                {
                    vehicle4 = v;
                    AssignedJoyStickNumbers[3] = v.JoyStick;
                }
            }

            huds = GameObject.FindObjectsOfType <SimpleUI>();
            foreach (SimpleUI h in huds)
            {
                if (h.PlayerID == 1)
                {
                    HUDPlayer1 = h;
                    // HUDPlayer1.gameObject.SetActive(false);
                }
                if (h.PlayerID == 2)
                {
                    HUDPlayer2 = h;
                    // HUDPlayer2.gameObject.SetActive(false);
                }
                if (h.PlayerID == 3)
                {
                    HUDPlayer3 = h;
                    //  HUDPlayer3.gameObject.SetActive(false);
                }
                if (h.PlayerID == 4)
                {
                    HUDPlayer4 = h;
                    //   HUDPlayer4.gameObject.SetActive(false);
                }
            }
        }