Table of Contents

Class Stairs

Namespace
TinyLife.World
Assembly
Tiny Life.dll

Stairs are objects on a Map that allow Tinies to switch between floors. Stair types can be registered using StairsType. For pathfinding purposes, stairs have a fixed length of LengthTiles.

[DataContract]
public class Stairs : JsonTypeSafeGenericDataHolder, IGenericDataHolder
Inheritance
JsonTypeSafeGenericDataHolder
Stairs
Implements
IGenericDataHolder
Inherited Members
JsonTypeSafeGenericDataHolder.GetDataKeys()
Extension Methods

Constructors

Stairs(StairsType, int[], Map, Point, int, Direction2, bool)

Creates a new stairs instance with the given settings.

public Stairs(StairsType type, int[] colors, Map map, Point position, int floor, Direction2 rotation, bool hasWallpaper)

Parameters

type StairsType

The type of these stairs.

colors int[]

The selected color indices in this stairs' <see cref="Type"/>'s <see cref="StairsType.ColorSchemes"/>.

map Map

The map.

position Point

The position of these stairs, which is the tile position that the bottom half of the stairs is on.

floor int

The floor of these stairs, which is the floor that the bottom of these stairs is on.

rotation Direction2

These stairs' rotation.

hasWallpaper bool

Whether these stairs should have wallpaper applied, as well as the ability to change the applied wallpaper.

Fields

Colors

The selected color indices in this stairs' Type's Colors.

[DataMember]
public readonly int[] Colors

Field Value

int[]

LengthTiles

The length, in tiles, that stairs have. This is used for calculating the area of stairs in GetArea(Point, Direction2).

public const int LengthTiles = 2

Field Value

int

Type

The type of these stairs.

[DataMember]
public readonly StairsType Type

Field Value

StairsType

Wallpaper

The Wallpaper that is attached to these stairs. If this stair's Type doesn't support applying wallpaper (AllowsWallpaper), or these stairs have no wallpaper applied, this field will be null.

[DataMember]
public Wallpaper Wallpaper

Field Value

Wallpaper

Properties

Area

The area that these stairs take up, based on GetArea(Point, Direction2).

public Rectangle Area { get; }

Property Value

Rectangle

BottomEntryPosition

The bottom entry and exit position for these stairs, which is the tile position that a Tiny starts walking up the stairs from.

public Point BottomEntryPosition { get; }

Property Value

Point

Floor

The floor of these stairs, which is the floor that the bottom of these stairs is on.

[DataMember]
public int Floor { get; }

Property Value

int

Position

The position of these stairs, which is the tile position that the bottom half of the stairs is on.

[DataMember]
public Point Position { get; }

Property Value

Point

Rotation

These stairs' rotation.

[DataMember]
public Direction2 Rotation { get; }

Property Value

Direction2

TopEntryPosition

The top entry and exit position for these stairs, which is the tile position that a Tiny starts walking down the stairs from.

public Point TopEntryPosition { get; }

Property Value

Point

Methods

Draw(GameTime, SpriteBatch, Color?)

Draws these stairs.

public void Draw(GameTime time, SpriteBatch batch, Color? overrideColor = null)

Parameters

time GameTime

The game time.

batch SpriteBatch

The sprite batch to use for drawing.

overrideColor Color?

A color that should optionally be used for drawing instead of this stairs' Colors.

GetArea(Point, Direction2)

Returns the area that a set of Stairs with the given position and rotation takes up.

public static Rectangle GetArea(Point position, Direction2 rotation)

Parameters

position Point

The position.

rotation Direction2

The rotation.

Returns

Rectangle

The area taken up.

Validate(Map)

Validates these stairs, returning whether they are still valid after being loaded from disk.

public bool Validate(Map map)

Parameters

map Map

The map these stairs are on.

Returns

bool

Whether these stairs are still valid.