Table of Contents

Class LightFurniture

Namespace
TinyLife.Objects
Assembly
Tiny Life.dll

Light furniture is a furniture that additionally spawns and handles a set of Light instances. To use this class effectively, set LightSettings to determine the lights that should be spawned from the furniture.

public class LightFurniture : Furniture, IGenericDataHolder, IUpdatingObject
Inheritance
JsonTypeSafeGenericDataHolder
LightFurniture
Implements
IGenericDataHolder
Derived
Inherited Members
JsonTypeSafeGenericDataHolder.GetDataKeys()
Extension Methods

Constructors

LightFurniture(Guid, FurnitureType, int[], Map, Vector2, float)

Creates a new furniture instance. By default, this is done using Construct<T>(int[], Map, Vector2, float, Guid?).

public LightFurniture(Guid id, FurnitureType type, int[] colors, Map map, Vector2 pos, float floor)

Parameters

id Guid

The id to apply to the created furniture instance

type FurnitureType

The type to create an instance of

colors int[]

The colors to apply to the furniture

map Map

The map to create the furniture on

pos Vector2

The position that the furniture should have

floor float

The floor that this object is on.

Fields

IsDisabled

Whether this light is currently disabled. Note that a light also gets disabled if this furniture IsElectrical and AreUtilitiesDisabled is true, but this field will not be set to true in that case.

[DataMember]
public bool IsDisabled

Field Value

bool

Properties

LightSettings

The LightFurniture.Settings that this light furniture operates under.

public LightFurniture.Settings LightSettings { get; }

Property Value

LightFurniture.Settings

Lights

The lights that are currently in the world, based on this light furniture

public Light[] Lights { get; }

Property Value

Light[]

Methods

CreateLights()

This method is called when this furniture's lights should get initialized. By default, this method calls CreateLights.

protected virtual IEnumerable<Light> CreateLights()

Returns

IEnumerable<Light>

The lights that this object should have

OnAdded()

This method is called when this object is added to a Map. By default, it does nothing.

public override void OnAdded()

OnCameraRotationChanged(Direction2, Direction2)

This method is invoked when the game's camera rotation changes. Additionally, the old and new rotations are passed.

public override void OnCameraRotationChanged(Direction2 oldRotation, Direction2 newRotation)

Parameters

oldRotation Direction2

The old camera rotation

newRotation Direction2

The new camera rotation

OnRemoved()

This method is called when this object is removed from a Map. By default, it does nothing.

public override void OnRemoved()

Update(GameTime, TimeSpan, float)

The update method, which is called every update frame by the underlying Map, as well as additional places like the FurnitureStorage. Because of this, some actions might only want to be invoked if an object IsInWorld. To call this method while invoking all required events, use DoUpdate(GameTime, TimeSpan, float).

public virtual void Update(GameTime time, TimeSpan passedInGame, float speedMultiplier)

Parameters

time GameTime

The game's time

passedInGame TimeSpan

The amount of time that has passed since the last call

speedMultiplier float

The game speed multiplier, which represents how fast things should happen, which is usually determined by Speed

Validate()

This method is called when this object is loaded from disk. Returning false on this method causes the object to be removed from the map. By default, this method invokes OnValidated and OnEventsAttachable.

public override bool Validate()

Returns

bool

false if the object is not valid, true otherwise