Class LightFurniture
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
-
JsonTypeSafeGenericDataHolderLightFurniture
- 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
GuidThe id to apply to the created furniture instance
type
FurnitureTypeThe type to create an instance of
colors
int[]The colors to apply to the furniture
map
MapThe map to create the furniture on
pos
Vector2The position that the furniture should have
floor
floatThe 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
Properties
LightSettings
The LightFurniture.Settings that this light furniture operates under.
public LightFurniture.Settings LightSettings { get; }
Property Value
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
Direction2The old camera rotation
newRotation
Direction2The 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
GameTimeThe game's time
passedInGame
TimeSpanThe amount of time that has passed since the last call
speedMultiplier
floatThe game speed multiplier, which represents how fast things should happen, which is usually determined by Speed
Validate(AppliedMigrations)
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(AppliedMigrations appliedMigrations)
Parameters
appliedMigrations
AppliedMigrations
Returns
- bool
false if the object is not valid, true otherwise