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); }
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); }
private PlayerTool createTypeInput(GameVoxelType type) { return(createTypeInput(type, type.Name)); }
private ToolSelectionTool createTool(GameVoxelType type) { return(toToolItem(createTypeInput(type))); }
public BuildingSiteType GetBuildingSite(GameVoxelType typeToBuild) { return(buildingSites[typeToBuild]); }
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); }