コード例 #1
0
 /// <summary>
 /// Update one of the loads from a deviceconnected to the powernet
 /// </summary>
 public void UpdateDevice(PowerDeviceComponent device, float oldLoad)
 {
     if (DeviceLoadList.Contains(device))
     {
         Load -= oldLoad;
         Load += device.Load;
     }
 }
コード例 #2
0
 /// <summary>
 /// Register a continuous load from a device connected to the powernet
 /// </summary>
 public void AddDevice(PowerDeviceComponent device)
 {
     DeviceLoadList.Add(device);
     Load += device.Load;
     if (!device.Powered)
     {
         DepoweredDevices.Add(device);
     }
 }
コード例 #3
0
        public override void Initialize()
        {
            base.Initialize();

            _userInterface = Owner.GetComponent <ServerUserInterfaceComponent>().GetBoundUserInterface(SolarControlConsoleUiKey.Key);
            _userInterface.OnReceiveMessage += UserInterfaceOnReceiveMessage;
            _powerDevice      = Owner.GetComponent <PowerDeviceComponent>();
            _powerSolarSystem = _entitySystemManager.GetEntitySystem <PowerSolarSystem>();
        }
コード例 #4
0
 /// <summary>
 ///     Remove a continuous load from a device connected to the powernet
 /// </summary>
 public void RemoveDevice(PowerDeviceComponent device)
 {
     if (DeviceLoadList.Contains(device))
     {
         Load -= device.Load;
         DeviceLoadList.Remove(device);
         if (DepoweredDevices.Contains(device))
         {
             DepoweredDevices.Remove(device);
         }
     }
     else
     {
         Logger.WarningS("power", "We tried to remove device {0} twice from {1}, somehow.", device.Owner, this);
     }
 }
コード例 #5
0
 /// <summary>
 /// Remove a continuous load from a device connected to the powernet
 /// </summary>
 public void RemoveDevice(PowerDeviceComponent device)
 {
     if (Deviceloadlist.Contains(device))
     {
         Load -= device.Load;
         Deviceloadlist.Remove(device);
         if (DepoweredDevices.Contains(device))
         {
             DepoweredDevices.Remove(device);
         }
     }
     else
     {
         var name = device.Owner.Prototype.Name;
         Logger.Log(String.Format("We tried to remove a device twice from the same powernet somehow, prototype {0}", name));
     }
 }
コード例 #6
0
 /// <summary>
 ///     Returns whether or not a power device is in this powernet's load list.
 /// </summary>
 /// <param name="device">The device to check for.</param>
 /// <returns>True if the device is in the load list, false otherwise.</returns>
 public bool HasDevice(PowerDeviceComponent device)
 {
     return(DeviceLoadList.Contains(device));
 }