public override void Tick() { base.Tick(); tickCount++; // Change power draw based on active status. UpdatePowerDraw(); // Update active/running state. bool oldActive = this.IsActive; UpdateActiveState(); if (oldActive != this.IsActive) { CompGlower?.ReceiveCompSignal("PowerTurnedOn"); // Obviously the power hasn't actually just been turned on, but it's just a way to trigger UpdateLit to be called. } if (!IsActive) { frameNumber = 0; activeGraphic = base.DefaultGraphic; return; } // Update output. UpdateOutput(); // Update active state visuals. UpdateActiveGraphics(); }
public override void Tick() { base.Tick(); bool isRunning = GetShouldBeRunning(); if (isRunning) { ProductionTicks++; if (ProductionTicks >= TicksToProduceOutput) { ProductionTicks = 0; // Delete fuel from comps. GetFuelComp(1).SetFuelLevel(0); GetFuelComp(2).SetFuelLevel(0); PlaceOutput(OutputAmount); } } if (lastFrameRunning != isRunning) { CompGlower?.ReceiveCompSignal("PowerTurnedOn"); // Obviously the power hasn't actually just been turned on, but it's just a way to trigger UpdateLit to be called. } lastFrameRunning = isRunning; }
private void StopFireLaser() { beam.IsActive = false; soundSustainer?.End(); // Turn off glow. CompGlower?.ReceiveCompSignal("PowerTurnedOn"); }
private void StartPowerUpSequence() { // Then enter the powering up phase. PoweringUpTicks = 0; // Remove antimatter fuel. At his point the firing cannot be cancelled. FuelComp.SetFuelLevel(0); // Play the long attack sound. SoundInfo info = SoundInfo.InMap(this, MaintenanceType.PerTick); soundSustainer = AADefOf.LaserStrike_AA.TrySpawnSustainer(info); // Do particle effects. chargeEffect?.Play(true); // Enable glow start. CompGlower?.ReceiveCompSignal("PowerTurnedOn"); }