Пример #1
0
        private static Farmer GenerateFarm(Area area, int x, int y, string name)
        {
            var farm = new Farm(Guid.NewGuid(), "Farm", 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 Farmer(Guid.NewGuid(), name, farm);
            var field  = new Field(Guid.NewGuid(), "Field", area, x + 30 + RandomSingleton.Instance.Random.Next(0, 40), y + 30 + RandomSingleton.Instance.Random.Next(-100, 40), 10, 10);
            var field1 = new Field(Guid.NewGuid(), "Field1", area, x - 40, y, 10, 10);
            var field2 = new Field(Guid.NewGuid(), "Field2", area, x, y - 40, 10, 10);

            person.Inventory.AddResource(Constants.ResourceIdCoin, RandomSingleton.Instance.Random.Next(0, 10));
            farm.Owner   = person;
            field.Owner  = person;
            field1.Owner = person;
            field2.Owner = person;
            barn.Owner   = person;

            person.AddOwnerShip(farm);
            person.AddOwnerShip(field);
            person.AddOwnerShip(field1);
            person.AddOwnerShip(field2);
            person.AddOwnerShip(barn);

            barn.Inventory.AddResource(new WheatSeed(), 100);

            area.AddLocation(farm);
            area.AddLocation(field);
            area.AddLocation(field1);
            area.AddLocation(field2);
            area.AddLocation(barn);
            return(person);
        }
Пример #2
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);
        }
Пример #3
0
        private static Baker GenerateBakery(Area area, int x, int y, string name)
        {
            var bakery = new Bakery(Guid.NewGuid(), "Bakery", area, x, y, 20, 20, true);
            var person = new Baker(Guid.NewGuid(), name, bakery);

            bakery.Owner = person;

            person.AddOwnerShip(bakery);
            person.Inventory.AddResource(new Coin(), 100);
            area.AddLocation(bakery);

            return(person);
        }
Пример #4
0
        private static ShopOwner GenerateShop(Area area, int x, int y, string name)
        {
            var shop   = new Shop(Guid.NewGuid(), "Shop", area, x, y, 20, 20);
            var person = new ShopOwner(Guid.NewGuid(), name, shop);

            shop.Owner = person;

            person.AddOwnerShip(shop);
            shop.Inventory.AddResource(new WheatSeed(), 10000);
            area.AddLocation(shop);

            return(person);
        }
Пример #5
0
        private static void GenerateWell(Area area, int x, int y)
        {
            var well = new Well(Guid.NewGuid(), "Well", area, x, y, 20, 20);

            area.AddLocation(well);
        }