Class Roof
A roof is an object on a Map that is on a higher level and cannot be interacted with by people
Inheritance
Implements
Inherited Members
Namespace: TinyLife.World
Assembly: Tiny Life.dll
Syntax
[DataContract]
public class Roof : IPricedObject
Constructors
Roof(RoofType, Rectangle, Direction2, Int32)
Creates a new roof with the given settings
Declaration
public Roof(RoofType type, Rectangle area, Direction2 rotation, int color)
Parameters
Type | Name | Description |
---|---|---|
RoofType | type | The type of the roof |
Microsoft.Xna.Framework.Rectangle | area | The area that this roof covers |
MLEM.Misc.Direction2 | rotation | This roof's rotation |
System.Int32 | color | The color that this roof's wallpaper should have |
Fields
Color
The color index in in WarmDark that this roof uses for its top
Declaration
[DataMember]
public readonly int Color
Field Value
Type | Description |
---|---|
System.Int32 |
Type
The RoofType that this roof has
Declaration
[DataMember]
public readonly RoofType Type
Field Value
Type | Description |
---|---|
RoofType |
Wallpaper
The Wallpaper that is applied to this roof. This defaults to the Default wallpaper.
Declaration
[DataMember]
public Wallpaper Wallpaper
Field Value
Type | Description |
---|---|
Wallpaper |
Properties
Area
The area that this roof covers
Declaration
[DataMember]
public Rectangle Area { get; }
Property Value
Type | Description |
---|---|
Microsoft.Xna.Framework.Rectangle |
Rotation
The rotation that this roof has. This is only relevant for roofs that don't have the Flat style.
Declaration
[DataMember]
public Direction2 Rotation { get; }
Property Value
Type | Description |
---|---|
MLEM.Misc.Direction2 |
Methods
GenerateRoof(Room, UndoableAction)
Generates the roofing for the given Room and adds it to the map. The generated roofing is split into as few separate parts as possible by ordering the tiles the room covers.
Declaration
public static void GenerateRoof(Room room, UndoableAction action)
Parameters
Type | Name | Description |
---|---|---|
Room | room | The room to add roofing to |
UndoableAction | action | The undoable action that this method should add its actions to. If this method should be executed immediately, use the UndoableAction immediate constructor. |
GetPrice()
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.
Declaration
public float GetPrice()
Returns
Type | Description |
---|---|
System.Single | The object's price |
GetRoofAttachedFurnitureOffset(Vector2)
Returns the offset that Furniture attached to this roof should have when rendering. This method uses GetGableOffset(Rectangle, Direction2, Point) internally.
Declaration
public (Vector2 DrawOffset, float DepthOffset) GetRoofAttachedFurnitureOffset(Vector2 position)
Parameters
Type | Name | Description |
---|---|---|
Microsoft.Xna.Framework.Vector2 | position | The position that the furniture is on. |
Returns
Type | Description |
---|---|
System.ValueTuple<Microsoft.Xna.Framework.Vector2, System.Single> | The draw and depth offset that the furniture should draw with. |
Validate()
Validates this roof instance, which is automatically done in Validate(Action<String>, Action<Single>, Boolean) when the map is loaded from disk
Declaration
public bool Validate()
Returns
Type | Description |
---|---|
System.Boolean | Whether this roof is still valid |