예제 #1
0
 public void PowerNetworkUpdate(float Voltage)     //Could be optimised to not update when voltage is same as previous voltage
 {
     if (Powered != null)
     {
         if (AdvancedControlToScript)
         {
             Powered.PowerNetworkUpdate(Voltage);
         }
         else
         {
             if (Voltage <= 1)
             {
                 State = PowerStates.Off;
             }
             else if (Voltage > MaximumWorkingVoltage)
             {
                 State = PowerStates.OverVoltage;
             }
             else if (Voltage < MinimumWorkingVoltage)
             {
                 State = PowerStates.LowVoltage;
             }
             else
             {
                 State = PowerStates.On;
             }
             Powered.StateUpdate(State);
         }
     }
 }
예제 #2
0
 private void EnsureInit()
 {
     if (Powered != null)
     {
         return;
     }
     Powered = GetComponent <IAPCPowered>();
     if (Powered == null)
     {
         return;
     }
     if (SelfPowered)
     {
         if (AdvancedControlToScript)
         {
             Powered.PowerNetworkUpdate(ExpectedRunningVoltage);
         }
         else
         {
             Powered.StateUpdate(PowerStates.On);
         }
     }
 }