Class Opening
An opening is some sort of extrusion in a Wall, like a window or a door. Openings are created from their underlying OpeningType.
Implements
Inherited Members
Namespace: TinyLife.World
Assembly: Tiny Life.dll
Syntax
[DataContract]
public class Opening : IPricedObject
Constructors
Opening(OpeningType, Int32[])
Creates a new opening from the given opening type and color
Declaration
public Opening(OpeningType type, int[] colors)
Parameters
Type | Name | Description |
---|---|---|
OpeningType | type | The opening type |
System.Int32[] | colors | The indices of the colors to use |
Fields
Color
The index of the OpeningType's Colors that this opening instance has
Declaration
[DataMember]
[Obsolete("Use Colors instead")]
public readonly int Color
Field Value
Type | Description |
---|---|
System.Int32 |
Colors
The indices of the OpeningType's Colors that this opening instance has.
Declaration
[DataMember]
public int[] Colors
Field Value
Type | Description |
---|---|
System.Int32[] |
Type
The OpeningType that this opening has
Declaration
[DataMember]
public readonly OpeningType Type
Field Value
Type | Description |
---|---|
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.
Declaration
public virtual bool CanPlaceOn(FurnitureType type)
Parameters
Type | Name | Description |
---|---|---|
FurnitureType | type |
Returns
Type | Description |
---|---|
System.Boolean | Whether the opening is a window |
CanWalkThrough(Wall, Person)
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.
Declaration
public virtual bool CanWalkThrough(Wall wall, Person person)
Parameters
Type | Name | Description |
---|---|---|
Wall | wall | |
Person | person |
Returns
Type | Description |
---|---|
System.Boolean |
Draw(GameTime, SpriteBatch, Map, Wall, Vector2, Boolean, Single, Single, Nullable<Color>)
Draws this opening in the world with the given settings
Declaration
public virtual void Draw(GameTime time, SpriteBatch batch, Map map, Wall wall, Vector2 drawPos, bool vertical, float scale, float depth, Color? overrideColor)
Parameters
Type | Name | Description |
---|---|---|
Microsoft.Xna.Framework.GameTime | time | The game's time |
Microsoft.Xna.Framework.Graphics.SpriteBatch | batch | 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 |
Microsoft.Xna.Framework.Vector2 | drawPos | The position, in screen space, to draw the opening on |
System.Boolean | vertical | Whether the wall that the opening is on is vertical |
System.Single | scale | The scale to draw the opening with |
System.Single | depth | The depth to use for drawing the opening |
System.Nullable<Microsoft.Xna.Framework.Color> | overrideColor | 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.
Declaration
public virtual IEnumerable<string> GetDescription()
Returns
Type | Description |
---|---|
System.Collections.Generic.IEnumerable<System.String> | A set of description strings for this opening. |
GetPrice()
Returns the price that this object can be bought or sold for. Note that, like in the case of the Painting, the returned price isn't necessarily the full price that the object can be sold for. Instead, the price returned here should be the price that this object has when bought or sold from the FurnitureTool or similar.
Declaration
public float GetPrice()
Returns
Type | Description |
---|---|
System.Single | The object's price |
Validate(Wall, Map)
Validates this opening, returning false if it is somehow invalid. This method is called when a Map is loaded.
Declaration
public virtual bool Validate(Wall wall, Map map)
Parameters
Type | Name | Description |
---|---|---|
Wall | wall | The wall that this opening is on. |
Map | map | The map that this opening is on. |
Returns
Type | Description |
---|---|
System.Boolean | Whether this opening is valid. |