Example #1
0
        /// <summary>
        /// sets up the Camera, start up the ProjectilePool, the GameManager, the Checkpoint the Bases and spawns the Heroes
        /// </summary>
        public void Awake()
        {
            CameraDistance = 20;

            ProjectilePool.PoolSize = 100;
            ProjectilePool.GeneratePool();
            GameManager manager = GameManager.GetInstance();
            GameObject  g;
            int         i = 1;

            while ((g = GameObject.Find("Checkpoint" + i)) != null)
            {
                Checkpoint c = g.GetComponent <Checkpoint>();
                manager.Checkpoints.Add(c);
                c.Init();
                i++;
            }

            Mobs.Base b = GameObject.Find("Base1").GetComponent <Mobs.Base>();
            b.DisplayName = "Base Blue";
            manager.GetTeam(1).AddMember(b);

            b.Team.AddMember(b.transform.FindChild("EliteMob1").GetComponent <Character>());
            b.Team.AddMember(b.transform.FindChild("EliteMob2").GetComponent <Character>());

            b             = GameObject.Find("Base2").GetComponent <Mobs.Base>();
            b.DisplayName = "Base Red";
            manager.GetTeam(2).AddMember(b);

            b.Team.AddMember(b.transform.FindChild("EliteMob1").GetComponent <Character>());
            b.Team.AddMember(b.transform.FindChild("EliteMob2").GetComponent <Character>());

            _net = GameManager.GetInstance().NetworkController;
            if (_net.IsServer || _net.IsClient)
            {
                NetworkHeroSpawning();
            }
            else
            {
                SpawnHeroes();
            }
        }