PlatformLight
A class in Root.Township, Alta.Lighting.
A light that registers with a platform lights controller. On PC it wraps a Unity Light; on Android it uses a fake light mesh instead. Enabling and disabling it adds and removes it from the controller.
- Listed in World, chunks and saving
- Inherits or implements
MonoBehaviour,IBuildRendererPostBake,IBuildBakeable - Attributes
ExecuteInEditMode
Constructors
| Member | What it is |
|---|---|
PlatformLight() | Unity makes components itself; use AddComponent or spawn a prefab instead of new. |
Fields
| Member | What it is |
|---|---|
Vector3 lastPosition | Position recorded by the last GetPosition call. |
11 private and internal fields
| Member | What it is |
|---|---|
private Mesh androidMesh | Mesh used for the fake light on Android. With none set, no fake light is made. |
private Color androidMeshColor | Colour baked into the Android fake light mesh. |
private Color color | Serialized colour value. The Color property reads the Light component instead. |
private Renderer fakeLightRenderer | Renderer of the Android fake light mesh, made in Setup. |
private bool hasFakeLight | True on Android when a fake light mesh was made. |
private float intensity | Intensity used to build the Android fake light mesh. The Intensity property reads the Light instead. |
private bool isNotImportant | Marks the light as low priority: deprioritised as a pixel light on PC and ignored for darkness on Android. |
private bool isSetup | Set once Setup has run, so it only runs once. |
private static BaseLightsController lightsController | Backing field for LightsController, made on first use (Android or PC version). |
private float range | Range used to scale the Android fake light mesh (twice the range). |
private Light targetLight | Backing field for TargetLight, the Light component on this object. |
Properties
| Member | What it is |
|---|---|
static bool AvoidBake { get; set; } | Static flag read during the build bake. Has no effect in this code. |
Color Color { get; set; } | Colour of the Unity light. |
float Intensity { get; set; } | Intensity of the Unity light. |
bool IsActive { get; set; } | Set by the lights controller, probably to say whether the light is currently in use. |
bool IsNotImportant { get; } | If true, it is a low priority pixel light on PC and does not count against darkness on Android. |
static BaseLightsController LightsController { get; } | The shared controller for the platform: Android or PC. Made on first use. |
static int MaxLightCount { get; } | Pixel light budget from quality settings, minus one. |
float Range { get; set; } | Range of the Unity light. |
LightShadows Shadows { get; set; } | Shadow mode of the Unity light. |
Light TargetLight { get; } | The Unity Light on this object. |
Methods
| Member | What it is |
|---|---|
Vector3 GetPosition() | Returns the current position and stores it in lastPosition. |
void SetEnableFakeLight(bool isEnabled) | Shows or hides the Android fake light mesh, if there is one. |
5 private and internal methods
Used in
Members of other types that take, return or hold a PlatformLight:
RecipePlacer.crystalLight, DisableLightOnDock.targetLight, FireBug.shakeLight, AndroidLightsController.buffer, AndroidLightsController.SortedLight.Light, AndroidLightsController.SortedLight.SortedLight, BaseLightsController.activeLights, BaseLightsController.ActiveLights, BaseLightsController.AddLight, BaseLightsController.RemoveLight, ISortedLight.Light, PCLightsController.AddLight, PCLightsController.RemoveLight, PCLightsController.PCSortedLight.Light, PCLightsController.PCSortedLight.PCSortedLight, ColoredParticleSystem.lightToColor, EmberComposerFireEffect.target, VariableIntensityPlayerLight.platformLight, FlintSpark.sparkLight, LightCluster.clusterLight, LightFader.target, LightFlicker.targetLight, LightHands.lightObject, PlayerEffectManager.LightEffect.light, PooledFireEffect.target.