IEnumerator Spawn() { yield return(new WaitForSeconds(_setupTime)); while (true) { while (StateController.IsPaused) { yield return(null); } GameObject collectable = Instantiate(_collectablePrefab); CollectableEnum type = RandomCollectable(); collectable.GetComponent <Collectable>().SetType(type, InventoryManager.Instance._collectableIconsDictionary[type]); collectable.transform.position = new Vector3(Random.Range(-5, 5), Random.Range(-4, 2), 0); yield return(new WaitForSeconds(_spawnTime)); } }
public void AddCollectable(CollectableEnum type) { _collectableAmountDictionary[type]++; }
public void ReceivedCollectable(CollectableEnum typeOfCollectable) { InventoryManager.Instance.AddCollectable(typeOfCollectable); SoundEffectService.Instance.PlayClip(ClipIdentifier.ItemsCollect); }