Пример #1
0
        private PlayerTool createTypeInput(GameVoxelType type, string name)
        {
            var ret = new DelegatePlayerTool(name,
                                             v => v.ChangeType(typesFactory.Get <LandType>()),
                                             v =>
            {
                if (v.Type == typesFactory.Get <LandType>())
                {
                    v.ChangeType(type);
                }
            });

            ret.onTargetChanged = (player, v, key, mouse) =>
            {
                if (mouse.LeftMousePressed)
                {
                    ret.onLeftClick(v);
                }
                else if (mouse.RightMousePressed)
                {
                    ret.onRightClick(v);
                }
            };
            return(ret);
        }
Пример #2
0
        private PlayerTool createBuildingSiteInput(GameVoxelType type, string name)
        {
            var buildingSiteType = typesFactory.GetBuildingSite(type);
            var ret = new DelegatePlayerTool(name,
                                             v => v.ChangeType(typesFactory.Get <LandType>()),
                                             v =>
            {
                if (v.Type != typesFactory.Get <LandType>())
                {
                    return;
                }
                if (CheatmodeEnabled)
                {
                    v.ChangeType(type);
                }
                else
                {
                    v.ChangeType(buildingSiteType);
                }
            });

            return(ret);
        }
Пример #3
0
 private PlayerTool createTypeInput(GameVoxelType type)
 {
     return(createTypeInput(type, type.Name));
 }
Пример #4
0
 private ToolSelectionTool createTool(GameVoxelType type)
 {
     return(toToolItem(createTypeInput(type)));
 }
Пример #5
0
 public BuildingSiteType GetBuildingSite(GameVoxelType typeToBuild)
 {
     return(buildingSites[typeToBuild]);
 }
Пример #6
0
        private BuildingSiteType createBuildingSite(IEnumerable <BuildingSiteType.ItemAmount> amounts, GameVoxelType typeToBuild)
        {
            if (buildingSites.ContainsKey(typeToBuild))
            {
                throw new InvalidOperationException("Already added a building site for type " + typeToBuild.Name);
            }
            var ret = new BuildingSiteType(typeToBuild, amounts.ToList(), typeToBuild.Name, itemTypes);

            buildingSites[typeToBuild] = ret;
            ret.InjectVoxelTypesFactory(this);
            return(ret);
        }