SwingingDoor - Ellpeck/TinyLifeExampleMod Wiki

Tiny Life

TinyLife.World

SwingingDoor Class

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

public class SwingingDoor : TinyLife.World.Door

Inheritance System.Object 🡒 Opening 🡒 Door 🡒 SwingingDoor

Constructors

SwingingDoor.SwingingDoor(OpeningType, int) Constructor

Creates a new opening from the given opening type and color

public SwingingDoor(TinyLife.World.OpeningType type, int color);

Parameters

type OpeningType
The opening type

color System.Int32
The index of the color

Fields

SwingingDoor.Lock Field

The lock type that this door is locked with, or 0 if the door is not locked

public LockType Lock;

Field Value

LockType

Methods

SwingingDoor.CanWalkThrough(Wall, Person) Method

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

public override bool CanWalkThrough(TinyLife.World.Wall wall, TinyLife.Objects.Person person);

Parameters

wall Wall

person Person

Returns

System.Boolean

SwingingDoor.Draw(GameTime, SpriteBatch, Map, Wall, Vector2, bool, float, float, Nullable<Color>) Method

Draws this opening in the world with the given settings

public override void Draw(Microsoft.Xna.Framework.GameTime time, Microsoft.Xna.Framework.Graphics.SpriteBatch batch, TinyLife.World.Map map, TinyLife.World.Wall wall, Microsoft.Xna.Framework.Vector2 drawPos, bool vertical, float scale, float depth, System.Nullable<Microsoft.Xna.Framework.Color> overrideColor);

Parameters

time Microsoft.Xna.Framework.GameTime
The game's time

batch Microsoft.Xna.Framework.Graphics.SpriteBatch
The sprite batch to use for drawing

map Map
The map that the opening is on

wall Wall
The wall that the opening is in

drawPos Microsoft.Xna.Framework.Vector2
The position, in screen space, to draw the opening on

vertical System.Boolean
Whether the wall that the opening is on is vertical

scale System.Single
The scale to draw the opening with

depth System.Single
The depth to use for drawing the opening

overrideColor System.Nullable<Microsoft.Xna.Framework.Color>
A color that should be used instead of this opening's default color, or null to use the opening's default color

SwingingDoor.IsWindow() Method

Whether the opening is a window that objects with the CanCoverWindow category can be attached to

public override bool IsWindow();

Returns

System.Boolean
Whether the opening is a window