Пример #1
0
        public static World Generate()
        {
            //var building = new Building("Farm house");
            Debug.Log("Generating Test world");
            var       world   = new World();
            var       area    = new Area("Farm area");
            Farmer    person  = GenerateFarm(area, 20, 20, "Jim");
            Farmer    person1 = GenerateFarm(area, 120, 150, "John");
            Farmer    person2 = GenerateFarm(area, -120, -120, "Wim");
            Farmer    person3 = GenerateFarm(area, -130, 100, "Eddard");
            Farmer    person4 = GenerateFarm(area, 130, -90, "John");
            ShopOwner person5 = GenerateShop(area, 0, -160, "Mark");
            Miller    person6 = GenerateMill(area, 0, 160, "Mark");
            Baker     person7 = GenerateBakery(area, -40, 160, "Mark");

            GenerateWell(area, 60, 175);
            world.AddPerson(person);
            world.AddPerson(person1);
            world.AddPerson(person2);
            world.AddPerson(person3);
            world.AddPerson(person4);
            world.AddPerson(person5);
            world.AddPerson(person6);
            world.AddPerson(person7);


            //for(int i = 0; i < 10000; i++)
            //{
            //    Farmer personx = GenerateFarm(area, 20+i*100, 20, "Jim");
            //    world.AddPerson(personx);
            //}
            world.AddArea(area);

            return(world);
        }
Пример #2
0
        private void CreateMillers()
        {
            for (var i = 1; i <= MaxNumberOfMillers; i++)
            {
                var miller = new Miller
                {
                    Id      = Guid.NewGuid(),
                    Name    = "Miller " + i,
                    Address = "Miller Address " + i
                };

                m_MillersRepository.Save(miller);
            }
        }
Пример #3
0
        private static Miller GenerateMill(Area area, int x, int y, string name)
        {
            var mill   = new Mill(Guid.NewGuid(), "Mill", area, x, y, 20, 20, true);
            var barn   = new Barn(Guid.NewGuid(), "Barn", area, x + RandomSingleton.Instance.Random.Next(-10, 30), y + 20 + RandomSingleton.Instance.Random.Next(-5, 20), 10, 10);
            var person = new Miller(Guid.NewGuid(), name, mill);

            person.Inventory.AddResource(Constants.ResourceIdCoin, 100);
            mill.Owner = person;

            person.AddOwnerShip(mill);
            person.AddOwnerShip(barn);
            area.AddLocation(mill);
            area.AddLocation(barn);

            return(person);
        }