public void Update() { Vector2 position = transform.transform.position; if (movedPosition != position) { movedPosition = position; moved = true; } else { moved = false; } if (moved) { foreach (LightingSource2D id in LightingSource2D.GetList()) { if (Vector2.Distance(id.transform.position, position) < meshDistance + id.lightSize) { id.update = true; LightingBuffer2D.GetBuffer(id.GetTextureSize(), id).lightSource = id; } } } }
void Update() { if (updatePosition != transform.position) { updatePosition = transform.position; update = true; } if (updateRotation != transform.rotation.eulerAngles.z) { updateRotation = transform.rotation.eulerAngles.z; update = true; } if (updateSize != lightSize) { updateSize = lightSize; update = true; } if (updateColor.Equals(lightColor) == false) { updateColor = lightColor; } if (updateAlpha != lightAlpha) { updateAlpha = lightAlpha; } if (update == true) { LightingBuffer2D buffer = LightingBuffer2D.GetBuffer(GetTextureSize(), this); buffer.lightSource = this; //buffer.bufferCamera.enabled=true; } }