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); }
private bool CanThrow(PickupInteraction item) { // Cannot throw? if (item == null || item.IsHolstered() || !item.IsVisible() || item.GetComponent <Rigidbody>() == null) // Throwing makes sense for physical objects only { Debug.Log("Throw aiming not possible"); return(false); } // TODO: Make a throwable property and check that, too return(true); }
private HolsterResult DoUnholsterBackItem() { // No item, or already unholstered? Cancel right now. if (on_back == null || !on_back.IsHolstered()) { return(HolsterResult.Invalid); } // Hand is already occupied? if (in_hands != null) { Debug.Log("Unsupported: Stash holstered item first"); return(HolsterResult.Blocked); } // Put item in main hand PutInHand(on_back); // We are good! return(HolsterResult.Success); }