C# Class AlertSpeaker.Building_AlertSpeaker

AlertSpeaker class.
Inheritance: Building
Show file Open project: Rikiki123456789/Rimworld Class Usage Examples

Public Properties

Property Type Description
alarmSoundTick int
alertStartTick int
currentDangerRate StoryDanger
glowColor ColorInt
glowRadius float
glowerComp CompGlower
highDangerAlarmSound SoundDef
highDangerDrawingTick int
lastUpdateTick int
lowDangerAlarmSound SoundDef
lowDangerDrawingTick int
numberOfAlertSpeakers int
powerComp CompPowerTrader
previousDangerRate StoryDanger
sirenSoundDisabledIcon UnityEngine.Texture2D
sirenSoundEnabledIcon UnityEngine.Texture2D
soundIsActivated bool

Public Methods

Method Description
CheckIfColonistHasAMediumAdrenalineBoostBonus ( Pawn colonist ) : bool

Check if the given colonist has a medium adrenaline boost bonus.

CheckIfColonistHasASmallAdrenalineBoostBonus ( Pawn colonist ) : bool

Check if the given colonist has a small adrenaline boost bonus.

CheckIfColonistHasASmallStressMalus ( Pawn colonist ) : bool

Check if the given colonist has a small stress malus.

CheckIfSupportingWallIsAlive ( IntVec3 alertSpeakerPosition, Rot4 alertSpeakerRotation ) : bool

Checks if the wall supporting the alert speaker is still alive.

ComputeDrawingParameters ( ) : void

Compute the global drawing parameters. o danger rate == None => small green light. o danger rate == Low => medium yellow light ramping up and down. o danger rate == High => big flashing red light.

Destroy ( DestroyMode mode = DestroyMode.Vanish ) : void

Destroys the alert speaker and remove any bonus/malus i fthere are no more on the map.

DisplayActiveMote ( ) : void

Displays the active mote when applicable.

Draw ( ) : void

Performs the drawing treatment. Applies the drawing parameters.

ExposeData ( ) : void

Saves and loads variables (stored in savegame data).

GetEffectZoneCells ( IntVec3 alertSpeakerPosition ) : List

Get the effect zone cells.

GetGizmos ( ) : IEnumerable

This creates the command buttons to control the alert speaker sound activation.

PerformDrawingTreatment ( ) : void

Performs the drawing treatment. Applies the drawing parameters.

PerformSirenSoundAction ( ) : void

Activates/deactivates siren sound.

PerformSoundTreatment ( ) : void

Performs the sound treatment. o danger rate == None => no sound. o danger rate == Low => plays low danger alarm sound o danger rate == High => plays high danger alarm sound

PerformTreatmentDuringAlert ( ) : void

Performs the treatments during an alert according to the current danger rate. o danger rate == None => no bonus. o danger rate == Low => * early phase: small adrenaline boost. * middle and late phase: no bonus. o danger rate == High => * early phase: medium adrenaline boost. * middle phase: no bonus. * late phase: small stress malus.

PerformTreatmentOnDangerRateTransition ( ) : void

Check if a danger rate transition is occuring and perform the corresponding treatment. Transitions management: Transition 1: beginning alert. => set the alert start tick. Transition 2: finished alert. => remove any stat bonus/malus and malus thought. => add a bonus thought. Transition 3: increased danger rating. => convert the small adrenaline boost into medium adrenaline boost. Transition 4: decreased danger rating. => keep the medium adrenaline boost (nothing to do).

PlayOneHighDangerAlarmSound ( ) : void

Play one high danger alarm sound.

PlayOneLowDangerAlarmSound ( ) : void

Play one low danger alarm sound.

RemoveAnyStatBonusFromAllColonists ( ) : void

Remove any stat bonus from all colonists.

RemoveAnyStatMalusFromAllColonists ( ) : void

Remove any stat malus from all colonists.

RemoveAnyThoughtBonusFromAllColonists ( ) : void

Remove any thought bonus from all colonists.

RemoveAnyThoughtMalusFromAllColonists ( ) : void

Remove any thought malus from all colonists.

SpawnSetup ( ) : void

Initializes instance variables.

Tick ( ) : void

- Checks if the supporting wall is still alive. - Checks current threat level. - Performs adequate treatment when a danger level transition occurs. - Applies an adrenaline bonus to nearby colonists according to current danger rate.

TryApplyColonyIsThreatenedThoughtToAllColonists ( ) : void

Try to apply the "colony is threathened" malus thought to all colonists.

TryApplyMediumAdrenalineBoostBonusToColonists ( List colonistList ) : void

Try to apply a medium adrenaline boost bonus to each colonist if he has not already one.

TryApplySmallAdrenalineBoostBonusToColonists ( List colonistList ) : void

Try to apply a small adrenaline boost to each colonist if he has not already a small or a medium one.

TryApplySmallStressMalusToAllColonists ( ) : void

Try to apply a small stress malus to all colonists.

TryApplyThreatIsFinishedThoughtToAllColonists ( ) : void

Try to apply the "threat is finished" thought to all colonists.

Method Details

CheckIfColonistHasAMediumAdrenalineBoostBonus() public method

Check if the given colonist has a medium adrenaline boost bonus.
public CheckIfColonistHasAMediumAdrenalineBoostBonus ( Pawn colonist ) : bool
colonist Pawn
return bool

CheckIfColonistHasASmallAdrenalineBoostBonus() public method

Check if the given colonist has a small adrenaline boost bonus.
public CheckIfColonistHasASmallAdrenalineBoostBonus ( Pawn colonist ) : bool
colonist Pawn
return bool

CheckIfColonistHasASmallStressMalus() public method

Check if the given colonist has a small stress malus.
public CheckIfColonistHasASmallStressMalus ( Pawn colonist ) : bool
colonist Pawn
return bool

CheckIfSupportingWallIsAlive() public static method

Checks if the wall supporting the alert speaker is still alive.
public static CheckIfSupportingWallIsAlive ( IntVec3 alertSpeakerPosition, Rot4 alertSpeakerRotation ) : bool
alertSpeakerPosition IntVec3
alertSpeakerRotation Rot4
return bool

ComputeDrawingParameters() public method

Compute the global drawing parameters. o danger rate == None => small green light. o danger rate == Low => medium yellow light ramping up and down. o danger rate == High => big flashing red light.
public ComputeDrawingParameters ( ) : void
return void

Destroy() public method

Destroys the alert speaker and remove any bonus/malus i fthere are no more on the map.
public Destroy ( DestroyMode mode = DestroyMode.Vanish ) : void
mode DestroyMode
return void

DisplayActiveMote() public method

Displays the active mote when applicable.
public DisplayActiveMote ( ) : void
return void

Draw() public method

Performs the drawing treatment. Applies the drawing parameters.
public Draw ( ) : void
return void

ExposeData() public method

Saves and loads variables (stored in savegame data).
public ExposeData ( ) : void
return void

GetEffectZoneCells() public static method

Get the effect zone cells.
public static GetEffectZoneCells ( IntVec3 alertSpeakerPosition ) : List
alertSpeakerPosition IntVec3
return List

GetGizmos() public method

This creates the command buttons to control the alert speaker sound activation.
public GetGizmos ( ) : IEnumerable
return IEnumerable

PerformDrawingTreatment() public method

Performs the drawing treatment. Applies the drawing parameters.
public PerformDrawingTreatment ( ) : void
return void

PerformSirenSoundAction() public method

Activates/deactivates siren sound.
public PerformSirenSoundAction ( ) : void
return void

PerformSoundTreatment() public method

Performs the sound treatment. o danger rate == None => no sound. o danger rate == Low => plays low danger alarm sound o danger rate == High => plays high danger alarm sound
public PerformSoundTreatment ( ) : void
return void

PerformTreatmentDuringAlert() public method

Performs the treatments during an alert according to the current danger rate. o danger rate == None => no bonus. o danger rate == Low => * early phase: small adrenaline boost. * middle and late phase: no bonus. o danger rate == High => * early phase: medium adrenaline boost. * middle phase: no bonus. * late phase: small stress malus.
public PerformTreatmentDuringAlert ( ) : void
return void

PerformTreatmentOnDangerRateTransition() public method

Check if a danger rate transition is occuring and perform the corresponding treatment. Transitions management: Transition 1: beginning alert. => set the alert start tick. Transition 2: finished alert. => remove any stat bonus/malus and malus thought. => add a bonus thought. Transition 3: increased danger rating. => convert the small adrenaline boost into medium adrenaline boost. Transition 4: decreased danger rating. => keep the medium adrenaline boost (nothing to do).
public PerformTreatmentOnDangerRateTransition ( ) : void
return void

PlayOneHighDangerAlarmSound() public method

Play one high danger alarm sound.
public PlayOneHighDangerAlarmSound ( ) : void
return void

PlayOneLowDangerAlarmSound() public method

Play one low danger alarm sound.
public PlayOneLowDangerAlarmSound ( ) : void
return void

RemoveAnyStatBonusFromAllColonists() public method

Remove any stat bonus from all colonists.
public RemoveAnyStatBonusFromAllColonists ( ) : void
return void

RemoveAnyStatMalusFromAllColonists() public method

Remove any stat malus from all colonists.
public RemoveAnyStatMalusFromAllColonists ( ) : void
return void

RemoveAnyThoughtBonusFromAllColonists() public method

Remove any thought bonus from all colonists.
public RemoveAnyThoughtBonusFromAllColonists ( ) : void
return void

RemoveAnyThoughtMalusFromAllColonists() public method

Remove any thought malus from all colonists.
public RemoveAnyThoughtMalusFromAllColonists ( ) : void
return void

SpawnSetup() public method

Initializes instance variables.
public SpawnSetup ( ) : void
return void

Tick() public method

- Checks if the supporting wall is still alive. - Checks current threat level. - Performs adequate treatment when a danger level transition occurs. - Applies an adrenaline bonus to nearby colonists according to current danger rate.
public Tick ( ) : void
return void

TryApplyColonyIsThreatenedThoughtToAllColonists() public method

Try to apply the "colony is threathened" malus thought to all colonists.
public TryApplyColonyIsThreatenedThoughtToAllColonists ( ) : void
return void

TryApplyMediumAdrenalineBoostBonusToColonists() public method

Try to apply a medium adrenaline boost bonus to each colonist if he has not already one.
public TryApplyMediumAdrenalineBoostBonusToColonists ( List colonistList ) : void
colonistList List
return void

TryApplySmallAdrenalineBoostBonusToColonists() public method

Try to apply a small adrenaline boost to each colonist if he has not already a small or a medium one.
public TryApplySmallAdrenalineBoostBonusToColonists ( List colonistList ) : void
colonistList List
return void

TryApplySmallStressMalusToAllColonists() public method

Try to apply a small stress malus to all colonists.
public TryApplySmallStressMalusToAllColonists ( ) : void
return void

TryApplyThreatIsFinishedThoughtToAllColonists() public method

Try to apply the "threat is finished" thought to all colonists.
public TryApplyThreatIsFinishedThoughtToAllColonists ( ) : void
return void

Property Details

alarmSoundTick public static property

public static int alarmSoundTick
return int

alertStartTick public static property

public static int alertStartTick
return int

currentDangerRate public static property

public static StoryDanger currentDangerRate
return StoryDanger

glowColor public static property

public static ColorInt glowColor
return ColorInt

glowRadius public static property

public static float glowRadius
return float

glowerComp public property

public CompGlower glowerComp
return CompGlower

highDangerAlarmSound public static property

public static SoundDef highDangerAlarmSound
return SoundDef

highDangerDrawingTick public static property

public static int highDangerDrawingTick
return int

lastUpdateTick public static property

public static int lastUpdateTick
return int

lowDangerAlarmSound public static property

public static SoundDef lowDangerAlarmSound
return SoundDef

lowDangerDrawingTick public static property

public static int lowDangerDrawingTick
return int

numberOfAlertSpeakers public static property

public static int numberOfAlertSpeakers
return int

powerComp public property

public CompPowerTrader powerComp
return CompPowerTrader

previousDangerRate public static property

public static StoryDanger previousDangerRate
return StoryDanger

sirenSoundDisabledIcon public property

public Texture2D,UnityEngine sirenSoundDisabledIcon
return UnityEngine.Texture2D

sirenSoundEnabledIcon public property

public Texture2D,UnityEngine sirenSoundEnabledIcon
return UnityEngine.Texture2D

soundIsActivated public static property

public static bool soundIsActivated
return bool