// Update is called once per frame void Update() { if (init && Time.time > lastReload + ReloadTime) { StorageManager.AddResource(resource_id, ResCount); FactoryDrop drop = Parent.GetDrop(); drop.SetData(resource_id, ResCount, Parent); Parent.AddToQueue(drop); lastReload = Time.time; } }
IEnumerator AddResource(int resource_id) { int[] resource_count = resources[resource_id]; while (true) { yield return(new WaitForSeconds(resource_count[1] / 1000.0f)); StorageManager.AddResource(resource_id, resource_count[0]); FactoryDrop drop = GetDrop(); drop.SetData(resource_id, resource_count[0], this); queue.Enqueue(drop); } }