public void Populate(CompleteWorld world) { Random rand = new Random(); for (int i = 0; i < 5; i++) { Tree a = new Tree { Height = ((float)rand.NextDouble() * 10), Location = GetRandomWorldLocation(world) }; world.Agents.Add(a); } for (int i = 0; i < 30; i++) { Rabbit a = new Rabbit(); a.Location = GetRandomWorldLocation(world); a.Speed = new SpeedVector(); world.Agents.Add(a); RabbitIA ia = new RabbitIA(a); world.Ias.Add(ia); } }
public CompleteWorld GenerateWorldTerrain() { var world = new CompleteWorld(); var terrain = world.Terrain; terrain.Init(); var terrainbuilder = new TerrainBuilder(); terrainbuilder.Init(terrain); terrainbuilder.DiamondAlgoritm(); return(world); }
public WorldLocation GetRandomWorldLocation(CompleteWorld world) { var location = new WorldLocation(); var lenght = world.Terrain.SIZE; location.X = (float)a.NextDouble() * lenght; location.Y = (float)a.NextDouble() * lenght; location.Z = 0;// (float)a.NextDouble() * lenght; return(location); }