Пример #1
0
 /// <summary>
 /// Check if the item is pickable and if yes, proceeds with triggering the effects and disabling the object
 /// </summary>
 public virtual void PickItem(GameObject picker)
 {
     if (CheckIfPickable())
     {
         Effects();
         PickableItemEvent.Trigger(this);
         Pick();
         if (DisableObjectOnPick)
         {
             // we desactivate the gameobject
             gameObject.SetActive(false);
         }
         else
         {
             if (DisableColliderOnPick)
             {
                 _collider.enabled = false;
             }
             if (DisableRendererOnPick && (_renderer != null))
             {
                 _renderer.enabled = false;
             }
         }
     }
 }
Пример #2
0
 /// <summary>
 /// Check if the item is pickable and if yes, proceeds with triggering the effects and disabling the object
 /// </summary>
 public virtual void PickItem()
 {
     if (CheckIfPickable())
     {
         Effects();
         PickableItemEvent.Trigger(this);
         Pick();
         if (DisableObjectOnPick)
         {
             // we desactivate the gameobject
             gameObject.SetActive(false);
         }
     }
 }