private void TeslaCoilUpdate() { if (CustomNetworkManager.IsServer == false) { return; } if (CurrentState == TeslaCoilState.Grounding || IsWrenched == false) { return; } hitTimer--; if (hitTimer <= 0) { hitTimer = 0; hitRecently = false; if (generatedWatts != 0) { moduleSupplyingDevice.TurnOffSupply(); } } else { if (generatedWatts == 0) { moduleSupplyingDevice.TurnOnSupply(); } hitRecently = true; } if (CurrentState == TeslaCoilState.Power) { generatedWatts = hitRecently ? lightningHitWatts : 0; moduleSupplyingDevice.ProducingWatts = generatedWatts; if (hitRecently == false) { spriteHandler.ChangeSprite(1); } } else { //TODO generate research points generatedWatts = 0; if (hitRecently == false) { spriteHandler.ChangeSprite(3); } } }
private void OnDisable() { if (CustomNetworkManager.Instance._isServer == false) { return; } UpdateManager.Remove(CallbackType.PERIODIC_UPDATE, CycleUpdate); moduleSupplyingDevice?.TurnOffSupply(); }