コード例 #1
0
 /// <summary>
 /// Grabs PickableItem events
 /// </summary>
 /// <param name="pickableItemEvent"></param>
 public virtual void OnMMEvent(PickableItemEvent pickableItemEvent)
 {
     /*if (pickableItemEvent.PickedItem.GetComponent<InventoryEngineHealth>() != null)
      * {
      *      MMAchievementManager.UnlockAchievement ("Medic");
      * }*/
 }
コード例 #2
0
ファイル: PickableItem.cs プロジェクト: leonidas192/Iseng
        /// <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, picker);
                Pick(picker);
                if (DisableColliderOnPick)
                {
                    if (_collider != null)
                    {
                        _collider.enabled = false;
                    }
                    if (_collider2D != null)
                    {
                        _collider2D.enabled = false;
                    }
                }
                if (DisableModelOnPick && (Model != null))
                {
                    Model.gameObject.SetActive(false);
                }

                if (DisableObjectOnPick)
                {
                    // we desactivate the gameobject
                    if (DisableDelay == 0f)
                    {
                        this.gameObject.SetActive(false);
                    }
                    else
                    {
                        StartCoroutine(DisablePickerCoroutine());
                    }
                }
            }
        }