Class Wall
A wall is an element of a Map that stops traversal and that has a Wallpaper and optionally an Opening attached to it.
Inheritance
Inherited Members
Namespace: TinyLife.World
Assembly: Tiny Life.dll
Syntax
[DataContract]
public class Wall : JsonTypeSafeGenericDataHolder, IGenericDataHolder, IPricedObject
Constructors
Wall(Point[])
Creates a new wall at the given position, with the implicitly given verticality
Declaration
public Wall(params Point[] positions)
Parameters
Type | Name | Description |
---|---|---|
Microsoft.Xna.Framework.Point[] | positions | The positions that the wall should be placed between |
Fields
IsStatic
A field that is true for objects that are part of the exported base map that the current map is created from
Declaration
[DataMember(EmitDefaultValue = false)]
public bool IsStatic
Field Value
Type | Description |
---|---|
System.Boolean |
Positions
The two positions that this wall is placed in. The two positions refer to the tile coordinate of the tile on the front face of the wall, and the tile coordinate of the tile on the back face of the wall.
Declaration
[DataMember]
public readonly Point[] Positions
Field Value
Type | Description |
---|---|
Microsoft.Xna.Framework.Point[] |
Price
The price of building a single wall element
Declaration
public const int Price = 125
Field Value
Type | Description |
---|---|
System.Int32 |
Wallpapers
The two wallpapers attached to this Wall, on either one of its sides
Declaration
[DataMember]
public readonly Wallpaper[] Wallpapers
Field Value
Type | Description |
---|---|
Wallpaper[] |
Properties
Opening
The Opening attached to this wall, or null if there is none. Use SetOpening(Map, Opening) to set this value.
Declaration
[DataMember]
public Opening Opening { get; }
Property Value
Type | Description |
---|---|
Opening |
Vertical
Stores whether this wall is vertical. A vertical wall is one where the Positions have the same y, but different x coordinates.
Declaration
public bool Vertical { get; }
Property Value
Type | Description |
---|---|
System.Boolean |
Methods
Draw(Map, GameTime, SpriteBatch, Vector2, Nullable<Color>)
Draws this wall in the world, along with its Wallpapers and Opening
Declaration
public void Draw(Map map, GameTime time, SpriteBatch batch, Vector2 drawPos, Color? overrideColor)
Parameters
Type | Name | Description |
---|---|---|
Map | map | The map to draw this wall on |
Microsoft.Xna.Framework.GameTime | time | The game time |
Microsoft.Xna.Framework.Graphics.SpriteBatch | batch | The sprite batch to draw with |
Microsoft.Xna.Framework.Vector2 | drawPos | The position to draw the wall at, in draw space |
System.Nullable<Microsoft.Xna.Framework.Color> | overrideColor | A color that this object should be rendered with, instead of its default color |
GetCenterBottomPos()
Returns the bottom-center position of this wall in world space, based on the GetPositionForCamera() position.
Declaration
public Vector2 GetCenterBottomPos()
Returns
Type | Description |
---|---|
Microsoft.Xna.Framework.Vector2 | The bottom-center position of this wall in world space. |
GetDepth(Map, Single)
Returns the depth that should be used for a wall placed at this wall's positions. This method is used for rendering Wallpaper and Opening.
Declaration
public float GetDepth(Map map, float offset = 0F)
Parameters
Type | Name | Description |
---|---|---|
Map | map | The map that this wall is on |
System.Single | offset | An offset that will be added to the depth calculation |
Returns
Type | Description |
---|---|
System.Single |
GetDisplayMode()
Returns the WallMode that this wall should be rendered with. If the Opening is nonnull, its WallMode is returned.
Declaration
public WallMode GetDisplayMode()
Returns
Type | Description |
---|---|
WallMode | The wall mode |
GetFreeActionSpotInfo(Person)
Returns an ActionInfo that contains this wall and the first free position on either of its sides If an ActionInfo is already present in a situation, ToFreeActionSpot(ObjectCategory) should be used instead of this method.
Declaration
public ActionInfo GetFreeActionSpotInfo(Person person)
Parameters
Type | Name | Description |
---|---|---|
Person | person | The person to return the action spot info for |
Returns
Type | Description |
---|---|
ActionInfo | A free action spot info, or null if there is no free spot |
GetIndexForCamera()
Returns the side of the wall that should be rendered. For Vertical walls, the position with the highest X value is returned. For non-Vertical walls, the position with the highest Y value is returned.
Declaration
public int GetIndexForCamera()
Returns
Type | Description |
---|---|
System.Int32 | The side of the wall that should be rendered |
GetPositionForCamera()
Returns the position from the Positions array that GetIndexForCamera() suggests. This is the side of the wall that currently faces the game camera.
Declaration
public Point GetPositionForCamera()
Returns
Type | Description |
---|---|
Microsoft.Xna.Framework.Point | The wall position that is facing the camera |
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 |
IsDown()
Returns whether this wall should be rendered with a lower height than its actual height. If this value returns true, Draw(Map, GameTime, SpriteBatch, Vector2, Nullable<Color>) only draws the first 5 or so pixels of the wall to allow for a simple view of what is behind the wall. This value is based on the lot visibility, the WallMode and more.
Declaration
public bool IsDown()
Returns
Type | Description |
---|---|
System.Boolean | Whether the wall should be rendered down |
IsVerticalForCamera()
Returns whether the wall is considered Vertical based on the game's current CameraRotation. If the camera rotation is offset by 90 or -90 degrees from the default, wall verticalities are visually inversed.
Declaration
public bool IsVerticalForCamera()
Returns
Type | Description |
---|---|
System.Boolean |
SetOpening(Map, Opening)
Changes the Opening in this wall to the specified one
Declaration
public void SetOpening(Map map, Opening opening)
Parameters
Type | Name | Description |
---|---|---|
Map | map | The map that this wall is on |
Opening | opening | The opening to set, or null to remove the current one |
Validate(Map)
This method is called when this object is loaded from disk.
Declaration
public bool Validate(Map map)
Parameters
Type | Name | Description |
---|---|---|
Map | map |
Returns
Type | Description |
---|---|
System.Boolean | false if the object is not valid, true otherwise |