Beispiel #1
0
        private ToolSelectionCategory createTransportation()
        {
            GenericVoxelType <BasicFactory>    basicFactory    = new GenericVoxelType <BasicFactory>(v => new BasicFactory(v));
            GenericVoxelType <ConstantFactory> constantFactory = new GenericVoxelType <ConstantFactory>(v => new ConstantFactory(v));
            GenericVoxelType <Puller>          puller          = new GenericVoxelType <Puller>(v => new Puller(v));
            GenericVoxelType <Pusher>          pusher          = new GenericVoxelType <Pusher>(v => new Pusher(v));


            return(createCat("Transportation",
                             getVoxelType <RoadType>(),
                             getVoxelType <WarehouseType>(),
                             toToolItem(new DelegatePlayerTool("ConstantFood", v => v.ChangeType(typesFactory.Get <LandType>()), v
                                                               =>
            {
                v.ChangeType(constantFactory);
                var fact = ((IVoxel)v).GetPart <ConstantFactory>();
                fact.Rate = 1;
                fact.ItemsToGenerate = new[] { itemTypesFactory.CropType };
            })),
                             toToolItem(new DelegatePlayerTool("BasicFoodToPizza",
                                                               v => v.ChangeType(typesFactory.Get <LandType>()), v =>
            {
                v.ChangeType(basicFactory);
                var fact = ((IVoxel)v).GetPart <BasicFactory>();
                fact.EfficiencySpeedMultiplier = 1;
                fact.Input = new[]
                {
                    itemTypesFactory.CropType, itemTypesFactory.CropType,
                    itemTypesFactory.CropType
                };
                fact.Output = new[] { itemTypesFactory.PigmentType };
            })),
                             toToolItem(createTypeInput(puller)),
                             toToolItem(createTypeInput(pusher))


                             ));
        }
Beispiel #2
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));
        }