Exemplo n.º 1
0
        public void InteractWith(Interactor interactor)
        {
            LNBPlayerCharacter interactorOwner = interactor.GetComponentInParent <LNBPlayerCharacter>();
            GameObject         item            = GetGameObject();

            if (!interactorOwner)
            {
                return;
            }

            switch (ItemType)
            {
            case EItemType.Weapon:

                BaseWeapon weapon = item.GetComponent <BaseWeapon>();

                if (!weapon)
                {
                    Debug.LogWarning(gameObject.name + " has an invalid item type!");

                    return;
                }

                interactorOwner.PickupWeapon(weapon);

                break;

            case EItemType.Gear:
                BaseGear gear = item.GetComponent <BaseGear>();

                if (!gear)
                {
                    Debug.LogWarning(gameObject.name + " has an invalid item type!");

                    return;
                }

                interactorOwner.PickUpGear(gear);
                break;

            case EItemType.Key:
                interactorOwner.PickUpKey(item);
                break;

            default:
                Debug.LogWarning(gameObject.name + " has an invalid item type!");
                break;
            }

            interactor.PickedUpObject(gameObject);

            Destroy(gameObject);
        }
Exemplo n.º 2
0
        public void PickUpGear(BaseGear gear)
        {
            // Make room for our new gear piece
            if (equippedGear)
            {
                DropEquippedGear();
            }

            equippedGear = gear;
            equippedGear.OnPickUp(this);

            // TODO: Make events so that the UI can listen to player status updates.
            // Update our UI
            GetComponentInChildren <UI.GearUI>().EquipNewGear(equippedGear.gameObject);
        }