public void DropItem()
 {
     if (held_item != null)
     {
         held_item.Drop();
         held_item = null;
     }
 }
Example #2
0
 public void DropItem()
 {
     if (carry_item != null)
     {
         carry_item.Drop();
     }
     carry_item      = null;
     take_item_timer = -0.2f;
 }
        public void TakeItem(CarryItem item)
        {
            if (item == held_item || take_item_timer < 0f)
            {
                return;
            }

            if (held_item != null)
            {
                DropItem();
            }

            held_item       = item;
            take_item_timer = -0.2f;
            item.Take(this);
        }
Example #4
0
        public bool CanTake(GameObject taker)
        {
            PlatformerCharacter player       = taker.GetComponent <PlatformerCharacter>();
            CarryItem           current_item = player.GetHoldingItem();

            if (current_item != null && item_type == current_item.item_type)
            {
                return(false);
            }

            if (take_timer >= -0.01f)
            {
                //Avoid taking back an item you just threw
                return(!throwing || last_bearer != taker);
            }

            return(false);
        }
Example #5
0
        public void TakeItem(CarryItem item)
        {
            if (take_item_timer < 0f)
            {
                return;
            }

            if (item.CanTake(gameObject))
            {
                if (!item.HasBearer())
                {
                    //Drop current and take new item
                    DropItem();
                    carry_item = item;
                    item.Take(this);
                    take_item_timer = -0.2f;
                }
            }
        }
Example #6
0
 void Start()
 {
     carry_item         = GetComponent <CarryItem>();
     carry_item.OnTake += OnTake;
     carry_item.OnDrop += OnDrop;
 }