Example #1
0
        public void OnGameStart()
        {
            TeamSettings settings = Core.Get <TeamSettings>();

            settings.Clear();

            for (int i = 0; i < players.Count; i++)
            {
                settings.AddTeam(new TeamDefinition(players[i].Slot.Player, players[i].Color));
            }

            SceneManager.LoadScene(gameSceneName);
        }
Example #2
0
        private void Awake()
        {
            InputManager inputManager = FindObjectOfType <InputManager>();

            if (inputManager == null)
            {
                Instantiate(inputManagerPrefab);
            }

            TeamSettings settings = Core.Get <TeamSettings>();

            for (int i = 0; i < teams.Length - 1; i++)
            {
                teams[i].GetComponentInChildren <PlayerBehaviour>().playerColor = Color.clear;
            }

            if (settings.Teams.Count > 0)
            {
                for (int i = 0; i < teams.Length; i++)
                {
                    if (settings.Teams.Count > i)
                    {
                        teams[i].gameObject.SetActive(true);
                        PlayerBehaviour player = teams[i].GetComponentInChildren <PlayerBehaviour>();
                        player.Player      = settings.Teams[i].Player;
                        player.playerColor = settings.Teams[i].Color;
                    }
                    else
                    {
                        //teams[i].gameObject.SetActive(false);

                        teams[i].gameObject.SetActive(true);
                        PlayerBehaviour player = teams[i].GetComponentInChildren <PlayerBehaviour>();
                        player.Player      = null;
                        player.IsBot       = true;
                        player.playerColor = GetUnusedColor();
                    }
                }
            }
        }