Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- if (currentInventoryItem != null) {
- SetToolTip (inventory[i]);
- if (GUI.Button (currentRect, new GUIContent("", currentToolTip), new GUIStyle ("label"))) {
- if (Event.current.button == 0 && Event.current.type == EventType.MouseDown) {
- Debug.Log ("MOUSE DOWN!");
- GUI.contentColor = Color.red;
- }
- if (Event.current.button == 0) {
- Debug.Log ("MOUSE UP!");
- if (currentInventoryItem.itemType == ItemType.Consumable) {
- // Use it
- bool success = UseItem (currentInventoryItem);
- if (success) {
- inventory[i] = null;
- SummarizeEquippedItemBonuses (); //
- }
- } else if (currentInventoryItem.itemType == ItemType.Clothing || currentInventoryItem.itemType == ItemType.Weapon) {
- // Equip it
- openLootWindow = false;
- openCharacterWindow = true;
- bool success = EquipItem (currentInventoryItem);
- if (success) {
- inventory[i] = null;
- SummarizeEquippedItemBonuses ();
- }
- }
- } else if (Input.GetMouseButtonUp (1)) { // ... if that click is mouse button 1: delete it.
- // Drop it
- Debug.Log ("Removing " + inventory[i].itemName + " from Inventory");
- // messageManager.Message ("Display01", "Removing " + inventory[i].itemName + " from Inventory", Color.yellow);
- // Optionally Instantiate the discarded object:
- if (inventory[i].itemObject) {
- Rigidbody clone;
- clone = (Rigidbody)Instantiate(inventory[i].itemObject, playerTransform.position +
- new Vector3 (Random.Range (-1.0f, 1.0f), 1.0f,Random.Range (-1.0f, 1.0f)),
- Quaternion.Euler(Random.Range (-15.0f, 15.0f),Random.Range (-15.0f, 15.0f),Random.Range (-15.0f, 15.0f)));
- // Optionally add a velocity to "clone", etc.
- clone.velocity = playerTransform.TransformDirection (Vector3.forward) * 2;
- }
- inventory[i] = null;
- }
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement