public MonumentVoxelBrain(ItemTypesFactory typesFactory, UserInputService inputService, InfestationVoxelType infestationVoxelType, IVoxelHandle handle)
 {
     this.inputService         = inputService;
     this.infestationVoxelType = infestationVoxelType;
     crystalType = typesFactory.CrystalType;
     this.Handle = handle;
 }
Ejemplo n.º 2
0
 public QuarryType(ItemTypesFactory itemTypeFactory)
     : base("Quarry")
 {
     stoneType         = itemTypeFactory.StoneType;
     maxDataVal        = datavalOffset + batchSize * 5;
     neededWorkerCount = 5;
 }
Ejemplo n.º 3
0
        public MarketType(ItemTypesFactory itemTypesFactory)
            : base("Market")
        {
            this.itemTypesFactory = itemTypesFactory;
            Color = Color.Gray;

            marketInventory = new List <MarketResourceType>
            {
                new MarketResourceType
                {
                    ItemType         = itemTypesFactory.CropType,
                    MaxResourceLevel = 15
                },
                new MarketResourceType
                {
                    ItemType         = itemTypesFactory.FishType,
                    MaxResourceLevel = 24
                }
            };

            totalCapacity = 0;
            foreach (var resourceType in marketInventory)
            {
                totalCapacity += resourceType.MaxResourceLevel;
            }

            rnd = new Random();
        }
Ejemplo n.º 4
0
        public GrinderType(ItemTypesFactory itemTypeFactory, ItemTypesFactory typesFactory)
            : base("Grinder")
        {
            this.typesFactory     = typesFactory;
            pigmentType           = itemTypeFactory.PigmentType;
            oreType               = itemTypeFactory.CrystalType;
            datavalGrindRangeHigh = datavalGrindRangeLow + inventorySize;

            myTimer          = new Timer(100);
            myTimer.Elapsed += incrementCounter;
            myTimer.Enabled  = true;
        }
Ejemplo n.º 5
0
        public ForestType(ItemTypesFactory factory)
            : base("Forest")
        {
            Color = Color.Green;
            //ColoredBaseMesh = true;
            woodItem = factory.WoodType;

            /*for (int i = 0; i < HarvestDataValue; i++)
             * {
             *  var scale = 0.1f + (i / (float)HarvestDataValue * 0.9f);
             *  datavalueMeshes[i] = MeshBuilder.Transform(mesh, Matrix.Scaling(1, scale, 1));
             * }*/
        }
Ejemplo n.º 6
0
 public ToolMenuBuilder(VoxelTypesFactory typesFactory,
                        Internal.Model.World world,
                        Func <string, ToolSelectionCategory> createCategory,
                        ToolSelectionTool.Factory createToolItem,
                        IIndex <Type, PlayerTool> getPlayerTool,
                        ItemTypesFactory itemTypesFactory)
 {
     this.typesFactory     = typesFactory;
     this.world            = world;
     this.createCategory   = createCategory;
     this.createToolItem   = createToolItem;
     this.getPlayerTool    = getPlayerTool;
     this.itemTypesFactory = itemTypesFactory;
 }
Ejemplo n.º 7
0
        //private ItemType outgoingKanbanType;
        //private ItemType incomingKanbanType;


        public RoadType(ItemTypesFactory itemTypesFactory)
            : base("Road")
        {
            this.itemTypesFactory = itemTypesFactory;
            meshBuilder           = new FourWayModelBuilder
            {
                BaseMesh = datavalueMeshes.ContainsKey(0) ? datavalueMeshes[0] : null,
                WayMesh  = datavalueMeshes.ContainsKey(1) ? datavalueMeshes[1] : null,
                //NoWayMesh = datavalueMeshes.ContainsKey(2) ? datavalueMeshes[2] : null,
                HeightWayMeshes = new[] { datavalueMeshes[2], datavalueMeshes[3] }.ToList(),
            };

            /*outgoingKanbanType = new ItemType() { Name = "OutgoingKanban" };
             * outgoingKanbanType.Mesh = UtilityMeshes.CreateBoxColored(Color.Red, new Vector3(0.5f));
             *
             * incomingKanbanType = new ItemType() { Name = "IncomingKanban" };
             * incomingKanbanType.Mesh = UtilityMeshes.CreateBoxColored(Color.Green, new Vector3(0.5f));*/
        }
Ejemplo n.º 8
0
        public HouseType(ItemTypesFactory itemTypesFactory, TownCenterService townCenterService)
            : base("House")
        {
            this.itemTypesFactory  = itemTypesFactory;
            this.townCenterService = townCenterService;
            neededResources        = new[]
            {
                new VillageResource {
                    ItemType = itemTypesFactory.CropType, MaxResourceLevel = 3, MinResourceLevel = 1, ConsummationRate = 10
                },
                new VillageResource {
                    ItemType = itemTypesFactory.FishType, MaxResourceLevel = 2, MinResourceLevel = 1, ConsummationRate = 10
                }
            }.ToList();

            totalResourceCapacity = 0;
            foreach (var res in neededResources)
            {
                totalResourceCapacity += res.MaxResourceLevel;
            }

            ReceiveCreationEvents = true;
        }
Ejemplo n.º 9
0
        public BuildingSiteType(GameVoxelType building, List <ItemAmount> neededResources, string name, ItemTypesFactory itemTypesFactory)
            : base("BuildingSite" + name)
        {
            this.building          = building;
            this.neededResources   = neededResources;
            this.itemTypesFactory  = itemTypesFactory;
            totalNbNeededResources = 0;
            foreach (var res in neededResources)
            {
                totalNbNeededResources += res.Amount;
            }

            searchSuggestedMeshes("BuildingSite");
            Color = Color.White;

            meshes = new List <IMesh>();
            for (int i = 0; i < nbBuildingSiteModels; i++)
            {
                var baseMesh = datavalueMeshes[i];
                MeshBuilder.AppendMeshTo(building.GetDataValueMesh(0), baseMesh, Matrix.Identity);
                meshes.Add(baseMesh);
            }
        }
Ejemplo n.º 10
0
        public void Setup()
        {
            var builder = new ContainerBuilder();

            builder.RegisterModule <OfflineGameModule>();
            builder.RegisterType <Internal.Model.World>().SingleInstance().AsSelf()
            .OnActivating(args =>
            {
                args.Instance.Initialize(10, 10);

                var land = args.Context.Resolve <LandType>();
                args.Instance.ForEach((v, p) => v.ChangeType(land));
            });


            var cont = builder.Build();

            var offline = cont.Resolve <GodGameOffline>();

            offline.AddSimulatorsToEngine(EngineFactory.CreateEngine());
            world = offline.World;
            types = cont.Resolve <VoxelTypesFactory>();
            items = cont.Resolve <ItemTypesFactory>();

            basicFactory    = new GenericVoxelType <BasicFactory>(v => new BasicFactory(v));
            constantFactory = new GenericVoxelType <ConstantFactory>(v => new ConstantFactory(v));
            pusher          = new GenericVoxelType <Pusher>(v => new Pusher(v));
            puller          = new GenericVoxelType <Puller>(v => new Puller(v));

            v55 = world.GetVoxel(new Point2(5, 5));
            v56 = world.GetVoxel(new Point2(5, 6));
            v57 = world.GetVoxel(new Point2(5, 7));

            v46 = world.GetVoxel(new Point2(4, 6));
            v36 = world.GetVoxel(new Point2(3, 6));
        }
        public AllCommandProvider(WorldPersisterService persister,
                                  Internal.Model.World world,
                                  VoxelTypesFactory typesFactory,
                                  ItemTypesFactory itemTypesFactory,
                                  UserInputProcessingService userInputProcessingService,
                                  GenericDatastore genericDatastore)
        {
            this.typesFactory     = typesFactory;
            this.itemTypesFactory = itemTypesFactory;
            this.genericDatastore = genericDatastore;
            addDummy();

            addPersistence(persister, world);

            addCommand("clearinfestation", () =>
            {
                world.ForEach((v, _) =>
                {
                    if (v.Type != typesFactory.Get <InfestationVoxelType>())
                    {
                        return;
                    }
                    typesFactory.Get <InfestationVoxelType>().CureInfestation(v);
                });

                return("Cleared all infestation!");
            });

            addCommand("helpall", () =>
            {
                return("All Commands: " + string.Join(", ", CommandNames.ToArray()));
            });
            addCommand("help", partialCommand =>
            {
                return("Commands containing '" + partialCommand + "': " + string.Join(", ", CommandNames.Where(c => c.Contains(partialCommand)).ToArray()));
            });
            addCommand("clearWorld", () =>
            {
                genericDatastore.ClearAll();
                world.ForEach((v, _) =>
                {
                    v.Data.Type = typesFactory.Get <LandType>();
                });
                return("World cleared!");
            });
            addCommand("listsaves", () =>
            {
                var saves        = TWDir.GameData.CreateChild("Saves\\GodGame").GetFiles().ToList();
                var outputstring = String.Join(", ", saves.Select(e => e.Name.Substring(0, e.Name.Length - 4)));     // Drop extension
                return("Saved games: \n" + outputstring);
            });

            addCommand("addresource", (typeStr, amountStr) =>
            {
                var itemType = itemTypesFactory.AllTypes.FirstOrDefault(t => t.Name.ToLower() == typeStr.ToLower());
                if (itemType == null)
                {
                    return("Item type not found: " + typeStr);
                }
                var amount = 0;
                if (!int.TryParse(amountStr, out amount))
                {
                    return("Invalid item amount: " + amountStr);
                }

                var target = userInputProcessingService.GetTargetedVoxel();
                if (target == null || target.Type != typesFactory.Get <WarehouseType>())
                {
                    return("Not targeting a warehouse");
                }

                target.Data.Inventory.AddNewItems(itemType, amount);

                return("Added items!");
            });
        }
Ejemplo n.º 12
0
 public FisheryType(ItemTypesFactory factory)
     : base("Fishery")
 {
     Color    = Color.Blue;
     fishType = factory.FishType;
 }
Ejemplo n.º 13
0
 public OreType(ItemTypesFactory factory)
     : base("Ore")
 {
     oreItemType           = factory.CrystalType;
     ReceiveCreationEvents = true;
 }
Ejemplo n.º 14
0
 public CropType(ItemTypesFactory factory)
     : base("Crop")
 {
     cropItemType = factory.CropType;
 }
 public GameplayObjectsSerializer(PlayerToolsFactory toolsFactory, VoxelTypesFactory typesFactory, ItemTypesFactory itemTypesFactory)
 {
     this.typesFactory     = typesFactory;
     this.itemTypesFactory = itemTypesFactory;
     allTools = toolsFactory.Tools;
 }