Table of Contents

Class Plant

Namespace
TinyLife.Objects
Assembly
TinyLife.dll
public class Plant : Furniture, IGenericDataHolder, IUpdatingObject
Inheritance
JsonTypeSafeGenericDataHolder
Plant
Implements
IGenericDataHolder
Inherited Members
JsonTypeSafeGenericDataHolder.GetDataKeys()
Extension Methods

Constructors

Plant(Guid, FurnitureType, int[], Map, Vector2, float)

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

Parameters

id Guid
type FurnitureType
colors int[]
map Map
pos Vector2
floor float

Fields

PlantType

[DataMember]
public PlantType PlantType

Field Value

PlantType

RemainingNourishedTime

[DataMember]
public TimeSpan RemainingNourishedTime

Field Value

TimeSpan

RemainingTimeInStage

[DataMember]
public TimeSpan RemainingTimeInStage

Field Value

TimeSpan

RemainingWateredTime

[DataMember]
public TimeSpan RemainingWateredTime

Field Value

TimeSpan

Stage

[DataMember]
public Plant.GrowthStage Stage

Field Value

Plant.GrowthStage

TimesHarvested

[DataMember]
public int TimesHarvested

Field Value

int

TotalUnwateredTime

[DataMember]
public TimeSpan TotalUnwateredTime

Field Value

TimeSpan

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

IUpdatingObject.UpdateMode

Methods

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

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

floor float

The floor to draw 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 that the furniture should be drawn with.

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

items List<StaticSpriteBatch.Item>

A list of sprite batch items that items should be added to if the batch is a MLEM.Graphics.StaticSpriteBatch.

GetDebugLines(GameImpl, List<string>)

Returns the debug lines that should be displayed in Debug when hovering over this object. By default, OnGetDebugLines is invoked, and the id and position of this object are appended to the list of lines.

public override void GetDebugLines(GameImpl game, List<string> lines)

Parameters

game GameImpl

The game.

lines List<string>

The list of lines to append debug lines to.

GetDescription(List<string>, bool)

This method allows adding a set of strings to the description list that get displayed when the object is hovered over in the build mode or household storage UIs. By default, this method adds various strings related to the ElectricityRating, Quality, Creator, and also invokes the OnGetDescription event.

public override void GetDescription(List<string> description, bool forHoverInfo)

Parameters

description List<string>

The description to add to.

forHoverInfo bool

Whether this method is being called by GetHoverInfo(Tooltip) (or by build mode).

GetHarvestQuality(PersonLike)

public Quality GetHarvestQuality(PersonLike person)

Parameters

person PersonLike

Returns

Quality

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

appliedMigrations AppliedMigrations

Returns

bool

false if the object is not valid, true otherwise