コード例 #1
0
 public void PowerNetworkUpdate()
 {
     //Logger.Log("humm...");
     if (!(CashOfConnectedDevices == ElectricalNodeControl.Node.InData.Data.ResistanceToConnectedDevices.Count))
     {
         CashOfConnectedDevices = ElectricalNodeControl.Node.InData.Data.ResistanceToConnectedDevices.Count;
         ConnectedDepartmentBatteries.Clear();
         foreach (var Device in ElectricalNodeControl.Node.InData.Data.ResistanceToConnectedDevices)
         {
             if (Device.Key.InData.Categorytype == PowerTypeCategory.DepartmentBattery)
             {
                 if (!(ConnectedDepartmentBatteries.Contains(Device.Key.GetComponent <DepartmentBattery>())))
                 {
                     ConnectedDepartmentBatteries.Add(Device.Key.GetComponent <DepartmentBattery>());
                 }
             }
         }
     }
     BatteryCharging = false;
     foreach (var bat in ConnectedDepartmentBatteries)
     {
         if (bat.BatterySupplyingModule.ChargingWatts > 0)
         {
             BatteryCharging = true;
         }
     }
     ElectricityFunctions.WorkOutActualNumbers(ElectricalNodeControl.Node.InData);
     SyncVoltage(voltageSync, ElectricalNodeControl.Node.InData.Data.ActualVoltage);
     Current = ElectricalNodeControl.Node.InData.Data.CurrentInWire;
     HandleDevices();
     UpdateDisplay();
 }
コード例 #2
0
 public void PowerNetworkUpdate()
 {
     //Logger.Log("humm...");
     if (!(CashOfConnectedDevices == ElectricalNodeControl.Node.Data.ResistanceToConnectedDevices.Count))
     {
         CashOfConnectedDevices = ElectricalNodeControl.Node.Data.ResistanceToConnectedDevices.Count;
         ConnectedDepartmentBatteries.Clear();
         foreach (KeyValuePair <ElectricalOIinheritance, HashSet <PowerTypeCategory> > Device in ElectricalNodeControl.Node.Data.ResistanceToConnectedDevices)
         {
             if (Device.Key.InData.Categorytype == PowerTypeCategory.DepartmentBattery)
             {
                 if (!(ConnectedDepartmentBatteries.Contains(Device.Key.GameObject().GetComponent <DepartmentBattery>())))
                 {
                     ConnectedDepartmentBatteries.Add(Device.Key.GameObject().GetComponent <DepartmentBattery> ());
                 }
             }
         }
     }
     BatteryCharging = false;
     foreach (var bat in ConnectedDepartmentBatteries)
     {
         if (bat.BatterySupplyingModule.ChargingWatts > 0)
         {
             BatteryCharging = true;
         }
     }
     Voltage = ElectricalNodeControl.Node.Data.ActualVoltage;
     Current = ElectricalNodeControl.Node.Data.CurrentInWire;
     HandleDevices();
     UpdateDisplay();
 }
コード例 #3
0
    public override void _PowerNetworkUpdate()
    {
        if (!(CashOfConnectedDevices == powerSupply.Data.ResistanceToConnectedDevices.Count))
        {
            CashOfConnectedDevices = powerSupply.Data.ResistanceToConnectedDevices.Count;
            ConnectedDepartmentBatteries.Clear();
            foreach (KeyValuePair <ElectricalOIinheritance, HashSet <PowerTypeCategory> > Device in powerSupply.Data.ResistanceToConnectedDevices)
            {
                if (Device.Key.InData.Categorytype == PowerTypeCategory.DepartmentBattery)
                {
                    if (!(ConnectedDepartmentBatteries.Contains(Device.Key.GameObject().GetComponent <DepartmentBattery>())))
                    {
                        ConnectedDepartmentBatteries.Add(Device.Key.GameObject().GetComponent <DepartmentBattery> ());
                    }
                }
            }
        }

        Voltage = powerSupply.Data.ActualVoltage;
        Current = powerSupply.Data.CurrentInWire;
        UpdateLights();
        if (dirtyResistance)
        {
            ResistanceClass.Ohms = Resistance;
            ElectricalSynchronisation.ResistanceChange.Add(this);
            dirtyResistance = false;
        }
    }