AlertSpeaker.Building_AlertSpeaker.Tick C# (CSharp) Method

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
        public override void Tick()
        {
            if (CheckIfSupportingWallIsAlive(this.Position, this.Rotation) == false)
            {
                this.Destroy(DestroyMode.Deconstruct);
            }
            base.Tick();

            int tickCounter = Find.TickManager.TicksGame;
            if (lastUpdateTick != tickCounter)
            {
                // The following treatment is performed only once per tick (static treatment).
                lastUpdateTick = tickCounter;
                if ((tickCounter % (2 * GenTicks.TicksPerRealSecond)) == 0)
                {
                    DisplayActiveMote();
                }

                if ((tickCounter % GenTicks.TicksPerRealSecond) == 0)
                {
                    previousDangerRate = currentDangerRate;
                    currentDangerRate = Find.StoryWatcher.watcherDanger.DangerRating;
                    PerformTreatmentOnDangerRateTransition();
                }
                PerformSoundTreatment();
                ComputeDrawingParameters();
            }

            // Update for each speaker.
            if ((tickCounter % GenTicks.TicksPerRealSecond) == 0)
            {
                if (powerComp.PowerOn)
                {
                    PerformTreatmentDuringAlert();
                }
            }
            PerformDrawingTreatment();
        }