Beispiel #1
0
 public void OnRelease()
 {
     InPool = true;
     if (InfoWindow != null)
     {
         InfoWindow.Close.onClick.Invoke();
     }
     if (_data.drones != null)
     {
         _data.drones.ReSort();
         while (_data.drones.Count > 0)
         {
             ((Drone)_data.drones.GetMin(false)).SelfDestruct();
         }
     }
     _data = null;
     SimManager.AllHubs.Remove(this);
     gameObject.SetActive(false);
     transform.SetParent(PC().PoolParent);
     if (!(_jobGenerator is null))
     {
         StopCoroutine(_jobGenerator.Generate());
     }
     _jobGenerator = null;
     _router       = null;
 }
Beispiel #2
0
        public void OnGet(Transform parent = null)
        {
            InPool    = false;
            UID       = ++Count;
            _data     = new HubData(this);
            logPath   = Path.Combine(DataLogger.LogPath, $"{Name} Log.csv");
            dataCache = "";
            BatteryManager.ChargeCountJobHandle.Complete();
            _accessIndex = ChargingBatteryCounts.Length;
            ChargingBatteryCounts.Add(new ChargeCount
            {
                Count = 0,
                Uid   = UID
            });

            SimManager.AllHubs.Add(UID, this);
            transform.SetParent(parent);
            gameObject.SetActive(true);
            _jobGenerator = new JobGenerator(this, JobGenerationRate);
            StartCoroutine(_jobGenerator.Generate());
            DataLogger.LogHub(this);
        }