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
floorintThe floor that this wall is on.
positionsPoint[]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
mapMapThe map to draw this wall on
timeGameTimeThe game time
batchSpriteBatchThe sprite batch to draw with
drawPosVector2The position to draw the wall at, in draw space
overrideColorColor?A color that this object should be rendered with, instead of its default color
drawOpeningboolWhether this wall-like object's Opening should be drawn.
isInWorldboolWhether 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
pos1Pointpos2Point
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
mapMapThe map that this wall is on
pos1PointThe first position of the wall.
pos2PointThe second position of the wall.
floorintThe wall's current floor.
offsetfloatAn 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
mapMapThe map that this wall is on.
personPersonLikeThe 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
pos1Pointpos2Point
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
pos1Pointpos2Point
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.
HasCollision(Map)
public virtual bool HasCollision(Map map)
Parameters
mapMap
Returns
IsVertical(Point, Point)
Returns whether a wall with the given positions is considered vertical.
public static bool IsVertical(Point pos1, Point pos2)
Parameters
pos1PointThe first position of the wall.
pos2PointThe 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
verticalbool
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
mapMapThe 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
mapMapThe map.
OnCameraRotationChanged(Map, Direction2, Direction2)
This method is invoked when the game's camera rotation changes. Additionally, the old and new rotations are passed.
public virtual void OnCameraRotationChanged(Map map, Direction2 oldRotation, Direction2 newRotation)
Parameters
mapMapoldRotationDirection2The old camera rotation
newRotationDirection2The new camera rotation
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
mapMapThe map.
SetOpening(Map, Opening)
Changes the Opening in this wall to the specified one
public void SetOpening(Map map, Opening opening)
Parameters
mapMapThe map that this wall is on
openingOpeningThe 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
mapMapappliedMigrationsAppliedMigrations
Returns
- bool
false if the object is not valid, true otherwise