Class WallLike
A wall-like is the base class for Wall and FenceWall, both of which can be placed on a map to prevent traversal and add decorative elements.
[DataContract]
public abstract class WallLike : JsonTypeSafeGenericDataHolder, IGenericDataHolder
- Inheritance
-
JsonTypeSafeGenericDataHolderWallLike
- Implements
-
IGenericDataHolder
- Derived
- Inherited Members
-
JsonTypeSafeGenericDataHolder.GetDataKeys()
- Extension Methods
Constructors
WallLike(int, params Point[])
Creates a new wall at the given position, with the implicitly given verticality
public WallLike(int floor, params Point[] positions)
Parameters
floor
intThe floor that this wall is on.
positions
Point[]The positions that the wall should be placed between
Fields
Floor
The floor that this wall is on.
[DataMember]
public readonly int Floor
Field Value
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[]
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
Methods
Draw(Map, GameTime, SpriteBatch, Vector2, Color?, bool, bool)
Draws this wall in the world, along with its Opening and potentially Wallpapers or Type.
public virtual void Draw(Map map, GameTime time, SpriteBatch batch, Vector2 drawPos, Color? overrideColor = null, bool drawOpening = true, bool isInWorld = true)
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
drawOpening
boolWhether this wall-like object's Opening should be drawn.
isInWorld
boolWhether this wall-like object is currently in the world, or just a preview.
GetCenterBottomPos(Point, Point)
Returns the bottom-center position of this wall in world space, based on the GetPositionForCamera(Point, Point) position.
public static Vector2 GetCenterBottomPos(Point pos1, Point pos2)
Parameters
pos1
Pointpos2
Point
Returns
- Vector2
The bottom-center position of this wall in world space.
GetDepth(Map, Point, Point, int, 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 static float GetDepth(Map map, Point pos1, Point pos2, int floor, float offset = 0)
Parameters
map
MapThe map that this wall is on
pos1
PointThe first position of the wall.
pos2
PointThe second position of the wall.
floor
intThe wall's current floor.
offset
floatAn offset that will be added to the depth calculation
Returns
GetFreeActionSpotInfos(Map, PersonLike)
Returns a set of ActionInfo instances that represent action spots that the person
can currently use or interact with.
public IEnumerable<ActionInfo> GetFreeActionSpotInfos(Map map, PersonLike person)
Parameters
map
MapThe map that this wall is on.
person
PersonLikeThe person who wants to interact with this wall.
Returns
- IEnumerable<ActionInfo>
The free action spots.
GetIndexForCamera(Point, Point)
Returns the side of the wall that should be rendered. For IsVertical(Point, Point) walls, the position with the highest X value is returned. For non-IsVertical(Point, Point) walls, the position with the highest Y value is returned.
public static int GetIndexForCamera(Point pos1, Point pos2)
Parameters
pos1
Pointpos2
Point
Returns
- int
The side of the wall that should be rendered
GetPositionForCamera(Point, Point)
Returns the position from the Positions array that GetIndexForCamera(Point, Point) suggests. This is the side of the wall that currently faces the game camera.
public static Point GetPositionForCamera(Point pos1, Point pos2)
Parameters
pos1
Pointpos2
Point
Returns
- Point
The wall position that is facing the camera
GetPrice()
Returns the price for this wall, including its Opening as well as its Wallpapers or Type.
public virtual float GetPrice()
Returns
- float
The price.
IsVertical(Point, Point)
Returns whether a wall with the given positions is considered vertical.
public static bool IsVertical(Point pos1, Point pos2)
Parameters
pos1
PointThe first position of the wall.
pos2
PointThe second position of the wall.
Returns
- bool
Whether a wall with the given positions is vertical.
IsVerticalForCamera(bool)
Returns whether the wall is considered IsVertical(Point, Point) 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 static bool IsVerticalForCamera(bool vertical)
Parameters
vertical
bool
Returns
NotifyNeighbors(Map)
Notifies all neighboring walls on the given map
of a change in this wall, calling their OnNeighborChanged(Map, WallLike) methods.
public void NotifyNeighbors(Map map)
Parameters
map
MapThe map.
OnAdded(Map)
Called when this wall is added to the given map
.
By default, this method marks surrounding locations dirty for pathfinding and calls NotifyNeighbors(Map).
public virtual void OnAdded(Map map)
Parameters
map
MapThe map.
OnNeighborChanged(Map, WallLike)
A method that is called when a neighboring wall of this wall changes. This method is called when a neighboring wall calls NotifyNeighbors(Map).
protected virtual void OnNeighborChanged(Map map, WallLike neighbor)
Parameters
OnRemoved(Map)
Called when this wall is removed from the given map
.
By default, this method marks surrounding locations dirty for pathfinding and calls NotifyNeighbors(Map).
public virtual void OnRemoved(Map map)
Parameters
map
MapThe map.
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, AppliedMigrations)
This method is called when this object is loaded from disk.
public virtual bool Validate(Map map, AppliedMigrations appliedMigrations)
Parameters
map
MapappliedMigrations
AppliedMigrations
Returns
- bool
false if the object is not valid, true otherwise