コード例 #1
0
        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);
            }
        }
コード例 #2
0
        public CompleteWorld GenerateWorldTerrain()
        {
            var world   = new CompleteWorld();
            var terrain = world.Terrain;

            terrain.Init();
            var terrainbuilder = new TerrainBuilder();

            terrainbuilder.Init(terrain);
            terrainbuilder.DiamondAlgoritm();
            return(world);
        }
コード例 #3
0
        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);
        }