Advertisement
evelynshilosky

StorageInteractable - Part 6.2.1.1

Apr 8th, 2025
288
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C# 0.91 KB | None | 0 0
  1. using UnityEngine;
  2.  
  3. public class StorageInteractable : InteractableObject
  4. {
  5.     public Transform storageHolder;
  6.  
  7.     private void Awake()
  8.     {
  9.         item = GetComponent<Item>();
  10.         if (item == null)
  11.         {
  12.             Debug.LogError("StorageInteractable requires an Item component on the same GameObject.");
  13.             enabled = false;
  14.         }
  15.     }
  16.  
  17.     private void Start()
  18.     {
  19.         if (item != null && storageHolder != null)
  20.         {
  21.             StorageSystem.Instance.InitializeStorage(item);
  22.             StorageSystem.Instance.RegisterStorage(item, storageHolder);
  23.         }
  24.     }
  25.  
  26.     public override void Interact(PlayerMovement playerMovement, bool isRightClick)
  27.     {
  28.         if (isRightClick)
  29.         {
  30.             UIManager.Instance.ShowInventoryPrompt(item);
  31.         }
  32.         else
  33.         {
  34.             base.Interact(playerMovement, isRightClick);
  35.         }
  36.     }
  37. }
  38.  
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement