Example #1
0
 public static void newLevel()
 {
     planets = new List<Planet>();
     ships = new List<Ship>();
     entities = entities.Where(x => x is Background).ToList();
     TeamManager.Clear();
     TeamManager.colorIndex = new List<int> { 0, 1, 2, 3, 4, 5};
     TeamManager.usedColorIndexes = new List<int>();
     LevelSpawner Level = new LevelSpawner(45);
     TeamManager.GenerateTeams(Level, 2);
     Level.Spawn();
 }
Example #2
0
        public static void GenerateTeams(LevelSpawner level, int n)
        {
            for (int i = 0; i < n; i++)
                teams.Add(new Team(i));

            Team.GenerateHomePositions(n);

            int j = 0;
            Planet[] homePlanets = new Planet[n];
            foreach (Team team in TeamManager.teams)
            {
                homePlanets[j] = team.getHomePlanet();
                j++;
            }

            level.AddHomePlanets(homePlanets);
        }
Example #3
0
        /// <summary>
        /// Allows the game to perform any initialization it needs to before starting to run.
        /// This is where it can query for any required services and load any non-graphic
        /// related content.  Calling base.Initialize will enumerate through any components
        /// and initialize them as well.
        /// </summary>
        protected override void Initialize()
        {
            base.Initialize();

            ParticleManager = new ParticleManager<ParticleState>(1024 * 20, ParticleState.UpdateParticle);

            //EntityManager.Add(Planet.Instance);
            Background Background = new Background();
            EntityManager.Add(Background);

            // spawns the level and the planets
            LevelSpawner Level = new LevelSpawner(45);
            TeamManager.GenerateTeams(Level, 2);
            Level.Spawn();

            //Console.WriteLine("in main starting thread");
            ServerThread.Start();
            //Console.WriteLine("back to main");
            //inputserver.StartListening();
        }