A furniture is an instance of a FurnitureType which is placed in the world, or in a Person's hand. To register a custom furniture, use Register(TypeSettings).
public class Food : FoodTypedItem, IGenericDataHolder, IUpdatingObject
- Inherited Members
MapObject.DrawColumns(Map, Vector2, object, Vector2, TextureRegion, Color, float, Point, List<StaticSpriteBatch.Item>, bool, ParentInfo, float, SpriteEffects, bool, bool, bool)JsonTypeSafeGenericDataHolder.GetDataKeys()
- Extension Methods
Food(Guid, FurnitureType, int, Map, Vector2)
Creates a new furniture instance. By default, this is done using Construct<T>(int, Map, Vector2, Guid?).
public Food(Guid id, FurnitureType type, int colors, Map map, Vector2 pos)
The id to apply to the created furniture instance
The type to create an instance of
The colors to apply to the furniture
The map to create the furniture on
The position that the furniture should have
The amount of food that this food item has left. This value starts out at 100, so it represents a percentage.
[DataMember] public float FoodLeft
A field that stores whether this food item currently has candles on it. This is generally only set to true by the AddCandle action for cakes which have had no slices removed yet.
[DataMember(EmitDefaultValue = false)] public bool HasCandle
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)
The game time
The sprite batch to draw with, which is either a Microsoft.Xna.Framework.Graphics.SpriteBatch or MLEM.Graphics.StaticSpriteBatch.
The position, in world space, that the furniture is at
The position, in draw space, to draw the furniture at
An optional color to override the default colors of the furniture
The rotation of the furniture
The colors to draw the furniture with
The scale to draw the furniture with
Whether or not to move the furniture by its texture's pivot point
The object that this furniture is latched on to, or null if there is none
A value that is added onto the calculated depth of the object
Whether or not this item is currently being held by a Person
A list of sprite batch items that items should be added to if the
batchis a MLEM.Graphics.StaticSpriteBatch.
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)
The description to add to.
Whether this method is being called by GetHoverInfo(Tooltip) (or by build mode).
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 override void Update(GameTime time, TimeSpan passedInGame, float speedMultiplier)