Exemple #1
0
        public void OnPickup()
        {
            SeamothArmManager control      = ThisSeamoth.GetComponent <SeamothArmManager>();
            GameObject        activeTarget = control.GetActiveTarget();

            if (activeTarget)
            {
                Pickupable pickupable = activeTarget.GetComponent <Pickupable>();
                PickPrefab component  = activeTarget.GetComponent <PickPrefab>();

                ItemsContainer container = control.GetRoomForItem(pickupable);

                if (pickupable != null && pickupable.isPickupable && container != null)
                {
                    pickupable = pickupable.Initialize();
                    InventoryItem item = new InventoryItem(pickupable);
                    container.UnsafeAdd(item);
                    Utils.PlayFMODAsset(pickupSound, front, 5f);
                }
                else if (component != null && component.AddToContainer(container))
                {
                    component.SetPickedUp();
                }
            }
        }
        void OnPickup(Pickupable pickupable, PickPrefab component)
        {
            if (pickupable != null && pickupable.isPickupable && GetStorageContainer(pickupable).HasRoomFor(pickupable))
            {
                pickupable = pickupable.Initialize();
                InventoryItem item = new InventoryItem(pickupable);
                GetStorageContainer(pickupable).UnsafeAdd(item);
                global::Utils.PlayFMODAsset(pickupSound, this.front, 5f);
            }
            else if (component != null && component.AddToContainer(GetStorageContainer(pickupable)))
            {
                component.SetPickedUp();
            }

            this.cooldownTime = Time.time + cooldownPickup;
        }
Exemple #3
0
        public void OnPickup()
        {
            GameObject activeTarget = Exosuit.GetActiveTarget();

            if (activeTarget)
            {
                Pickupable pickupable = activeTarget.GetComponent <Pickupable>();
                PickPrefab component  = activeTarget.GetComponent <PickPrefab>();

                bool hasRoomForItem = Exosuit.storageContainer.container.HasRoomFor(pickupable);

                if (pickupable != null && pickupable.isPickupable && hasRoomForItem)
                {
                    pickupable = pickupable.Initialize();
                    InventoryItem item = new InventoryItem(pickupable);
                    Exosuit.storageContainer.container.UnsafeAdd(item);
                    Utils.PlayFMODAsset(pickupSound, front, 5f);
                }
                else if (component != null && component.AddToContainer(Exosuit.storageContainer.container))
                {
                    component.SetPickedUp();
                }
            }
        }