Inheritance: MonoBehaviour
Beispiel #1
0
 public static void OnDestroy(IUseable self, Useable useable)
 {
     if ((useable != null) && useable.occupied)
     {
         useable.Eject();
     }
 }
        public static EgoComponent GenerateGun()
        {
            EntityBuilder entity = EntityBuilder.Generate().WithPhysics(typeof(BoxCollider2D), .5f).WithGraphics("Images/gun");
            Interactive   c      = Ego.AddComponent <Interactive>(entity);

            c.InteractAction = e => EgoEvents <AttachEvent> .AddEvent(new AttachEvent(c.GetComponent <EgoComponent>(), e));

            Ego.AddComponent <Mountpoint>(entity);
            Useable u = Ego.AddComponent <Useable>(entity);

            u.UseAction = e => {
                Transform transform = u.transform;
                double    theta     = transform.rotation.eulerAngles.z * Mathf.Deg2Rad;
                Vector2   force     = new Vector2((float)Math.Cos(theta), (float)Math.Sin(theta));
                force.Normalize();
                // generate new projectile, add motion in direction at speed

                EgoComponent bullet = Ego.AddGameObject(GenerateBullet().gameObject);
                bullet.transform.rotation = transform.rotation;
                bullet.transform.position = transform.position;
                bullet.gameObject.SetActive(true);
                EgoEvents <SetVelocityByEvent> .AddEvent(new SetVelocityByEvent(bullet, force));
            };
            return(entity);
        }
Beispiel #3
0
        private void transformer1_DataPop(Useable[] data)
        {
            this._GlobalTrain = data[0];
            this._GlobalTest  = data[1];

            this._Enumerator = this.enumerate_folds(this._GlobalTrain._CountRows).GetEnumerator();
            this.enumerate_pop();
        }
Beispiel #4
0
 public static bool ThrewException(this UseResponse response, out Exception e, bool doNotClear)
 {
     if ((int)response >= -16 && (int)response <= -10)
     {
         return(Useable.GetLastException(out e, doNotClear));
     }
     e = null;
     return(false);
 }
Beispiel #5
0
 public void UseItem()
 {
     item.OnUse(this);
     Destroy(item.gameObject);
     item = null;
     GameManager.instance.uiManager.SetItemImage(null);
     audioSource.clip = pickUp;
     audioSource.Play();
 }
    public void AssignItem(GameObject item)
    {
        myUseable = item.GetComponent <Useable>();

        myUseable.transform.position = spotForItem.position;
        myUseable.transform.rotation = spotForItem.rotation;

        myLabel.text = myUseable.displayName;
    }
Beispiel #7
0
 public static bool ThrewException <E>(this UseResponse response, out E e, bool doNotClear) where E : Exception
 {
     if ((((int)response) >= -16) && (((int)response) <= -10))
     {
         return(Useable.GetLastException <E>(out e, doNotClear));
     }
     e = null;
     return(false);
 }
Beispiel #8
0
 void PickItem()
 {
     _hasItem    = true;
     _pickedItem = _seenUsable.gameObject;
     _pickedItem.GetComponent <Rigidbody>().useGravity = false;
     _currentPickable = (Pickable)_seenUsable;
     _currentPickable.UnHighlightItem();
     _seenUsable           = null;
     stopLerpingPickedItem = false;
 }
    // Update is called once per frame
    void Update()
    {
        // WASD to move
        Vector3   inputVector  = new Vector3(Input.GetAxis("Horizontal"), 0, Input.GetAxis("Vertical"));
        Rigidbody ourRigidBody = GetComponent <Rigidbody>();

        ourRigidBody.velocity = inputVector * speed;

        // Map cursor to playing plane
        Ray   rayFromCameraToCursor = Camera.main.ScreenPointToRay(Input.mousePosition);
        Plane playerPlane           = new Plane(Vector3.up, transform.position);

        playerPlane.Raycast(rayFromCameraToCursor, out float distanceFromCamera);
        Vector3 cursorPosition = rayFromCameraToCursor.GetPoint(distanceFromCamera);

        // Look at target position before moving
        Vector3 lookAtPosition = cursorPosition;

        transform.LookAt(lookAtPosition);

        // Click to fire
        if (mainWeapon != null && Input.GetButton("Fire1"))
        {
            mainWeapon.Fire(cursorPosition);
        }

        // Change weapon
        if (Input.GetButtonDown("Fire2"))
        {
            SwitchWeapon();
        }

        // Use the nearest usable
        if (Input.GetButtonDown("Use"))
        {
            Useable nearestUseable  = null;
            float   nearestDistance = 3; // Max pickup distance

            foreach (var thisUseable in References.useables)
            {
                float thisDistance = Vector3.Distance(transform.position, thisUseable.transform.position);
                if (thisDistance <= nearestDistance)
                {
                    nearestUseable  = thisUseable;
                    nearestDistance = thisDistance;
                }
            }

            if (nearestUseable != null)
            {
                nearestUseable.Use();
            }
        }
    }
Beispiel #10
0
    void OnTriggerEnter(Collider other)
    {
        Useable u = other.gameObject.GetComponent <Useable>();

        if (u is Unlocked)
        {
            u.CanBeUsed = true;
            u.HighlightItem();
            readyToCut.Add(u);
        }
    }
Beispiel #11
0
    void OnTriggerExit(Collider other)
    {
        Useable u = other.gameObject.GetComponent <Useable>();

        if (u is Unlocked)
        {
            u.CanBeUsed = false;
            u.UnHighlightItem();
            readyToCut.Remove(u);
        }
    }
Beispiel #12
0
 public void DropItem()
 {
     item.transform.position = this.transform.position;
     item.gameObject.SetActive(true);
     item.transform.SetParent(GameManager.instance.rooms[GameManager.instance.roomIndex].transform);
     GameManager.instance.combatLog.PostUpdate(characterName + " dropped " + item.itemName);
     item             = null;
     audioSource.clip = pickUp;
     audioSource.Play();
     GameManager.instance.uiManager.SetItemImage(null);
 }
Beispiel #13
0
 public void OnClick()
 {
     //so we can use our spells
     //if slot on action bar is not empty
     if (Useable != null)
     {
         Useable.Use();
     }
     else
     {
         Debug.Log("Useable is equal to null");
     }
 }
Beispiel #14
0
 static Equipment()
 {
     Equipment.equipped     = Point2.NONE;
     Equipment.useable      = null;
     Equipment.model        = null;
     Equipment.id           = -1;
     Equipment.busy         = false;
     Equipment.setup        = true;
     Equipment.ticking      = false;
     Equipment.lastEquip    = Single.MinValue;
     Equipment.ready        = false;
     Equipment.startedEquip = Single.MinValue;
 }
Beispiel #15
0
 public void Start()
 {
     if (base.networkView.isMine)
     {
         Equipment.equipped  = Point2.NONE;
         Equipment.useable   = null;
         Equipment.model     = null;
         Equipment.id        = -1;
         Equipment.busy      = false;
         Equipment.ticking   = false;
         Equipment.lastEquip = Single.MinValue;
         Equipment.ready     = true;
         Equipment.setup     = true;
     }
 }
Beispiel #16
0
 public static void equip(int x, int y)
 {
     if (!Player.life.dead && !Equipment.busy && Equipment.setup && (double)(Time.realtimeSinceStartup - Equipment.lastEquip) > 0.2 && !Movement.isSwimming && !Movement.isClimbing && !Movement.isDriving)
     {
         Equipment.lastEquip = Time.realtimeSinceStartup;
         if ((Equipment.equipped.x != x || Equipment.equipped.y != y) && x >= 0 && x < Player.inventory.width && y >= 0 && y < Player.inventory.height && Player.inventory.items[x, y].id != -1 && ItemEquipable.getEquipable(Player.inventory.items[x, y].id))
         {
             Equipment.dequip();
             Equipment.equipped = new Point2(x, y);
             Equipment.id       = Player.inventory.items[x, y].id;
             Player.clothes.changeItem(Equipment.id, Player.inventory.items[x, y].state);
             Equipment.model      = (GameObject)UnityEngine.Object.Instantiate(Resources.Load(string.Concat("Prefabs/Viewmodels/", Equipment.id)));
             Equipment.model.name = Equipment.id.ToString();
             if (Equipment.id == 7004 || Equipment.id == 7014)
             {
                 Equipment.model.transform.parent = Viewmodel.model.transform.FindChild("skeleton").FindChild("leftRoot").FindChild("leftShoulder").FindChild("leftUpper").FindChild("leftLower").FindChild("leftHand");
             }
             else
             {
                 Equipment.model.transform.parent = Viewmodel.model.transform.FindChild("skeleton").FindChild("rightRoot").FindChild("rightShoulder").FindChild("rightUpper").FindChild("rightLower").FindChild("rightHand");
             }
             Equipment.model.transform.localPosition = Vector3.zero;
             Equipment.model.transform.localRotation = Quaternion.identity;
             Equipment.model.transform.localScale    = new Vector3(1f, 1f, 1f);
             Equipment.useable = (Useable)Player.model.AddComponent(Equipment.model.GetComponent <Useable>().GetType());
             UnityEngine.Object.Destroy(Equipment.model.GetComponent <Useable>());
             GameObject gameObject = (GameObject)Resources.Load(string.Concat("Models/Animations/FirstPerson/Items/", ItemAnimations.getSource(Equipment.id), "/model"));
             string[]   animations = ItemAnimations.getAnimations(Equipment.id);
             for (int i = 0; i < (int)animations.Length; i++)
             {
                 Viewmodel.model.animation.AddClip(gameObject.animation.GetClip(animations[i]), animations[i]);
             }
             Equipment.startedEquip = Time.realtimeSinceStartup;
             Equipment.setup        = false;
             Equipment.ready        = false;
             Equipment.model.transform.FindChild("model").renderer.enabled = false;
             if (!Network.isServer)
             {
                 Player.model.networkView.RPC("equipServer", RPCMode.Server, new object[] { x, y, Equipment.id });
             }
         }
         else
         {
             Equipment.dequip();
         }
     }
 }
        public static EgoComponent GenerateLaserGun()
        {
            EntityBuilder entity = EntityBuilder.Generate().WithPhysics(typeof(BoxCollider2D), .5f).WithGraphics("Images/gun");
            Interactive   c      = Ego.AddComponent <Interactive>(entity);

            c.InteractAction = e => EgoEvents <AttachEvent> .AddEvent(new AttachEvent(c.GetComponent <EgoComponent>(), e));

            Ego.AddComponent <Mountpoint>(entity);
            Useable u = Ego.AddComponent <Useable>(entity);

            u.UseAction = e => {
                //RaycastHit2D clicked = Physics2D.Raycast (transform.position, transform.right);
                Transform transform = u.transform;
                Debug.DrawRay(transform.position, transform.right, Color.red, 100, false);
            };
            return(entity);
        }
Beispiel #18
0
 public void Update()
 {
     if (triggerbot)
     {
         ItemAsset ia = Information.player.equipment.asset;
         Useable   us = Information.player.equipment.useable;
         if (Information.player.equipment.isSelected && ia != null && ia is ItemWeaponAsset)
         {
             RaycastHit hit;
             if (Tool.getLookingAt(out hit, (wepDistance ? ((ItemWeaponAsset)ia).range : distance)))
             {
                 if ((trig_players && DamageTool.getPlayer(hit.transform)) || (trig_zombies && DamageTool.getZombie(hit.transform)) || (trig_animal && DamageTool.getAnimal(hit.transform)))
                 {
                     attack(ia, Tool.getDistance(hit.transform.position));
                 }
             }
         }
     }
 }
Beispiel #19
0
    void PickupItem()
    {
        if (itemToPickup.GetType() == typeof(Weapon))
        {
            if (!weapon)
            {
                audioSource.clip = pickUp;
                audioSource.Play();
                weapon = itemToPickup.GetComponent <Weapon>();
                itemToPickup.gameObject.SetActive(false);
                itemToPickup.transform.parent = transform;

                damage      = weapon.damage;
                attackRange = weapon.range;
                GameManager.instance.uiManager.SetWeaponImage(weapon.icon);

                GameManager.instance.combatLog.PostUpdate(characterName + " picked up " + weapon.itemName);

                spikedBatObject.SetActive(weapon.type == Weapon.Types.SPIKEDBAT);
                branchObject.SetActive(weapon.type == Weapon.Types.BRANCH);
                fireAxe.SetActive(weapon.type == Weapon.Types.FIREAXE);


                return;
            }
        }
        else if (itemToPickup.GetType() == typeof(Useable))
        {
            if (!item)
            {
                audioSource.clip = pickUp;
                audioSource.Play();
                item = itemToPickup.GetComponent <Useable>();
                itemToPickup.gameObject.SetActive(false);
                itemToPickup.transform.parent = transform;
                GameManager.instance.uiManager.SetItemImage(item.icon);

                GameManager.instance.combatLog.PostUpdate(characterName + " picked up " + item.itemName);
                return;
            }
        }
    }
Beispiel #20
0
        /// <summary>
        /// Checks to see if item is <see cref="Useable"/>, then executes its <c>use()</c> method.
        /// </summary>
        /// <param name="i"> The element of inventory that will be used</param>
        /// <param name="isConsumeable">is set if used item is consumeable</param>
        /// <returns>
        /// <list type="bullet">
        /// <item> true - The item was useable and its use fucntion was executed</item>
        /// <item> false - The item is not useable</item>
        /// </list>
        /// </returns>
        public bool use(int i, Combatant target, out bool isConsumeable)
        {
            Useable item = get(i) as Useable;

            isConsumeable = false;
            if (item == null)
            {
                return(false);
            }

            item.use(target);

            item = get(i) as Consumable;
            if (item != null)
            {
                remove(i);
                isConsumeable = true;
            }

            return(true);
        }
 public LootStartEvent(LootableObject lo, Fougerite.Player player, Useable use, uLink.NetworkPlayer nplayer)
 {
     _lo     = lo;
     _ue     = use;
     _player = player;
     _np     = nplayer;
     foreach (Collider collider in Physics.OverlapSphere(lo._inventory.transform.position, 1.2f))
     {
         if (collider.GetComponent <DeployableObject>() != null)
         {
             _entity   = new Entity(collider.GetComponent <DeployableObject>());
             _isobject = true;
             break;
         }
         if (collider.GetComponent <LootableObject>() != null)
         {
             _entity   = new Entity(collider.GetComponent <LootableObject>());
             _isobject = false;
             break;
         }
     }
 }
Beispiel #22
0
 public void hideSpread()
 {
     if (Information.player == null || Information.player.equipment == null)
     {
         return;
     }
     if (Information.player.equipment.isSelected)
     {
         ItemAsset ia = Information.player.equipment.asset;
         Useable   us = Information.player.equipment.useable;
         if (ia == null || us == null)
         {
             return;
         }
         if (ia is ItemGunAsset && us is UseableGun)
         {
             typeof(ItemGunAsset).GetField("_spreadAim", BindingFlags.NonPublic | BindingFlags.Instance).SetValue(ia, getOriginal(ia.hash).spreadAim);
             typeof(ItemGunAsset).GetField("_spreadHip", BindingFlags.NonPublic | BindingFlags.Instance).SetValue(ia, getOriginal(ia.hash).spreadHip);
             typeof(UseableGun).GetMethod("updateCrosshair", BindingFlags.NonPublic | BindingFlags.Instance).Invoke(Information.player.equipment.useable, new object[0]);
         }
     }
 }
Beispiel #23
0
    public void equipServer(int slotX, int slotY, int itemId)
    {
        Inventory inventory = base.GetComponent <Inventory>();

        if ((slotX != -1 || itemId != -1) && inventory.items[slotX, slotY].id != itemId)         // WTF?
        {
            NetworkTools.kick(base.networkView.owner, string.Concat("Kicking ", base.name, " for hacking items."));
        }
        else
        {
            Useable useable = base.GetComponent <Useable>();
            if (useable != null)
            {
                UnityEngine.Object.Destroy(useable);
            }
            if (itemId != -1)
            {
                GameObject gameObject = (GameObject)Resources.Load(string.Concat("Prefabs/Viewmodels/", itemId));
                base.gameObject.AddComponent(gameObject.GetComponent <Useable>().GetType());
            }
        }
    }
Beispiel #24
0
    void LookAhead()
    {
        Useable    selectedUsable;
        RaycastHit hit;

        bool hitOccured = Physics.Raycast(CenterEyeAnchor.transform.position, CenterEyeAnchor.transform.forward, out hit, MaxSightDistance);

        selectedUsable = hitOccured ? hit.collider.gameObject.GetComponents <Useable>().FirstOrDefault(x => x.enabled) : null;

        if (selectedUsable != _seenUsable)
        {
            if (_seenUsable != null)
            {
                _seenUsable.UnHighlightItem();
                _seenUsable = null;
            }
            if (selectedUsable != null)
            {
                _seenUsable = selectedUsable;
                _seenUsable.HighlightItem();
            }
        }
    }
        internal static void Normalize(
            Datas.Useable[] indata,
            out Datas.Useable[] outdata)
        {
            var train = indata[0];

            var train_means = train._Data.MeanRow();

            var new_train_data = train._Data.AddRow(-train_means);

            var stds = new_train_data.StandardDeviationRow(true);

            for (int i = 0; i < stds.Count; i++)
            {
                if ((stds[i] == 0) || float.IsNaN(stds[i]) || float.IsInfinity(stds[i]))
                {
                    stds[i] = 1;
                }
                else
                {
                    stds[i] = 1 / stds[i];
                }
            }

            new_train_data.MultiplyRowT(stds);

            outdata    = new Useable[indata.Length];
            outdata[0] = new Useable(new_train_data, train._Labels);

            for (int i = 1; i < indata.Length; i++)
            {
                var dat           = indata[i];
                var new_test_data = dat._Data.AddRow(-train_means);
                new_test_data.MultiplyRowT(stds);
                outdata[i] = new Useable(new_test_data, dat._Labels);
            }
        }
    void CheckUseables()
    {
        _thingToUse = null;
        // break if list is empty
        if (Useable.useables.Count == 0)
        {
            return;
        }
        // limit use angle? idk
        float closestAngle = maxUseAngle;

        foreach (Useable useable in Useable.useables)
        {
            useable.highlighted = false;
            Vector3    vFromCam      = useable.transform.position - _camera.transform.position;
            Quaternion rotFromCamera =
                Quaternion.FromToRotation(vFromCam, _camera.transform.forward);
            float useableAngle = Quaternion.Angle(rotFromCamera, Quaternion.identity);
            if (useableAngle < closestAngle)
            {
                // make sure we have los
                if (Physics.Raycast(_camera.transform.position, vFromCam, out RaycastHit hit, interactDistance, interactMask))
                {
                    if (hit.transform == useable.transform)
                    {
                        _thingToUse  = useable;
                        closestAngle = useableAngle;
                    }
                }
            }
        }

        if (_thingToUse)
        {
            _thingToUse.highlighted = true;
        }
    }
    private void Update()
    {
        if (myUseable != null && !myUseable.enabled)
        {
            // if usable is not enabled, player picked it up
            myUseable = null;
        }

        if (secondsToLock > 0 && References.alarmManager.AlarmHasSounded())
        {
            secondsToLock -= Time.deltaTime;

            if (secondsToLock <= 0)
            {
                cage.SetActive(true);
                myLabel.text = "ALARM";

                if (myUseable != null && myUseable.enabled)
                {
                    Destroy(myUseable);
                }
            }
        }
    }
Beispiel #28
0
    public static IEnumerator CheckTrigger()
    {
        for (; ;)
        {
            yield return(new WaitForSeconds(0.1f));

            bool flag = !TriggerbotOptions.Enabled || !DrawUtilities.ShouldRun() || OptimizationVariables.MainPlayer.stance.stance == EPlayerStance.SPRINT || OptimizationVariables.MainPlayer.stance.stance == EPlayerStance.CLIMB || OptimizationVariables.MainPlayer.stance.stance == EPlayerStance.DRIVING;
            if (flag)
            {
                TriggerbotOptions.IsFiring = false;
            }
            else
            {
                PlayerLook look     = OptimizationVariables.MainPlayer.look;
                Useable    u        = OptimizationVariables.MainPlayer.equipment.useable;
                Useable    useable  = u;
                Useable    useable2 = useable;
                if (useable2 == null)
                {
                    TriggerbotOptions.IsFiring = false;
                }
                else
                {
                    UseableGun   useableGun;
                    UseableGun   gun;
                    UseableMelee useableMelee;
                    if ((useableGun = (useable2 as UseableGun)) != null)
                    {
                        gun = useableGun;
                        ItemGunAsset PAsset = (ItemGunAsset)OptimizationVariables.MainPlayer.equipment.asset;
                        RaycastInfo  ri     = RaycastUtilities.GenerateOriginalRaycast(new Ray(look.aim.position, look.aim.forward), PAsset.range, RayMasks.DAMAGE_CLIENT);
                        if (AimbotCoroutines.LockedObject != null && AimbotCoroutines.IsAiming)
                        {
                            Ray r = OV_UseableGun.GetAimRay(look.aim.position, AimbotCoroutines.GetAimPosition(AimbotCoroutines.LockedObject.transform, "Skull"));
                            ri = RaycastUtilities.GenerateOriginalRaycast(new Ray(r.origin, r.direction), PAsset.range, RayMasks.DAMAGE_CLIENT);
                            r  = default(Ray);
                        }
                        bool Valid = ri.player == null;

                        if (RaycastOptions.Enabled)
                        {
                            Valid = RaycastUtilities.GenerateRaycast(out ri);
                        }
                        if (Valid)
                        {
                            TriggerbotOptions.IsFiring = false;
                            continue;
                        }
                        EFiremode fire  = (EFiremode)TriggerbotComponent.CurrentFiremode.GetValue(gun);
                        bool      flag4 = fire == EFiremode.AUTO;
                        if (flag4)
                        {
                            TriggerbotOptions.IsFiring = true;
                            continue;
                        }
                        TriggerbotOptions.IsFiring = !TriggerbotOptions.IsFiring;
                    }
                    else if ((useableMelee = (useable2 as UseableMelee)) != null)
                    {
                        ItemMeleeAsset MAsset = (ItemMeleeAsset)OptimizationVariables.MainPlayer.equipment.asset;
                        RaycastInfo    ri2    = RaycastUtilities.GenerateOriginalRaycast(new Ray(look.aim.position, look.aim.forward), MAsset.range, RayMasks.DAMAGE_CLIENT);
                        bool           flag5  = AimbotCoroutines.LockedObject != null && AimbotCoroutines.IsAiming;
                        if (flag5)
                        {
                            Ray r2 = OV_UseableGun.GetAimRay(look.aim.position, AimbotCoroutines.GetAimPosition(AimbotCoroutines.LockedObject.transform, "Skull"));
                            ri2 = RaycastUtilities.GenerateOriginalRaycast(new Ray(r2.origin, r2.direction), MAsset.range, RayMasks.DAMAGE_CLIENT);
                            r2  = default(Ray);
                        }
                        bool Valid2   = ri2.player != null;
                        bool enabled2 = RaycastOptions.Enabled;
                        if (enabled2)
                        {
                            Valid2 = RaycastUtilities.GenerateRaycast(out ri2);
                        }
                        bool flag6 = !Valid2;
                        if (flag6)
                        {
                            TriggerbotOptions.IsFiring = false;
                            continue;
                        }
                        bool isRepeated = MAsset.isRepeated;
                        if (isRepeated)
                        {
                            TriggerbotOptions.IsFiring = true;
                            continue;
                        }
                        TriggerbotOptions.IsFiring = !TriggerbotOptions.IsFiring;
                    }
                    useable2   = null;
                    useableGun = null;
                    gun        = null;
                    look       = null;
                    u          = null;
                }
            }
        }
        yield break;
    }
Beispiel #29
0
 public void Train(Useable indata)
 {
     this._Data = indata;
 }
Beispiel #30
0
    /// <summary>
    /// Display the item info
    /// </summary>
    /// <param name="newItem"></param>
    public void DisplayInfo(Item newItem)
    {
        ResetFields();  //reset the field
        item = newItem; //set the current item
        //set the item information
        image.sprite  = item.sprite;
        itemName.text = item.itemName;
        itemDesc.text = item.itemDesc;
        itemType.text = "Type: " + item.itemType.ToString();
        if (item.isSellable)
        {
            itemCost.text = "Price: " + item.baseItemCost;
        }
        else
        {
            itemCost.text = "Not Sellable";
        }
        //add switch/case here
        //Set fields based on the items type
        switch (item.itemType)
        {
        case Item.BaseType.Clothing:
            Clothing clothing = (Clothing)item;
            itemExtra2.text = "Protection: " + clothing.protection;
            break;

        case Item.BaseType.Consumable:
            Consumable consumable = (Consumable)item;
            if (consumable.healthRestored != 0 && consumable.energyRestored != 0)
            {
                itemExtra2.text = "Health Restored: " + consumable.healthRestored;
                itemExtra3.text = "Energy Restored: " + consumable.energyRestored;
            }
            else if (consumable.healthRestored == 0 && consumable.energyRestored != 0)
            {
                itemExtra2.text = "Energy Restored: " + consumable.energyRestored;
                itemExtra3.text = "";
            }
            else if (consumable.healthRestored != 0 && consumable.energyRestored == 0)
            {
                itemExtra2.text = "Health Restored: " + consumable.healthRestored;
                itemExtra3.text = "";
            }
            else
            {
                itemExtra2.text = "";
                itemExtra3.text = "";
            }
            break;

        case Item.BaseType.Key:
            Key key = (Key)item;
            break;

        case Item.BaseType.Misc:
            Misc misc = (Misc)item;
            break;

        case Item.BaseType.Useable:
            Useable useable = (Useable)item;
            break;

        case Item.BaseType.Weapon:
            Weapon weapon = (Weapon)item;
            itemExtra2.text = "Damage: " + weapon.attackValue;
            itemExtra3.text = "Durability: " + weapon.durability;
            break;
        }
    }