OpeningType - Ellpeck/TinyLifeExampleMod Wiki

Original URL:

Tiny Life


OpeningType Class

An opening is some sort of extrusion in a Wall, like a window or a door.
An opening type stores data that can be used to construct a Opening instance.

public class OpeningType

Inheritance System.Object 🡒 OpeningType


OpeningType.OpeningType(string, TextureRegion, WallMode, int, Func<OpeningType,int,Wall,Opening>, ColorScheme, TextureRegion) Constructor

Creates a new opening type with the given settings

public OpeningType(string name, MLEM.Textures.TextureRegion textureRegion, TinyLife.World.WallMode wallMode, int price, System.Func<TinyLife.World.OpeningType,int,TinyLife.World.Wall,TinyLife.World.Opening> construct, TinyLife.Utilities.ColorScheme colorScheme, MLEM.Textures.TextureRegion icon=null);


name System.String
The name

textureRegion MLEM.Textures.TextureRegion
The texture to use for rendering

wallMode WallMode
The wall mode

price System.Int32
The price

construct System.Func<OpeningType,System.Int32,Wall,Opening>
The function that is used for constructing an Opening from this opening type

colorScheme ColorScheme
The color scheme for this opening

icon MLEM.Textures.TextureRegion
The build mode category icon of this object


OpeningType.ColorScheme Field

The color scheme that opening instances can have when created from this type

public readonly ColorScheme ColorScheme;

Field Value


OpeningType.Icon Field

The build mode icon for this object, which represents the category / theme / mod that it comes from.
If this value is nonnull, the icon will be displayed in the corner of the build mode button for this object.

public readonly TextureRegion Icon;

Field Value


OpeningType.Name Field

The name of this opening type

public readonly string Name;

Field Value


OpeningType.Price Field

The price of this opening

public readonly int Price;

Field Value


OpeningType.Types Field

A registry for all OpeningType instances from the game and mods.
Use Register(OpeningType) to register custom opening types.

public static readonly IDictionary<string,OpeningType> Types;

Field Value


OpeningType.WallMode Field

The WallMode that Wall instances with this opening in it should use for rendering

public readonly WallMode WallMode;

Field Value



OpeningType.Construct(int, Wall) Method

Constructs a new Opening instance from this opening type

public TinyLife.World.Opening Construct(int color, TinyLife.World.Wall wall);


color System.Int32
The color index to use

wall Wall
The wall that this opening will be slotted into


A new opening instance based on this type

OpeningType.Draw(GameTime, SpriteBatch, Vector2, bool, float, float, int, Nullable<Color>, Point) Method

Draws this opening in a wall

public void Draw(Microsoft.Xna.Framework.GameTime time, Microsoft.Xna.Framework.Graphics.SpriteBatch batch, Microsoft.Xna.Framework.Vector2 drawPos, bool vertical, float scale, float depth, int color, System.Nullable<Microsoft.Xna.Framework.Color> overrideColor, Microsoft.Xna.Framework.Point textureOffset=default(Microsoft.Xna.Framework.Point));


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

batch Microsoft.Xna.Framework.Graphics.SpriteBatch
The sprite batch to render with

drawPos Microsoft.Xna.Framework.Vector2
The position, in screen space, to draw at

vertical System.Boolean
Whether the underlying wall is vertical

scale System.Single
The scale to render with

depth System.Single
The depth to use for rendering

color System.Int32
The color index that should be used for rendering

overrideColor System.Nullable<Microsoft.Xna.Framework.Color>
A color that this object should be rendered with, instead of its default color

textureOffset Microsoft.Xna.Framework.Point
An offset that should be applied to the texture region. This value is multiplied with the texture region's size.

OpeningType.DrawUi(Element, SpriteBatch, GameTime, int, float) Method

Draws this opening in ui space rather than world space

public void DrawUi(MLEM.Ui.Elements.Element e, Microsoft.Xna.Framework.Graphics.SpriteBatch batch, Microsoft.Xna.Framework.GameTime time, int color, float drawScale=0.3f);


e MLEM.Ui.Elements.Element
The ui element to draw this opening onto

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

time Microsoft.Xna.Framework.GameTime
The game time

color System.Int32
The color index to draw with

drawScale System.Single
The scale to draw with. 0.3 by default.

OpeningType.Register(OpeningType) Method

Registers the given OpeningType to the Types registry

public static void Register(TinyLife.World.OpeningType type);


type OpeningType
The type to register