Barotrauma Client Doc
Barotrauma.Lights.LightSource Class Reference

Public Member Functions

 LightSource (ContentXElement element, ISerializableEntity conditionalTarget=null)
 
 LightSource (LightSourceParams lightSourceParams)
 
 LightSource (Vector2 position, float range, Color color, Submarine submarine, bool addLight=true)
 
void Update (float time)
 
void RayCastTask (Vector2 drawPos, float rotation)
 
void DrawSprite (SpriteBatch spriteBatch, Camera cam)
 Draws the optional "light sprite", just a simple sprite with no shadows More...
 
void CheckConditionals ()
 
void DebugDrawVertices (SpriteBatch spriteBatch)
 
void DrawLightVolume (SpriteBatch spriteBatch, BasicEffect lightEffect, Matrix transform, bool allowRecalculation, ref int recalculationCount)
 
void Reset ()
 
void Remove ()
 

Public Attributes

Texture2D texture
 
SpriteEffects LightSpriteEffect
 
Submarine ParentSub
 
HashSet< SubmarineHullsUpToDate = new HashSet<Submarine>()
 
float Priority
 
float PriorityMultiplier = 1.0f
 
bool Enabled = true
 

Properties

bool CastShadows [get, set]
 
bool? NeedsRecalculation [get, set]
 
float LastRecalculationTime [get]
 
LightSourceParams LightSourceParams [get]
 
Vector2 Position [get, set]
 
float Rotation [get, set]
 
Vector2 SpriteScale [get, set]
 
float? OverrideLightSpriteAlpha [get, set]
 
Vector2? WorldPosition [get]
 
static Texture2D LightTexture [get]
 
Sprite OverrideLightTexture [get]
 
Sprite LightSprite [get]
 
Color Color [get, set]
 
float CurrentBrightness [get]
 
float Range [get, set]
 
Vector2 LightTextureTargetSize [get, set]
 
Vector2 LightTextureOffset [get, set]
 
Vector2 LightTextureScale = Vector2.One [get, set]
 
float TextureRange [get]
 
bool IsBackground [get, set]
 Background lights are drawn behind submarines and they don't cast shadows. More...
 
PhysicsBody ParentBody [get, set]
 
DeformableSprite DeformableLightSprite [get]
 

Detailed Description

Definition at line 199 of file LightSource.cs.

Constructor & Destructor Documentation

◆ LightSource() [1/3]

Barotrauma.Lights.LightSource.LightSource ( ContentXElement  element,
ISerializableEntity  conditionalTarget = null 
)

Definition at line 465 of file LightSource.cs.

◆ LightSource() [2/3]

Barotrauma.Lights.LightSource.LightSource ( LightSourceParams  lightSourceParams)

Definition at line 489 of file LightSource.cs.

◆ LightSource() [3/3]

Barotrauma.Lights.LightSource.LightSource ( Vector2  position,
float  range,
Color  color,
Submarine  submarine,
bool  addLight = true 
)

Definition at line 500 of file LightSource.cs.

Member Function Documentation

◆ CheckConditionals()

void Barotrauma.Lights.LightSource.CheckConditionals ( )

Definition at line 1410 of file LightSource.cs.

◆ DebugDrawVertices()

void Barotrauma.Lights.LightSource.DebugDrawVertices ( SpriteBatch  spriteBatch)

Definition at line 1424 of file LightSource.cs.

◆ DrawLightVolume()

void Barotrauma.Lights.LightSource.DrawLightVolume ( SpriteBatch  spriteBatch,
BasicEffect  lightEffect,
Matrix  transform,
bool  allowRecalculation,
ref int  recalculationCount 
)

Definition at line 1456 of file LightSource.cs.

◆ DrawSprite()

void Barotrauma.Lights.LightSource.DrawSprite ( SpriteBatch  spriteBatch,
Camera  cam 
)

Draws the optional "light sprite", just a simple sprite with no shadows

Parameters
spriteBatch

Definition at line 1284 of file LightSource.cs.

◆ RayCastTask()

void Barotrauma.Lights.LightSource.RayCastTask ( Vector2  drawPos,
float  rotation 
)

Definition at line 745 of file LightSource.cs.

◆ Remove()

void Barotrauma.Lights.LightSource.Remove ( )

Definition at line 1569 of file LightSource.cs.

◆ Reset()

void Barotrauma.Lights.LightSource.Reset ( )

Definition at line 1547 of file LightSource.cs.

◆ Update()

void Barotrauma.Lights.LightSource.Update ( float  time)

Definition at line 512 of file LightSource.cs.

Member Data Documentation

◆ Enabled

bool Barotrauma.Lights.LightSource.Enabled = true

Definition at line 459 of file LightSource.cs.

◆ HullsUpToDate

HashSet<Submarine> Barotrauma.Lights.LightSource.HullsUpToDate = new HashSet<Submarine>()

Definition at line 234 of file LightSource.cs.

◆ LightSpriteEffect

SpriteEffects Barotrauma.Lights.LightSource.LightSpriteEffect

Definition at line 217 of file LightSource.cs.

◆ ParentSub

Submarine Barotrauma.Lights.LightSource.ParentSub

Definition at line 219 of file LightSource.cs.

◆ Priority

float Barotrauma.Lights.LightSource.Priority

Definition at line 410 of file LightSource.cs.

◆ PriorityMultiplier

float Barotrauma.Lights.LightSource.PriorityMultiplier = 1.0f

Definition at line 412 of file LightSource.cs.

◆ texture

Texture2D Barotrauma.Lights.LightSource.texture

Definition at line 215 of file LightSource.cs.

Property Documentation

◆ CastShadows

bool Barotrauma.Lights.LightSource.CastShadows
getset

Definition at line 222 of file LightSource.cs.

◆ Color

Color Barotrauma.Lights.LightSource.Color
getset

Definition at line 383 of file LightSource.cs.

◆ CurrentBrightness

float Barotrauma.Lights.LightSource.CurrentBrightness
get

Definition at line 389 of file LightSource.cs.

◆ DeformableLightSprite

DeformableSprite Barotrauma.Lights.LightSource.DeformableLightSprite
get

Definition at line 453 of file LightSource.cs.

◆ IsBackground

bool Barotrauma.Lights.LightSource.IsBackground
getset

Background lights are drawn behind submarines and they don't cast shadows.

Definition at line 441 of file LightSource.cs.

◆ LastRecalculationTime

float Barotrauma.Lights.LightSource.LastRecalculationTime
get

Definition at line 266 of file LightSource.cs.

◆ LightSourceParams

LightSourceParams Barotrauma.Lights.LightSource.LightSourceParams
get

Definition at line 291 of file LightSource.cs.

◆ LightSprite

Sprite Barotrauma.Lights.LightSource.LightSprite
get

Definition at line 376 of file LightSource.cs.

◆ LightTexture

Texture2D Barotrauma.Lights.LightSource.LightTexture
staticget

Definition at line 358 of file LightSource.cs.

◆ LightTextureOffset

Vector2 Barotrauma.Lights.LightSource.LightTextureOffset
getset

Definition at line 427 of file LightSource.cs.

◆ LightTextureScale

Vector2 Barotrauma.Lights.LightSource.LightTextureScale = Vector2.One
getset

Definition at line 428 of file LightSource.cs.

◆ LightTextureTargetSize

Vector2 Barotrauma.Lights.LightSource.LightTextureTargetSize
getset

Definition at line 416 of file LightSource.cs.

◆ NeedsRecalculation

bool? Barotrauma.Lights.LightSource.NeedsRecalculation
getset

Definition at line 239 of file LightSource.cs.

◆ OverrideLightSpriteAlpha

float? Barotrauma.Lights.LightSource.OverrideLightSpriteAlpha
getset

Definition at line 347 of file LightSource.cs.

◆ OverrideLightTexture

Sprite Barotrauma.Lights.LightSource.OverrideLightTexture
get

Definition at line 371 of file LightSource.cs.

◆ ParentBody

PhysicsBody Barotrauma.Lights.LightSource.ParentBody
getset

Definition at line 447 of file LightSource.cs.

◆ Position

Vector2 Barotrauma.Lights.LightSource.Position
getset

Definition at line 294 of file LightSource.cs.

◆ Range

float Barotrauma.Lights.LightSource.Range
getset

Definition at line 395 of file LightSource.cs.

◆ Rotation

float Barotrauma.Lights.LightSource.Rotation
getset

Definition at line 317 of file LightSource.cs.

◆ SpriteScale

Vector2 Barotrauma.Lights.LightSource.SpriteScale
getset

Definition at line 341 of file LightSource.cs.

◆ TextureRange

float Barotrauma.Lights.LightSource.TextureRange
get

Definition at line 430 of file LightSource.cs.

◆ WorldPosition

Vector2? Barotrauma.Lights.LightSource.WorldPosition
get

Definition at line 353 of file LightSource.cs.