예제 #1
0
    public void OnPickUp(ItemBase item)
    {
        if (!item._isInstantEffect)
        {
            if (CurrentItem != null)
            {
                CurrentItem.transform.parent = CurrentRoom.transform;

                /*
                 * var newPosition = transform.position + new Vector3(1.5f, 0, 0);
                 * if (newPosition.x < -4.7) {
                 *      newPosition = transform.position + new Vector3 (1.5f, 0, 0);
                 * } else if (newPosition.x > 4.6) {
                 *      newPosition = transform.position + new Vector3(-1.5f, 0, 0);
                 * }
                 */
                CurrentItem.transform.position = transform.position + new Vector3(1.5f, 0, 0);
                CurrentItem.Enable();
            }
            //StartCoroutine(PlayPickUpAnimation(item));
            item.transform.parent = transform.parent;
            item.Disable();
            CurrentItem = item;
        }
        else
        {
            var usedItem = item.UseItem(this);

            if (usedItem)
            {
                item.Disable();
                //StartCoroutine (DestroyItem (item));
            }
        }
    }
예제 #2
0
파일: Player.cs 프로젝트: gkjolin/Isac
 public void OnPickUp(ItemBase item)
 {
     if (!item.IsInstantEffect)
     {
         if (CurrentItem != null)
         {
             CurrentItem.transform.parent   = transform.parent;
             CurrentItem.transform.position = transform.position + new Vector3(1.0f, 0, 0);
             CurrentItem.Enable();
         }
         StartCoroutine(PlayPickUpAnimation(item));
         CurrentItem = item;
     }
     else
     {
         item.UseItem(this);
         item.Disable();
         StartCoroutine(DestroyItem(item));
     }
 }