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; }
private IEnumerator OnPickupAsync(Pickupable pickupable, PickPrefab pickPrefab) { ItemsContainer container = TruckHelper.GetRoomForItem(pickupable); if (pickupable != null && pickupable.isPickupable && container != null) { pickupable.Initialize(); InventoryItem item = new InventoryItem(pickupable); container.UnsafeAdd(item); Utils.PlayFMODAsset(pickupSound, front, 5f); } else if (pickPrefab != null) { TaskResult <bool> result = new TaskResult <bool>(); yield return(pickPrefab.AddToContainerAsync(container, result)); if (result.Get()) { pickPrefab.SetPickedUp(); } result = null; } yield break; }
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(); } } }