public override void Initialize()
 {
     base.Initialize();
     Storage        = Owner.GetComponent <PowerStorageComponent>();
     Appearance     = Owner.GetComponent <AppearanceComponent>();
     _provider      = Owner.GetComponent <PowerProviderComponent>();
     _userInterface = Owner.GetComponent <ServerUserInterfaceComponent>().GetBoundUserInterface(ApcUiKey.Key);
     _userInterface.OnReceiveMessage += UserInterfaceOnOnReceiveMessage;
 }
Ejemplo n.º 2
0
 /// <summary>
 /// Remove a power supply from a generator connected to the powernet
 /// </summary>
 public void RemovePowerStorage(PowerStorageComponent storage)
 {
     if (PowerStorageSupplierlist.Contains(storage))
     {
         PowerStorageSupplierlist.Remove(storage);
     }
     if (PowerStorageConsumerlist.Contains(storage))
     {
         PowerStorageSupplierlist.Remove(storage);
     }
 }
Ejemplo n.º 3
0
 /// <summary>
 /// Register a power supply from a generator connected to the powernet
 /// </summary>
 public void AddPowerStorage(PowerStorageComponent storage)
 {
     if (storage.ChargePowernet)
     {
         PowerStorageSupplierList.Add(storage);
     }
     else
     {
         PowerStorageConsumerList.Add(storage);
     }
 }
Ejemplo n.º 4
0
        //How do I even call this? TODO: fix
        public void UpdateStorageType(PowerStorageComponent storage)
        {
            //If our chargepowernet settings change we need to tell the powernet of this new setting and remove traces of our old setting
            if (PowerStorageSupplierList.Contains(storage))
            {
                PowerStorageSupplierList.Remove(storage);
            }
            if (PowerStorageConsumerList.Contains(storage))
            {
                PowerStorageConsumerList.Remove(storage);
            }

            //Apply new setting
            if (storage.ChargePowernet)
            {
                PowerStorageSupplierList.Add(storage);
            }
            else
            {
                PowerStorageConsumerList.Add(storage);
            }
        }
Ejemplo n.º 5
0
 public override void Initialize()
 {
     base.Initialize();
     Storage    = Owner.GetComponent <PowerStorageComponent>();
     Appearance = Owner.GetComponent <AppearanceComponent>();
 }