private IEnumerator RefillAndSpawnCoroutine(LootStorage lootStorage) { foreach (var collider in Facepunch.MeshBatch.MeshBatchPhysics.OverlapSphere( transform.position, 2)) { if (collider.name.Contains("WoodBoxLarge")) { NetCull.Destroy(collider.gameObject); } } var loot = NetCull.InstantiateStatic(";deploy_wood_storage_large", transform.position, Quaternion.identity); var lootableObject = loot.GetComponent <LootableObject>(); FillWithItems(lootableObject, lootStorage.GetItems()); while (true) { var foundBox = false; foreach (var collider in Facepunch.MeshBatch.MeshBatchPhysics.OverlapSphere( transform.position, 2)) { if (collider.name.Contains("WoodBoxLarge")) { foundBox = true; break; } } if (!foundBox) { loot = NetCull.InstantiateStatic(";deploy_wood_storage_large", transform.position, Quaternion.identity); lootableObject = loot.GetComponent <LootableObject>(); } lootableObject._inventory.Clear(); FillWithItems(lootableObject, lootStorage.GetItems()); yield return(new WaitForSeconds(lootStorage.RefillSeconds)); } }
public IActionResult GetRandLoot() { _lootStorage = new LootStorage(); return(Ok(_lootStorage.randLoot())); }