コード例 #1
0
 public void DropItem(PickupInteraction item, bool is_attached)
 {
     if (item != null)
     {
         // Not in the inventory anymore
         RemoveItem(item);
         // Make the item visible
         item.SetHolstered(false);
         item.SetVisible(true);
         // Drop it!
         item.Detach();
     }
 }
コード例 #2
0
    private HolsterResult DoHolsterMainHand()
    {
        if (in_hands == null || in_hands.IsHolstered())
        {
            return(HolsterResult.Invalid);
        }
        switch (in_hands.GetItemSize())
        {
        case ItemSize.Small:
            Debug.Log("Stash to inventory: " + in_hands.gameObject.name);
            // Item is holstered and hidden
            in_hands.SetHolstered(true);
            in_hands.SetVisible(false);
            // Item is selected
            active_item = in_hands;
            AttachToRightHand(in_hands);
            // Hand is empty now, but do not detach
            in_hands = null;
            return(HolsterResult.Success);

        case ItemSize.Large:
            if (on_back == null)
            {
                Debug.Log("Holster to back: " + in_hands.gameObject.name);
                // Item is holstered, but visible
                in_hands.SetHolstered(true);
                in_hands.SetVisible(true);
                // Item is on back
                on_back = in_hands;
                AttachToBack(in_hands);
                // Hand is empty now, but do not detach
                in_hands = null;
                return(HolsterResult.Success);
            }
            else
            {
                // Do not holster, but also do not do anything else
                return(HolsterResult.Blocked);
            }

        case ItemSize.Bulky:
        case ItemSize.Case:
            // Do not holster, but also do not do anything else
            return(HolsterResult.Blocked);

        default:
            Debug.Log("Unsupported");
            break;
        }
        return(HolsterResult.Invalid);
    }
コード例 #3
0
 private void PutOnBack(PickupInteraction item)
 {
     // Save to inventory
     Debug.Log("Picked up to back:" + item.gameObject.name);
     // Item is neither selected nor in the hand,
     // but the attachment needs to be done anyway
     AttachToBack(item);
     on_back = item;
     if (item == in_hands)
     {
         in_hands = null;
     }
     // Make the item holstered, but visible
     item.SetHolstered(true);
     item.SetVisible(true);
 }
コード例 #4
0
 private void PutInHand(PickupInteraction item)
 {
     // Save to inventory
     Debug.Log("Picked up to hand:" + item.gameObject.name);
     // Item is selected and in the hand now
     in_hands    = item;
     active_item = item;
     if (item == on_back)
     {
         on_back = null;
     }
     AttachToRightHand(item);
     // Make the item visible
     item.SetHolstered(false);
     item.SetVisible(true);
 }
コード例 #5
0
 private void PutInInventory(PickupInteraction item)
 {
     // Save to inventory
     Debug.Log("Picked up to inventory:" + item.gameObject.name);
     // Item is neither selected nor in the hand,
     // but the attachment needs to be done anyway
     AttachToRightHand(item);
     if (item == on_back)
     {
         on_back = null;
     }
     if (item == in_hands)
     {
         in_hands = null;
     }
     // Make the item invisible
     item.SetHolstered(true);
     item.SetVisible(false);
 }