Class RemoveTool
A tool is a type of game mode that is currently active. Tools are split up into the PlayModeTool and BuildTools, the latter of which holds all tools that can be found in the build menu.
public class RemoveTool : Tool
- Inheritance
-
RemoveTool
- Inherited Members
- Extension Methods
Constructors
RemoveTool()
public RemoveTool()
Methods
CanUndoRedo(bool)
Returns whether or not the UndoRedoStack can currently operate and thus, whether the Undo() or Redo() actions can be called.
public override bool CanUndoRedo(bool cursorOnUi)
Parameters
cursorOnUibool
Returns
- bool
Whether the undo or redo commands can be used right now.
Draw(GameTime, SpriteBatch, bool)
This method is called every draw frame for the CurrentTool. By default, this method invokes OnDraw.
public override void Draw(GameTime time, SpriteBatch batch, bool cursorOnUi)
Parameters
timeGameTimeThe game's time
batchSpriteBatchThe sprite batch used for drawing
cursorOnUiboolWhether the cursor is currently covering the ui.
GetMouseCursor()
Returns the CursorType that this tool should currently display. By default, Default is returned.
public override CursorType GetMouseCursor()
Returns
- CursorType
The cursor type
PlayDestroySound()
Plays the destroy sound
public static void PlayDestroySound()
RemoveFurniture(Furniture, UndoableAction)
Removes the given furniture from the world, additionally removing all of its GetChildren<T>() and adding the required amount of Money Note that the furniture's parent-child relationships are not edited or removed, so UnlinkParentsAndChildren() should be called if the furniture is added into a household storage or similar.
public static bool RemoveFurniture(Furniture furniture, UndoableAction action)
Parameters
furnitureFurnitureThe furniture item to remove
actionUndoableActionThe undoable action that this method should add its actions to. If this method should be executed immediately, use the UndoableAction immediate constructor.
Returns
- bool
Whether the removal was a success, which is only false if the passed
furniturehas the NonSellable category
RemoveNonGroundTile(Point, int, UndoableAction)
Removes the given non-ground tile from the map, restores the appropriate amount of money, remoevs any furniture that was on the ground, and spawns the appropriate particles.
public static bool RemoveNonGroundTile(Point pos, int floor, UndoableAction action)
Parameters
posPointThe position of the tile to remove.
floorintThe floor of the tile to remove.
actionUndoableActionThe undoable action that this method should add its actions to. If this method should be executed immediately, use the UndoableAction immediate constructor.
Returns
- bool
Whether the tile will be successfully removed as part of the
action.
RemoveRoof(Roof, UndoableAction, Rectangle?)
Removes the given roof from the world, additionally removing any CeilingHanging furniture below it and returning the money for the objects
public static void RemoveRoof(Roof roof, UndoableAction action, Rectangle? newRoof = null)
Parameters
roofRoofThe roof to remove
actionUndoableActionThe undoable action that this method should add its actions to. If this method should be executed immediately, use the UndoableAction immediate constructor.
newRoofRectangle?The area of a roof that replaces this one, or null if this roof is just being removed without a replacement.
RemoveStairs(Stairs, UndoableAction)
Removes the given stairs from the world and refunds the appropriate amount of money.
public static void RemoveStairs(Stairs stairs, UndoableAction action)
Parameters
stairsStairsThe stairs to remove.
actionUndoableActionThe undoable action that this method should add its actions to. If this method should be executed immediately, use the UndoableAction immediate constructor.
RemoveWall(WallLike, UndoableAction)
Removes the given wall from the world, additionally removing any hanging Furniture and adding the required amount of Money
public static void RemoveWall(WallLike wall, UndoableAction action)
Parameters
wallWallLikeThe wall to remove
actionUndoableActionThe undoable action that this method should add its actions to. If this method should be executed immediately, use the UndoableAction immediate constructor.
ShouldHighlightSelectedObject(object)
Whether or not the selected object should currently have a white highlight around it. This method defaults to return true if IsCursorOnUi() is false.
public override bool ShouldHighlightSelectedObject(object obj)
Parameters
Returns
- bool
Whether or not the selected object should be highlighted
SpawnDestroyParticles(RectangleF, float, float, params (TextureRegion, Color)[])
Spawns a set of particles for an arbitrary object being destroyed. If a Furniture is destroyed, SpawnDestroyParticles(Furniture) should be used instead.
public static void SpawnDestroyParticles(RectangleF area, float floor, float amountMultiplier, params (TextureRegion, Color)[] textures)
Parameters
areaRectangleFThe area to spawn particles in.
floorfloatThe floor to spawn particles on.
amountMultiplierfloatThe amount of particles that should be spawned, which will be multiplied with the size of the
areatextures(TextureRegion, Color)[]The textures and their colors to choose from when spawning the particles.
SpawnDestroyParticles(Furniture)
Spawns a set of particles for the given Furniture being destroyed. The particles are based on the furniture's textures and colors.
public static void SpawnDestroyParticles(Furniture furniture)
Parameters
furnitureFurnitureThe furniture whose particles to spawn.
SpawnDestroyParticles(WallLike)
Spawns a set of particles for the given WallLike object being destroyed. The particles are based on the item's textures and colors.
public static void SpawnDestroyParticles(WallLike wall)
Parameters
wallWallLikeThe wall whose particles to spawn.
StoreOrRemoveFurniture(Furniture, UndoableAction)
Stores the passed Furniture into the current household's FurnitureStorage, or, if there is no current household, removes the object using RemoveFurniture(Furniture, UndoableAction) instead. If the passed furniture is in the world and has children, the children are also stored (or removed) recursively.
public static bool StoreOrRemoveFurniture(Furniture furniture, UndoableAction action)
Parameters
furnitureFurnitureThe furniture to store (or remove)
actionUndoableActionThe undoable action that this method should add its actions to. If this method should be executed immediately, use the UndoableAction immediate constructor.
Returns
- bool
Whether the storage or removal was a success, which is only false if there is no current household and the passed
furniturehas the NonSellable category
Update(GameTime, bool)
This method is called every update frame for the CurrentTool. By default, this method updates the MousePos and invokes OnUpdate, and also manages the UndoRedoStack.
public override void Update(GameTime time, bool cursorOnUi)
Parameters
timeGameTimeThe game's time
cursorOnUiboolWhether the cursor is currently covering the ui.
Events
OnRemoveArea
An event that is invoked when an area is intended to be removed from the world using the RemoveTool. The event receives the area that the user is trying to remove, and can modify it. It also receives a modifiable bool that indicates whether anything in the area was removed. If this is true after the Post phase, the destruction sound (PlayDestroySound()) will be played. If this is false, the UndoableAction will not be executed.
public static event RemoveTool.RemoveAreaDelegate OnRemoveArea
Event Type
OnRemoveObject
An event that is invoked when a single object is intended to be removed from the world using the RemoveTool. The passed nullable bool defaults to null, but setting it to a value will cause the object removal to short-circuit after this event is invoked, and no additional objects to be queried for removal. If it is set to false, the UndoableAction will not be executed.
public static event RemoveTool.RemoveObjectDelegate OnRemoveObject