Class Stairs
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 2 tiles.
[DataContract]
public class Stairs : JsonTypeSafeGenericDataHolder, IGenericDataHolder
- Inheritance
-
JsonTypeSafeGenericDataHolderStairs
- 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
StairsTypeThe type of these stairs.
colors
int[]The selected color indices in this stairs' <see cref="Type"/>'s <see cref="StairsType.ColorSchemes"/>.
map
MapThe map.
position
PointThe position of these stairs, which is the tile position that the bottom half of the stairs is on.
floor
intThe floor of these stairs, which is the floor that the bottom of these stairs is on.
rotation
Direction2These stairs' rotation.
hasWallpaper
boolWhether these stairs should have wallpaper applied, as well as the ability to change the applied wallpaper.
Fields
Colors
[DataMember]
public readonly int[] Colors
Field Value
- int[]
Type
The type of these stairs.
[DataMember]
public readonly StairsType Type
Field Value
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
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
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
GameTimeThe game time.
batch
SpriteBatchThe 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
PointThe position.
rotation
Direction2The 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
MapThe map these stairs are on.
Returns
- bool
Whether these stairs are still valid.