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.
[DataContract]
public class Wall : JsonTypeSafeGenericDataHolder, IGenericDataHolder
- Inheritance
-
JsonTypeSafeGenericDataHolderWall
- Implements
-
IGenericDataHolder
- Inherited Members
-
JsonTypeSafeGenericDataHolder.GetDataKeys()
- Extension Methods
Constructors
Wall(params Point[])
Creates a new wall at the given position, with the implicitly given verticality
public Wall(params Point[] positions)
Parameters
positions
Point[]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
[DataMember(EmitDefaultValue = false)]
public bool IsStatic
Field Value
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.
[DataMember]
public readonly Point[] Positions
Field Value
- Point[]
Price
The price of building a single wall element
public const int Price = 125
Field Value
Wallpapers
The two wallpapers attached to this Wall, on either one of its sides
[DataMember]
public readonly Wallpaper[] Wallpapers
Field Value
Properties
Opening
The Opening attached to this wall, or null if there is none. Use SetOpening(Map, Opening) to set this value.
[DataMember]
public Opening Opening { get; }
Property Value
Vertical
Stores whether this wall is vertical. A vertical wall is one where the Positions have the same y, but different x coordinates.
public bool Vertical { get; }
Property Value
Methods
Draw(Map, GameTime, SpriteBatch, Vector2, Color?, bool?)
Draws this wall in the world, along with its Wallpapers and Opening
public void Draw(Map map, GameTime time, SpriteBatch batch, Vector2 drawPos, Color? overrideColor, bool? isDown = null)
Parameters
map
MapThe map to draw this wall on
time
GameTimeThe game time
batch
SpriteBatchThe sprite batch to draw with
drawPos
Vector2The position to draw the wall at, in draw space
overrideColor
Color?A color that this object should be rendered with, instead of its default color
isDown
bool?Whether the wall should be drawn as down. If this is null, IsDown() is used.
GetCenterBottomPos()
Returns the bottom-center position of this wall in world space, based on the GetPositionForCamera() position.
public Vector2 GetCenterBottomPos()
Returns
- Vector2
The bottom-center position of this wall in world space.
GetDepth(Map, float)
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.
public float GetDepth(Map map, float offset = 0)
Parameters
map
MapThe map that this wall is on
offset
floatAn offset that will be added to the depth calculation
Returns
GetDisplayMode()
Returns the WallMode that this wall should be rendered with. If the Opening is nonnull, its WallMode is returned.
public WallMode GetDisplayMode()
Returns
- 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.
public ActionInfo GetFreeActionSpotInfo(Person person)
Parameters
person
PersonThe person to return the action spot info for
Returns
- 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.
public int GetIndexForCamera()
Returns
- int
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.
public Point GetPositionForCamera()
Returns
- Point
The wall position that is facing the camera
GetPrice()
public float GetPrice()
Returns
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, Color?, bool?) 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.
public bool IsDown()
Returns
- bool
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.
public bool IsVerticalForCamera()
Returns
SetOpening(Map, Opening)
Changes the Opening in this wall to the specified one
public void SetOpening(Map map, Opening opening)
Parameters
map
MapThe map that this wall is on
opening
OpeningThe opening to set, or null to remove the current one
Validate(Map)
This method is called when this object is loaded from disk.
public bool Validate(Map map)
Parameters
map
Map
Returns
- bool
false if the object is not valid, true otherwise