Example #1
0
        public override PersonComponent Create()
        {
            if (TypeObject.Naming?.Value)
            {
                var namingFactory = new NamingFactory(TypeObject.Naming.Value, GameObject);
                namingFactory.Create();
            }

            return(Component);
        }
Example #2
0
        public override EntityComponent Create()
        {
            if (TypeObject.Naming?.Value)
            {
                var namingFactory = new NamingFactory(TypeObject.Naming.Value, GameObject);
                namingFactory.Create();
            }

            var parentLocationComponent = ParentObject.GetComponent <LocationComponent>();

            if (parentLocationComponent)
            {
                Component.Position = parentLocationComponent.EntryCell.ToWorld();
            }

            return(Component);
        }
Example #3
0
        public override CityComponent Create()
        {
            Locator.City = Component;

            if (TypeObject.Naming?.Value)
            {
                var namingFactory = new NamingFactory(TypeObject.Naming.Value, GameObject);
                namingFactory.Create();
            }

            var timeFactory = new TimeFactory(TypeObject.Time.Value, GameObject);

            timeFactory.Create();

            var mapFactory = new MapFactory(TypeObject.Map.Value, GameObject);

            mapFactory.Create();

            return(Component);
        }
Example #4
0
        public override MapComponent Create()
        {
            if (TypeObject.Naming?.Value)
            {
                var namingFactory = new NamingFactory(TypeObject.Naming.Value, GameObject);
                namingFactory.Create();
            }

            var entityRegistryFactory   = new EntityRegistryFactory(TypeObject.EntityRegistry.Value, GameObject);
            var entityRegistryComponent = entityRegistryFactory.Create();

            Component.Size      = TypeObject.Size.Value;
            Component.MapLayout = TypeObject.MapLayout.Value;

            var navFactory   = new NavFactory(TypeObject.Nav.Value, GameObject);
            var navComponent = navFactory.Create();

            entityRegistryComponent.Registered   += Component.OnEntityRegistered;
            entityRegistryComponent.Unregistered += Component.OnEntityUnregistered;

            CreateMarket(TypeObject);
            navComponent.CalculateNavMap();

            foreach (var workerHome in TypeObject.WorkerHomes)
            {
                var workerHomeFactory = new WorkerHomeFactory(workerHome.Value, parentObject: GameObject);
                workerHomeFactory.Create(Component);

                navComponent.CalculateNavMap();
            }

            foreach (var company in TypeObject.Companies)
            {
                var companyFactory = new CompanyFactory(company.Value, parentObject: GameObject);
                companyFactory.Create(Component);

                navComponent.CalculateNavMap();
            }

            return(Component);
        }
Example #5
0
        public override ExchangeComponent Create()
        {
            if (TypeObject.Naming?.Value)
            {
                var namingFactory = new NamingFactory(TypeObject.Naming.Value, GameObject);
                namingFactory.Create();
            }

            var inventoryFactory = new InventoryFactory(TypeObject.Inventory.Value, GameObject, allowMultiple: true);

            inventoryFactory.Create();

            if (TypeObject.ProductInventory?.Value)
            {
                var productInventoryFactory = new InventoryFactory(TypeObject.ProductInventory.Value, GameObject, allowMultiple: true);
                productInventoryFactory.Create();
            }

            Component.IsPurchasing = TypeObject.IsPurchasing;
            Component.IsSelling    = TypeObject.IsSelling;

            return(Component);
        }
Example #6
0
        public override LocationComponent Create()
        {
            if (TypeObject.Naming?.Value)
            {
                var namingFactory = new NamingFactory(TypeObject.Naming.Value, GameObject);
                namingFactory.Create();
            }

            Component.MapPrefab = TypeObject.MapPrefab;

            var entityRegistryFactory   = new EntityRegistryFactory(TypeObject.EntityRegistry.Value, GameObject);
            var entityRegistryComponent = entityRegistryFactory.Create();

            entityRegistryComponent.Registered   += Component.OnEntityRegistered;
            entityRegistryComponent.Unregistered += Component.OnEntityUnregistered;

            if (TypeObject.Building?.Value)
            {
                var buildingFactory = new BuildingFactory(TypeObject.Building.Value, GameObject);
                buildingFactory.Create();
            }

            return(Component);
        }