Table of Contents

Class WallLike

Namespace
TinyLife.Objects
Assembly
Tiny Life.dll

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
JsonTypeSafeGenericDataHolder
WallLike
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 int

The 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

int

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

bool

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

Opening

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 Map

The map to draw this wall on

time GameTime

The game time

batch SpriteBatch

The sprite batch to draw with

drawPos Vector2

The 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 bool

Whether this wall-like object's Opening should be drawn.

isInWorld bool

Whether 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 Point
pos2 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 Map

The map that this wall is on

pos1 Point

The first position of the wall.

pos2 Point

The second position of the wall.

floor int

The wall's current floor.

offset float

An offset that will be added to the depth calculation

Returns

float

GetFreeActionSpotInfo(Map, PersonLike)

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(Map map, PersonLike person)

Parameters

map Map

The map the wall is on.

person PersonLike

The person to return the action spot info for

Returns

ActionInfo

A free action spot info, or null if there is no free spot

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 Point
pos2 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 Point
pos2 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 Point

The first position of the wall.

pos2 Point

The 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

bool

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 Map

The 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 Map

The 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

map Map

The map.

neighbor WallLike

The nighbor that changed.

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 Map

The map.

SetOpening(Map, Opening)

Changes the Opening in this wall to the specified one

public void SetOpening(Map map, Opening opening)

Parameters

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.

public virtual bool Validate(Map map)

Parameters

map Map

Returns

bool

false if the object is not valid, true otherwise