Interface ILightObject
An interface that can be applied to MapObject instances to give them easy-to-set-up light properties based on a set of ILightObject.Settings. A default implementation of a Furniture object with this interface is LightFurniture.
public interface ILightObject
- Extension Methods
Properties
IsDisabled
Whether this light is currently disabled. Note that a light also gets disabled if this object IsElectrical and AreUtilitiesDisabled is true, but this field will not be set to true in that case.
bool IsDisabled { get; set; }
Property Value
LightSettings
The ILightObject.Settings that this light object operates under.
ILightObject.Settings LightSettings { get; }
Property Value
Lights
The lights that are currently in the world, based on this light object
Light[] Lights { get; }
Property Value
- Light[]
Methods
CreateLights<T>(T)
This method is called when this furniture's lights should get initialized. By default, this method calls CreateLights.
protected static IEnumerable<Light> CreateLights<T>(T obj) where T : MapObject, ILightObject
Parameters
obj
T
Returns
- IEnumerable<Light>
The lights that this object should have
Type Parameters
T
Update<T>(T, GameTime, float, Random, ref float, float)
Causes a ILightObject instance to be updated, namely displaying its visuals and enabling or disabling it based on automatic lighting settings and electrical properties.
protected static void Update<T>(T obj, GameTime time, float speedMultiplier, Random random, ref float flickerTimer, float randomToggleDelaySeconds = 0) where T : MapObject, ILightObject
Parameters
obj
TThe light object to update.
time
GameTimeThe current game time.
speedMultiplier
floatThe game's current speed multiplier.
random
RandomA random instance to be used for visuals.
flickerTimer
floatA timer that is used to store the amount of time that has passed for the purpose of causing the light to flicker or pulsate visually. The flickerTimer timer is added onto in this method. Generally, the flicker timer is short-lived and does not need to be stored to disk by implementers.
randomToggleDelaySeconds
floatAn amount of real-life seconds that should pass before the light object is turned on or of iff IsAutomatic is set. If this is 0 for all light objects, they will automatically enable and disable at exactly 6 and 21 o'clock, respectively.
Type Parameters
T