Table of Contents

Class Opening

Namespace
TinyLife.World
Assembly
Tiny Life.dll

An opening is some sort of extrusion in a WallLike, like a window or a door. Openings are created from their underlying OpeningType.

[DataContract]
public class Opening
Inheritance
Opening
Derived
Inherited Members
Extension Methods

Constructors

Opening(OpeningType, int[])

Creates a new opening from the given opening type and color

public Opening(OpeningType type, int[] colors)

Parameters

type OpeningType

The opening type

colors int[]

The indices of the colors to use

Fields

Color

The index of the OpeningType's Colors that this opening instance has

[DataMember]
[Obsolete("Use Colors instead")]
public readonly int Color

Field Value

int

Colors

The indices of the OpeningType's Colors that this opening instance has.

[DataMember]
public int[] Colors

Field Value

int[]

Type

The OpeningType that this opening has

[DataMember]
public readonly OpeningType Type

Field Value

OpeningType

Methods

CanPlaceOn(FurnitureType)

Whether the given FurnitureType can be attached to this opening. By default, this method returns true when the furniture has the CanCoverWindow category.

public virtual bool CanPlaceOn(FurnitureType type)

Parameters

type FurnitureType

Returns

bool

Whether the opening is a window

CanWalkThrough(Map, WallLike, MapObject)

Returns whether a Person is able to walk through a WallLike that has this opening. This returns true for Door and SwingingDoor and false for Opening.

public virtual bool CanWalkThrough(Map map, WallLike wall, MapObject obj)

Parameters

map Map
wall WallLike
obj MapObject

Returns

bool

Draw(GameTime, SpriteBatch, Map, WallLike, Vector2, bool, float, Color?)

Draws this opening in the world with the given settings

public virtual void Draw(GameTime time, SpriteBatch batch, Map map, WallLike wall, Vector2 drawPos, bool vertical, float scale, Color? overrideColor)

Parameters

time GameTime

The game's time

batch SpriteBatch

The sprite batch to use for drawing

map Map

The map that the opening is on

wall WallLike

The wall that the opening is in

drawPos Vector2

The position, in screen space, to draw the opening on

vertical bool

Whether the wall that the opening is on is vertical

scale float

The scale to draw the opening with

overrideColor Color?

A color that should be used instead of this opening's default color, or null to use the opening's default color

GetDescription()

Returns a set of strings that should be displayed if this opening is hovered over in build mode.

public virtual IEnumerable<string> GetDescription()

Returns

IEnumerable<string>

A set of description strings for this opening.

Validate(WallLike, Map)

Validates this opening, returning false if it is somehow invalid. This method is called when a Map is loaded.

public virtual bool Validate(WallLike wall, Map map)

Parameters

wall WallLike

The wall that this opening is on.

map Map

The map that this opening is on.

Returns

bool

Whether this opening is valid.