public override void OnCollected(Collectable.CollectionEventData eventData) { if (this.items.Count < this.MaxItems) { this.items.Enqueue(eventData.collectable); // note: we don't delete the object, we just move it to the list // and since that stack is not active it stops being active as well eventData.collectable.gameObject.transform.SetParent(collectedItems.transform); } }
/// <summary> /// Handles collection by calling <see cref="Debug.Log(object)"/> with the collected items name, and then destroys the item /// </summary> /// <param name="item">the eventData that represents the collection</param> public void OnCollected(Collectable.CollectionEventData eventData) { Debug.Log("Collected " + eventData.collectable.name); Destroy(eventData.collectable.gameObject); }
public abstract void OnCollected(Collectable.CollectionEventData eventData);