Class Room
Inheritance
Inherited Members
Namespace: TinyLife.World
Assembly: Tiny Life.dll
Syntax
public class Room
Fields
Center
The position that is considered to be the center of this room. This is the average of all of its covered Tiles, and the MapSection that this room is on is determined by this value.
Declaration
public readonly Point Center
Field Value
Type | Description |
---|---|
Microsoft.Xna.Framework.Point |
CoveredSections
A set of MapSection instances that are covered by this room
Declaration
public readonly HashSet<MapSection> CoveredSections
Field Value
Type | Description |
---|---|
System.Collections.Generic.HashSet<T><MapSection> |
Map
The map that this room is on
Declaration
public readonly Map Map
Field Value
Type | Description |
---|---|
Map |
Tiles
A set of Microsoft.Xna.Framework.Point positions on the Map that are contained in this room
Declaration
public readonly HashSet<Point> Tiles
Field Value
Type | Description |
---|---|
System.Collections.Generic.HashSet<T><Microsoft.Xna.Framework.Point> |
Properties
FullyRoofed
A property that stores whether this room is fully roofed, that is, whether all of its Tiles are covered by a Roof. This property is evaluated automatically in Validate().
Declaration
public bool FullyRoofed { get; }
Property Value
Type | Description |
---|---|
System.Boolean |
HasOpeningsToOutside
Declaration
public bool HasOpeningsToOutside { get; }
Property Value
Type | Description |
---|---|
System.Boolean |
Methods
GetConnectedRooms(Person)
Returns a set of Room objects which are connected to this room. A connected room is a room that is directly adjacent, and that a Person can walk into through an Opening.
Declaration
public IEnumerable<Room> GetConnectedRooms(Person person)
Parameters
Type | Name | Description |
---|---|---|
Person | person |
Returns
Type | Description |
---|---|
System.Collections.Generic.IEnumerable<T><Room> | A set of connected rooms |
GetDecorativeRating()
Returns the combined decorative rating of all of the Furniture in this room. This method uses the DecorativeRating function.
Declaration
public int GetDecorativeRating()
Returns
Type | Description |
---|---|
System.Int32 | The combined decorative rating |
GetLights()
Returns all of the Light instances that are contained in this room
Declaration
public IEnumerable<Light> GetLights()
Returns
Type | Description |
---|---|
System.Collections.Generic.IEnumerable<T><Light> | All of the lights in this room |
GetObjects<T>()
Returns all of the MapObject instances that are contained in this room
Declaration
public IEnumerable<T> GetObjects<T>()
where T : MapObject
Returns
Type | Description |
---|---|
System.Collections.Generic.IEnumerable<T><T> | All of the objects in this room |
Type Parameters
Name | Description |
---|---|
T |
GetWalls(Boolean)
Returns all of the Wall instances that are border walls or internal walls of this room. An internal wall is a wall for which both sides are contained in the room, rather than just one.
Declaration
public IEnumerable<(Wall, int)> GetWalls(bool borderOnly)
Parameters
Type | Name | Description |
---|---|---|
System.Boolean | borderOnly | Whether to return border walls only, or include internal walls |
Returns
Type | Description |
---|---|
System.Collections.Generic.IEnumerable<T><System.ValueTuple<T1, T2><Wall, System.Int32>> | A set of walls and their included sides of this room |
IsSameRoom(ICollection<Point>)
Returns whether this room has the same covered Tiles as the given collection
Declaration
public bool IsSameRoom(ICollection<Point> tiles)
Parameters
Type | Name | Description |
---|---|---|
System.Collections.Generic.ICollection<T><Microsoft.Xna.Framework.Point> | tiles | The tiles to query |
Returns
Type | Description |
---|---|
System.Boolean | true if the covered tiles are the same, false otherwise |
Validate()
This method is called in AddNewRoomsAndValidateExisting(Point[], UndoableAction, Boolean) to ensure that this room is still valid
Declaration
public bool Validate()
Returns
Type | Description |
---|---|
System.Boolean | false if the object is not valid, true otherwise |