Class TrashCan
A class that can be used for objects like ParkTrashCan, allowing a trash can to contain a set of Content that can then be rummaged for using Rummage.
public class TrashCan : Furniture, IGenericDataHolder, IUpdatingObject, IContainerObject<Furniture>
- Inheritance
-
JsonTypeSafeGenericDataHolderTrashCan
- Implements
-
IGenericDataHolder
- Inherited Members
-
JsonTypeSafeGenericDataHolder.GetDataKeys()
- Extension Methods
Constructors
TrashCan(Guid, FurnitureType, int[], Map, Vector2, float)
Creates a new furniture instance. By default, this is done using Construct<T>(int[], Map, Vector2, float, Guid?).
public TrashCan(Guid id, FurnitureType type, int[] colors, Map map, Vector2 pos, float floor)
Parameters
idGuidThe id to apply to the created furniture instance
typeFurnitureTypeThe type to create an instance of
colorsint[]The colors to apply to the furniture
mapMapThe map to create the furniture on
posVector2The position that the furniture should have
floorfloatThe floor that this object is on.
Fields
Content
This trash can't content, which is a list of Furniture items that have previously been thrown away into it.
[DataMember]
public readonly List<Furniture> Content
Field Value
Properties
CurrentMode
A property that returns the current IUpdatingObject.UpdateMode for this updating object. This property defaults to returning MajorIfActive. When moving updating objects between update modes (ie changing the return value), objects are moved automatically after the respective update is invoked. This means that update mode changes don't occur immediately. See the documentation for each IUpdatingObject.UpdateMode for more information.
public IUpdatingObject.UpdateMode CurrentMode { get; }
Property Value
Methods
AddContent(Furniture)
public bool AddContent(Furniture content)
Parameters
contentFurniture
Returns
Draw(GameTime, object, Vector2, float, Vector2, Color?, Direction2, int[], float, bool, ParentInfo, float, List<Item>)
Draws this furniture in the world with the given settings. When overriding this method, furniture objects should use DrawColumns(Map, Vector2, float, object, Vector2, TextureRegion, Color, Vector2, Point, List<Item>, bool, ParentInfo, float, SpriteEffects, bool) for drawing their textures or alternatively manually calculate the depth to draw with using GetDepth(Vector2, float, float, bool, bool, bool). This is a more generalized version of Draw(GameTime, object, Vector2, Color?, List<Item>).
public override void Draw(GameTime time, object batch, Vector2 pos, float floor, Vector2 drawPos, Color? overrideColor, Direction2 rotation, int[] colors, float drawScale, bool pivot, ParentInfo parent, float depthOffset, List<StaticSpriteBatch.Item> items)
Parameters
timeGameTimeThe game time
batchobjectThe sprite batch to draw with, which is either a Microsoft.Xna.Framework.Graphics.SpriteBatch or MLEM.Graphics.StaticSpriteBatch.
posVector2The position, in world space, that the furniture is at
floorfloatThe floor to draw at.
drawPosVector2The position, in draw space, to draw the furniture at
overrideColorColor?An optional color to override the default colors of the furniture
rotationDirection2The rotation that the furniture should be drawn with.
colorsint[]The colors to draw the furniture with
drawScalefloatThe scale to draw the furniture with
pivotboolWhether or not to move the furniture by its texture's pivot point
parentParentInfoThe object that this furniture is latched on to, or null if there is none
depthOffsetfloatA value that is added onto the calculated depth of the object
itemsList<StaticSpriteBatch.Item>A list of sprite batch items that items should be added to if the
batchis a MLEM.Graphics.StaticSpriteBatch.
GetDecorativeRating(Room)
Returns the decorative rating of this object in the given room. By default, the underlying Type's DecorativeRating, influeced by whether this object is Dirty, is returned.
public override float GetDecorativeRating(Room room)
Parameters
roomRoomThe room that the object is in, or null if it is not in a room at all
Returns
- float
The decorative rating of this object
RemoveContent(Furniture)
public bool RemoveContent(Furniture content)
Parameters
contentFurniture
Returns
ResetToStatic(bool, bool)
Resets this map object to a static state when the Map that is on is exported.
public override bool ResetToStatic(bool thorough, bool custom)
Parameters
thoroughboolWhether a more thorough reset is expected, which usually involves normalizing additional data and cleaning up player data entirely. This is true when a map with this object on it is exported, as well as when households are exported for official usage in the game.
customboolWhether the static reset is happening in a custom context, that is, a Household being exported normally rather than through cheats, or a custom Map being exported.
Returns
- bool
Whether this object should stay on the map after the static reset. If false is returned, this object is removed.
Update(GameTime, TimeSpan, float)
The update method, which is called every update frame by the underlying Map, as well as additional places like the FurnitureStorage. Because of this, some actions might only want to be invoked if an object IsInWorld. To call this method while invoking all required events, use DoUpdate(GameTime, TimeSpan, float).
public void Update(GameTime time, TimeSpan passedInGame, float speedMultiplier)
Parameters
timeGameTimeThe game's time
passedInGameTimeSpanThe amount of time that has passed since the last call
speedMultiplierfloatThe game speed multiplier, which represents how fast things should happen, which is usually determined by Speed
Validate(AppliedMigrations)
This method is called when this object is loaded from disk. Returning false on this method causes the object to be removed from the map. By default, this method invokes OnValidated and OnEventsAttachable.
public override bool Validate(AppliedMigrations appliedMigrations)
Parameters
appliedMigrationsAppliedMigrations
Returns
- bool
false if the object is not valid, true otherwise