Table of Contents

Struct ParentInfo

Namespace
TinyLife.Objects
Assembly
Tiny Life.dll

A parent info is a set of information used by DrawColumns(Map, Vector2, float, object, Vector2, TextureRegion, Color, Vector2, Point, List<Item>, bool, ParentInfo, float, SpriteEffects, bool) that allows for objects to be made to look like they're attached to another object. Currently, ParentInfo supports Furniture, Wall and Roof parents.

public readonly struct ParentInfo
Inherited Members
Extension Methods

Constructors

ParentInfo(Furniture, AbstractSpot)

Creates a new parent info from the given parent.

public ParentInfo(Furniture furniture, AbstractSpot spot)

Parameters

furniture Furniture

The furniture to be attached to.

spot AbstractSpot

The spot to be attached to.

ParentInfo(AttachmentType)

Creates a new parent info from the given ParentInfo.AttachmentType. This constructor can only be used for attachment types that don't require additional objects. Use the other constructors for those instead.

public ParentInfo(ParentInfo.AttachmentType type)

Parameters

type ParentInfo.AttachmentType

The attachment type.

Exceptions

ArgumentException

If the given type requires additional arguments and a different constructor should be used.

ParentInfo(PersonLike)

Creates a new parent info from the given parent.

public ParentInfo(PersonLike holdingPerson)

Parameters

holdingPerson PersonLike

The person to be attached to.

ParentInfo(Roof)

Creates a new parent info from the given parent.

public ParentInfo(Roof roof)

Parameters

roof Roof

The roof to be attached to.

ParentInfo(Stairs)

Creates a new parent info from the given parent.

public ParentInfo(Stairs stairs)

Parameters

stairs Stairs

The stairs to be attached to.

ParentInfo(Wall)

Creates a new parent info from the given parent.

public ParentInfo(Wall wall)

Parameters

wall Wall

The wall to be attached to.

Fields

Type

The ParentInfo.AttachmentType that this parent info exhibits, based on the constructor that was used to construct it.

public readonly ParentInfo.AttachmentType Type

Field Value

ParentInfo.AttachmentType

Properties

LayerDepth

Returns the layer depth that objects with this parent info should be displayed with. This results in objects in shelves and on tables being "squished" in terms of depth calculations so that higher shelf levels don't intersect.

public float LayerDepth { get; }

Property Value

float

ShouldDraw

Whether the object with this parent info should be drawn. This value is determined by the PersonLike that is holding the object.

public bool ShouldDraw { get; }

Property Value

bool

Methods

GetDepthOffset(Vector2)

Returns the depth offset for an object that has this ParentInfo.

public float GetDepthOffset(Vector2 position)

Parameters

position Vector2

The object's position, which should be the same as the depth position passed to DrawColumns(Map, Vector2, float, object, Vector2, TextureRegion, Color, Vector2, Point, List<Item>, bool, ParentInfo, float, SpriteEffects, bool).

Returns

float

The depth offset.

GetDepthPos(Map, Vector2, float, Point, Point, Point, Point, Point, bool, Point, Point)

Returns the depth position, and depth floor, that an object with this parent info should be drawn at.

public (Vector2 Pos, float Floor) GetDepthPos(Map map, Vector2 position, float floor, Point size, Point drawCoords, Point widthHeightDrawn, Point firstRowColSize, Point textureSize, bool pivot, Point rowsColsDrawn, Point rowColSize)

Parameters

map Map

The map.

position Vector2

The position of the object with this parent info.

floor float

The floor that the object with this parent info is on.

size Point

The size of the object with this parent info.

drawCoords Point

The draw position of the object with this parent info.

widthHeightDrawn Point

The width and height of the object with this parent info that has already been drawn, out of textureSize.

firstRowColSize Point

The size that the first row and column of the object with this parent info has or had. This is included in widthHeightDrawn if one column has already been drawn.

textureSize Point

The texture size of the object with this parent info.

pivot bool

Whether to draw the object with this parent info with a pivot in mind.

rowsColsDrawn Point

The amount of rows and columns that have already been drawn of the object with this parent info.

rowColSize Point

The size of the row and column that are currently being drawn, based on GetRowColumnSize(Point).

Returns

(Vector2 Pos, float Floor)

The depth position and depth floor to draw an object with this parent info at.

GetDrawOffset(Vector2)

Returns the draw offset for an object that has this ParentInfo.

public Vector2 GetDrawOffset(Vector2 position)

Parameters

position Vector2

The object's position, which should be the same as the depth position passed to DrawColumns(Map, Vector2, float, object, Vector2, TextureRegion, Color, Vector2, Point, List<Item>, bool, ParentInfo, float, SpriteEffects, bool).

Returns

Vector2

The draw offset.

GetRowColumnSize(Point)

Returns the row and column sizes that an object with this parent info should be drawn at. For a coordinate that returns -1, the object should be drawn in its entirety, rather than with a specified row or column width.

public Point GetRowColumnSize(Point size)

Parameters

size Point

The size of the object being drawn, in tiles.

Returns

Point

The row and column sizes that the object should be drawn with.