Example #1
0
		public void GenerateMap(int NeutralPlanets, Size MapSize)
		{
			this.MapSize = MapSize;
			Planets.Clear();

			for (int pc = 0; pc < Players.Count + NeutralPlanets; pc++)
			{
				Planet p = new Planet();

				int x = Program.rnd.Next(MapSize.Width);
				int y = Program.rnd.Next(MapSize.Height);

				while (Planets.Where(pi => pi.GridReference.X == x && pi.GridReference.Y == y).Count() > 0)
				{
					x = Program.rnd.Next(MapSize.Width);
					y = Program.rnd.Next(MapSize.Height);
				}
				p.GridReference = new Point(x, y);

				Planets.Add(p);
			}

			foreach (Player p in Players)
			{
				int pli = Program.rnd.Next(Planets.Count);
				while (Planets[pli].Owner != null)
				{
					pli = Program.rnd.Next(Planets.Count);
				}
				Planets[pli].Owner = p;
				Planets[pli].DefenceRate = 0.76;
				Planets[pli].Ships = 12;
				Planets[pli].ProductionRate = 6;
			}

			RedrawMap();
		}
Example #2
0
		public PlanetEventArgs(Planet SelectedPlanet)
		{
			Selected = SelectedPlanet;
		}