public override void PowerUpdateCurrentChange() { if (ControllingNode.Node.Data.SupplyDependent[ControllingNode.Node.gameObject.GetInstanceID()].ResistanceComingFrom.Count > 0) { if (!(SlowResponse && PullingWatts == 0)) { ControllingNode.Node.FlushSupplyAndUp(ControllingNode.Node.gameObject); //Room for optimisation CircuitResistance = ElectricityFunctions.WorkOutResistance(ControllingNode.Node.Data.SupplyDependent[ControllingNode.Node.gameObject.GetInstanceID()].ResistanceComingFrom); // //!! VoltageAtChargePort = ElectricityFunctions.WorkOutVoltageFromConnector(ControllingNode.Node, ResistanceSourceModule.ReactionTo.ConnectingDevice); VoltageAtSupplyPort = ElectricityFunctions.WorkOutVoltageFromConnectors(ControllingNode.Node, ControllingNode.CanConnectTo); BatteryCalculation.PowerUpdateCurrentChange(this); if (current != Previouscurrent) { if (Previouscurrent == 0 && !(current <= 0)) { } else if (current == 0 && !(Previouscurrent <= 0)) { ControllingNode.Node.FlushSupplyAndUp(ControllingNode.Node.gameObject); } ControllingNode.Node.Data.SupplyingCurrent = current; Previouscurrent = current; } } } else { CircuitResistance = 999999999999; } PowerSupplyFunction.PowerUpdateCurrentChange(this); }
public override void PowerUpdateStructureChangeReact() { PowerSupplyFunction.PowerUpdateStructureChangeReact(this); ElectricalSynchronisation.NUStructureChangeReact.Add(ControllingNode); ElectricalSynchronisation.NUResistanceChange.Add(ControllingNode); ElectricalSynchronisation.NUCurrentChange.Add(ControllingNode); }
public override void PowerUpdateStructureChangeReact() { PowerSupplyFunction.PowerUpdateStructureChangeReact(this); var sync = ElectricalManager.Instance.electricalSync; sync.NUResistanceChange.Add(ControllingNode); sync.NUCurrentChange.Add(ControllingNode); }
public override void TurnOffSupply() { if (InternalResistance > 0) { foreach (PowerTypeCategory Connecting in ControllingNode.CanConnectTo) { ControllingNode.RestoreResistance(Connecting); } } ElectricalSynchronisation.NUResistanceChange.Add(ControllingNode); PowerSupplyFunction.TurnOffSupply(this); }
public override void TurnOnSupply() { if (InternalResistance > 0) { foreach (PowerTypeCategory Connecting in ControllingNode.CanConnectTo) { ControllingNode.OverlayInternalResistance(InternalResistance, Connecting); } ElectricalManager.Instance.electricalSync.NUResistanceChange.Add(ControllingNode); } PowerSupplyFunction.TurnOnSupply(this); }
public override void TurnOffSupply() { if (InternalResistance > 0) { foreach (PowerTypeCategory Connecting in ControllingNode.CanConnectTo) { ControllingNode.RestoreResistance(Connecting); } } if (ElectricalManager.Instance?.electricalSync?.NUResistanceChange != null) { ElectricalManager.Instance.electricalSync.NUResistanceChange.Add(ControllingNode); } PowerSupplyFunction.TurnOffSupply(this); }
public override void TurnOffSupply() { if (InternalResistance > 0) { foreach (PowerTypeCategory Connecting in ControllingNode.CanConnectTo) { ControllingNode.RestoreResistance(Connecting); } } // On some transitional scenes like the DontDestroyOnLoad scene, we don't have an ElectricalManager. // We should not try to update it in those cases. if (ElectricalManager.Instance?.electricalSync?.NUResistanceChange != null) { ElectricalManager.Instance.electricalSync.NUResistanceChange.Add(ControllingNode); PowerSupplyFunction.TurnOffSupply(this); } }
public override void TurnOffSupply() { isOnForInterface = false; PowerSupplyFunction.TurnOffSupply(this); }
public override void TurnOnSupply() { isOnForInterface = true; PowerSupplyFunction.TurnOnSupply(this); }
public void PowerUpdateCurrentChange() { PowerSupplyFunction.PowerUpdateCurrentChange(this); }
public void PowerUpdateStructureChangeReact() { PowerSupplyFunction.PowerUpdateStructureChangeReact(this); }
public void TurnOffSupply() { PowerSupplyFunction.TurnOffSupply(this); }