Table of Contents

Class Roof

Namespace
TinyLife.World
Assembly
Tiny Life.dll

A roof is an object on a Map that is on a higher level and cannot be interacted with by people

[DataContract]
public class Roof
Inheritance
Roof
Inherited Members
Extension Methods

Constructors

Roof(RoofType, Rectangle, int?, Direction2, int[], int)

Creates a new roof with the given settings

public Roof(RoofType type, Rectangle area, int? floor, Direction2 rotation, int[] colors, int heightOffset)

Parameters

type RoofType

The type of the roof

area Rectangle

The area that this roof covers

floor int?

The floor this roof is on.

rotation Direction2

This roof's rotation

colors int[]

The colors that this roof should have

heightOffset int

A height offset that is added onto this roof's gable offset. This can be set by the player using a slider in build mode.

Fields

Color

The color index in in WarmDark that this roof uses for its top

[DataMember(EmitDefaultValue = false)]
[Obsolete("Use the new Colors array instead")]
public readonly int Color

Field Value

int

Colors

The colors that this roof should have

[DataMember]
public int[] Colors

Field Value

int[]

HeightOffset

A height offset that is added onto this roof's gable offset. This can be set by the player using a slider in build mode.

[DataMember]
public readonly int HeightOffset

Field Value

int

Type

The RoofType that this roof has

[DataMember]
public readonly RoofType Type

Field Value

RoofType

Wallpaper

The Wallpaper that is applied to this roof. This defaults to the Default wallpaper.

[DataMember]
public Wallpaper Wallpaper

Field Value

Wallpaper

Properties

Area

The area that this roof covers

[DataMember]
public Rectangle Area { get; }

Property Value

Rectangle

Floor

The floor this roof is on. This is an optional property for backwards compatibility, however it is internally expected to always be nonnull.

[DataMember]
public int? Floor { get; }

Property Value

int?

Rotation

The rotation that this roof has. This is only relevant for roofs that don't have the Flat style.

[DataMember]
public Direction2 Rotation { get; }

Property Value

Direction2

Methods

GetPrice()

This roof's price, which is based on GetPrice(Rectangle).

public float GetPrice()

Returns

float

This roof'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.

public (Vector2 DrawOffset, float DepthOffset) GetRoofAttachedFurnitureOffset(Vector2 position)

Parameters

position Vector2

The position that the furniture is on.

Returns

(Vector2 Pos, float Floor)

The draw and depth offset that the furniture should draw with.

Validate()

Validates this roof instance, which is automatically done in Validate(bool, Action<string>, Action<float>) when the map is loaded from disk

public bool Validate()

Returns

bool

Whether this roof is still valid