Table of Contents

Class TrashCan

Namespace
TinyLife.Objects
Assembly
Tiny Life.dll

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
Inheritance
JsonTypeSafeGenericDataHolder
TrashCan
Implements
IGenericDataHolder
Inherited Members
JsonTypeSafeGenericDataHolder.GetDataKeys()
Extension Methods

Constructors

TrashCan(Guid, FurnitureType, int[], Map, Vector2)

Creates a new furniture instance. By default, this is done using Construct<T>(int[], Map, Vector2, Guid?).

public TrashCan(Guid id, FurnitureType type, int[] colors, Map map, Vector2 pos)

Parameters

id Guid

The id to apply to the created furniture instance

type FurnitureType

The type to create an instance of

colors int[]

The colors to apply to the furniture

map Map

The map to create the furniture on

pos Vector2

The position that the furniture should have

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

List<Furniture>

Properties

IsMinorUpdateNow

A property that returns whether this updating object should currently update minorly, rather than majorly. A minor update means that Update(GameTime, TimeSpan, float) is only called once every 10 in-game minutes (see MinorUpdateMinutes), but all of the parameters to Update(GameTime, TimeSpan, float) are modified accordingly to maintain proper time calculations. Note that this property is only queried every 10 in-game minutes, as switching between major and minor update schedules only happens when a minor update is executed. For example, a Person updates minorly when they're out of town to aid the game's performance.

public bool IsMinorUpdateNow { get; }

Property Value

bool

Methods

Draw(GameTime, object, Vector2, Vector2, Color?, Direction2, int[], float, bool, ParentInfo, float, bool, List<Item>)

Draws this furniture in the world with the given settings. This is a more generalized version of Draw(GameTime, object, Vector2, Color?, List<Item>)

public override void Draw(GameTime time, object batch, Vector2 pos, Vector2 drawPos, Color? overrideColor, Direction2 rotation, int[] colors, float drawScale, bool pivot, ParentInfo parent, float depthOffset, bool held, List<StaticSpriteBatch.Item> items)

Parameters

time GameTime

The game time

batch object

The sprite batch to draw with, which is either a Microsoft.Xna.Framework.Graphics.SpriteBatch or MLEM.Graphics.StaticSpriteBatch.

pos Vector2

The position, in world space, that the furniture is at

drawPos Vector2

The position, in draw space, to draw the furniture at

overrideColor Color?

An optional color to override the default colors of the furniture

rotation Direction2

The rotation of the furniture

colors int[]

The colors to draw the furniture with

drawScale float

The scale to draw the furniture with

pivot bool

Whether or not to move the furniture by its texture's pivot point

parent ParentInfo

The object that this furniture is latched on to, or null if there is none

depthOffset float

A value that is added onto the calculated depth of the object

held bool

Whether or not this item is currently being held by a Person

items List<StaticSpriteBatch.Item>

A list of sprite batch items that items should be added to if the batch is 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 int GetDecorativeRating(Room room)

Parameters

room Room

The room that the object is in, or null if it is not in a room at all

Returns

int

The decorative rating of this object

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

time GameTime

The game's time

passedInGame TimeSpan

The amount of time that has passed since the last call

speedMultiplier float

The game speed multiplier, which represents how fast things should happen, which is usually determined by Speed

Validate()

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()

Returns

bool

false if the object is not valid, true otherwise