Wall - Ellpeck/TinyLifeExampleMod Wiki

Tiny Life

TinyLife.World

Wall Class

A wall is an element of a Map that stops traversal and that has a Wallpaper and optionally an Opening attached to it.

public class Wall : MLEM.Misc.GenericDataHolder,
TinyLife.World.IPricedObject

Inheritance System.Object 🡒 MLEM.Misc.GenericDataHolder 🡒 Wall

Implements IPricedObject

Constructors

Wall.Wall(Point[]) Constructor

Creates a new wall at the given position, with the implicitly given verticality

public Wall(params Microsoft.Xna.Framework.Point[] positions);

Parameters

positions Microsoft.Xna.Framework.Point[]
The positions that the wall should be placed between

Fields

Wall.DisplayModes Field

All defined values of the WallMode enumeration

public static readonly WallMode[] DisplayModes;

Field Value

WallMode[]

Wall.IsStatic Field

A field that is true for objects that are part of the exported base map that the current map is created from

public bool IsStatic;

Field Value

System.Boolean

Wall.Positions Field

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.

public readonly Point[] Positions;

Field Value

Microsoft.Xna.Framework.Point[]

Wall.Price Field

The price of building a single wall element

public const int Price = 125;

Field Value

System.Int32

Wall.Wallpapers Field

The two wallpapers attached to this Wall, on either one of its sides

public readonly Wallpaper[] Wallpapers;

Field Value

Wallpaper[]

Properties

Wall.Opening Property

The Opening attached to this wall, or null if there is none.
Use SetOpening(Map, Opening) to set this value.

public TinyLife.World.Opening Opening { get; set; }

Property Value

Opening

Wall.Vertical Property

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

System.Boolean

Methods

Wall.Draw(Map, GameTime, SpriteBatch, Vector2, Nullable<Color>) Method

Draws this wall in the world, along with its Wallpapers and Opening

public void Draw(TinyLife.World.Map map, Microsoft.Xna.Framework.GameTime time, Microsoft.Xna.Framework.Graphics.SpriteBatch batch, Microsoft.Xna.Framework.Vector2 drawPos, System.Nullable<Microsoft.Xna.Framework.Color> overrideColor);

Parameters

map Map
The map to draw this wall on

time Microsoft.Xna.Framework.GameTime
The game time

batch Microsoft.Xna.Framework.Graphics.SpriteBatch
The sprite batch to draw with

drawPos Microsoft.Xna.Framework.Vector2
The position to draw the wall at, in draw space

overrideColor System.Nullable<Microsoft.Xna.Framework.Color>
A color that this object should be rendered with, instead of its default color

Wall.GetDepth(Map, float) Method

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(TinyLife.World.Map map, float offset=0f);

Parameters

map Map
The map that this wall is on

offset System.Single
An offset that will be added to the depth calculation

Returns

System.Single

Wall.GetDisplayMode() Method

Returns the WallMode that this wall should be rendered with.
If the Opening is nonnull, its WallMode is returned.

public TinyLife.World.WallMode GetDisplayMode();

Returns

WallMode
The wall mode

Wall.GetFreeActionSpotInfo(Person) Method

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 TinyLife.Actions.ActionInfo GetFreeActionSpotInfo(TinyLife.Objects.Person person);

Parameters

person Person
The person to return the action spot info for

Returns

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

Wall.GetIndexForCamera() Method

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

System.Int32
The side of the wall that should be rendered

Wall.GetPositionForCamera() Method

Returns the position from the Positions array that GetIndexForCamera() suggests.
This is the side of the wall that currently faces the game camera.

public Microsoft.Xna.Framework.Point GetPositionForCamera();

Returns

Microsoft.Xna.Framework.Point
The wall position that is facing the camera

Wall.GetPrice() Method

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.

public float GetPrice();

Returns

System.Single
The object's price

Implements GetPrice()

Wall.IsDown() Method

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.

public bool IsDown();

Returns

System.Boolean
Whether the wall should be rendered down

Wall.IsVerticalForCamera() Method

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

System.Boolean

Wall.SetOpening(Map, Opening) Method

Changes the Opening in this wall to the specified one

public void SetOpening(TinyLife.World.Map map, TinyLife.World.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

Wall.Validate() Method

This method is called when this object is loaded from disk.

public bool Validate();

Returns

System.Boolean
false if the object is not valid, true otherwise