Terrain Engine 2D  1.10
A 2D Block Engine
TerrainEngine2D.Lighting.AmbientLight Class Reference

2D Ambient lighting More...

Inheritance diagram for TerrainEngine2D.Lighting.AmbientLight:
TerrainEngine2D.MonoBehaviourSingleton< AmbientLight >

Public Member Functions

void Start ()
 
void Initialize ()
 Initialize the ambient lighting More...
 
void GenerateLightData ()
 Generate the light map data More...
 
void UpdateLightSystem ()
 Set the light system for an update More...
 
Color32 CalculateAmbientLightValue (int x, int y)
 Calculate a Color value for the ambient light at a specified position More...
 
void GenerateAmbientLighting (Color32[,] lightMap2D)
 Generate the ambient light texture More...
 
void IlluminateBlock (int x, int y, int distanceFromAir, float lightBleedFactor=1)
 Illuminate a block at a specific coordinate More...
 
void ClearLightData (int x, int y)
 Clears the color of a block at a specific coordinate More...
 
void UpdateLighting (int posX, int posY, int width, int height, bool ambientLightLayer=false)
 Update the lightmap data when blocks change in the lightLayer More...
 
void UpdateHeightMap (int x, int y, int width, int height, bool blockAdded)
 Update the height map when terrain is modified More...
 

Protected Member Functions

override void Awake ()
 

Additional Inherited Members

- Properties inherited from TerrainEngine2D.MonoBehaviourSingleton< AmbientLight >
static T Instance [get]
 

Detailed Description

2D Ambient lighting

Member Function Documentation

◆ Awake()

override void TerrainEngine2D.Lighting.AmbientLight.Awake ( )
protectedvirtual

◆ CalculateAmbientLightValue()

Color32 TerrainEngine2D.Lighting.AmbientLight.CalculateAmbientLightValue ( int  x,
int  y 
)

Calculate a Color value for the ambient light at a specified position

Parameters
xX coordinate of the position
yY coordinate of the position
Returns
Returns the color of the ambient light

◆ ClearLightData()

void TerrainEngine2D.Lighting.AmbientLight.ClearLightData ( int  x,
int  y 
)

Clears the color of a block at a specific coordinate

Parameters
xX coordinate
yY coordinate

◆ GenerateAmbientLighting()

void TerrainEngine2D.Lighting.AmbientLight.GenerateAmbientLighting ( Color32  lightMap2D[,])

Generate the ambient light texture

Parameters
lightMap2DThe light data for the whole world

◆ GenerateLightData()

void TerrainEngine2D.Lighting.AmbientLight.GenerateLightData ( )

Generate the light map data

◆ IlluminateBlock()

void TerrainEngine2D.Lighting.AmbientLight.IlluminateBlock ( int  x,
int  y,
int  distanceFromAir,
float  lightBleedFactor = 1 
)

Illuminate a block at a specific coordinate

Parameters
xX coordinate
yY coordinate
distanceFromAirDistance of the block from the nearest sunlight block
lightBleedFactorFactor affecting the amount light bleeds through blocks

◆ Initialize()

void TerrainEngine2D.Lighting.AmbientLight.Initialize ( )

Initialize the ambient lighting

◆ Start()

void TerrainEngine2D.Lighting.AmbientLight.Start ( )

◆ UpdateHeightMap()

void TerrainEngine2D.Lighting.AmbientLight.UpdateHeightMap ( int  x,
int  y,
int  width,
int  height,
bool  blockAdded 
)

Update the height map when terrain is modified

Parameters
posXThe x position of the block change
posYThe y position of the block change
widthThe width of the block (in block units)
heightThe height of the block (in block units)
blockAddedWhether a block was added or removed

◆ UpdateLighting()

void TerrainEngine2D.Lighting.AmbientLight.UpdateLighting ( int  posX,
int  posY,
int  width,
int  height,
bool  ambientLightLayer = false 
)

Update the lightmap data when blocks change in the lightLayer

Parameters
posXThe x position of the block change
posYThe y position of the block change
widthThe width of the block (in block units)
heightThe height of the block (in block units)
ambientLightLayerWhether the ambientLightLayer was modified

◆ UpdateLightSystem()

void TerrainEngine2D.Lighting.AmbientLight.UpdateLightSystem ( )

Set the light system for an update


The documentation for this class was generated from the following file: