Пример #1
0
 /// <summary>
 /// OnTriggerEnter is called when the Collider other enters the trigger.
 /// </summary>
 /// <param name="other">The other Collider involved in this collision.</param>
 void OnTriggerEnter(Collider other)
 {
     ItemSpawner.AddItem(itemSO, other.GetComponentInParent <CharacterStats>());
     if (itemSO.itemType == ItemType.Addictive)
     {
         FindObjectOfType <ItemSpawner>().RepeatableItems.Add(itemSO);
     }
     else if (itemSO.itemType == ItemType.Death)
     {
         EventManager.OnEndGameEvent();
     }
     Destroy(this.gameObject);
     FindObjectOfType <BarulhoItem>().GetComponent <AudioSource>().Play();
 }