public LightSource(XElement element) : this(Vector2.Zero, 100.0f, Color.White, null) { lightSourceParams = new LightSourceParams(element); CastShadows = element.GetAttributeBool("castshadows", true); if (lightSourceParams.DeformableLightSpriteElement != null) { DeformableLightSprite = new DeformableSprite(lightSourceParams.DeformableLightSpriteElement); } }
public void Remove() { if (!lightSourceParams.Persistent) { LightSprite?.Remove(); OverrideLightTexture?.Remove(); } DeformableLightSprite?.Remove(); DeformableLightSprite = null; lightVolumeBuffer?.Dispose(); lightVolumeBuffer = null; lightVolumeIndexBuffer?.Dispose(); lightVolumeIndexBuffer = null; GameMain.LightManager.RemoveLight(this); }