evelynshilosky

Item - Part 6.3.4

May 2nd, 2025
256
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C# 1.55 KB | None | 0 0
  1. using UnityEngine;
  2.  
  3. public class Item : MonoBehaviour
  4. {
  5.     public string itemName;
  6.     public bool isTwoHanded;
  7.     public bool isStorageItem;
  8.     public int storageCapacity;
  9.     public Sprite icon;
  10.  
  11.     public string description = "";
  12.     public string itemUses = "";
  13.  
  14.     // Separate offsets for left and right hands when holding one item
  15.     public Vector3 leftPositionOffset = Vector3.zero;
  16.     public Vector3 leftRotationOffset = Vector3.zero;
  17.     public Vector3 rightPositionOffset = Vector3.zero;
  18.     public Vector3 rightRotationOffset = Vector3.zero;
  19.  
  20.     // New offsets for left and right hands when holding two items
  21.     public Vector3 leftTwoPositionOffset = Vector3.zero;
  22.     public Vector3 leftTwoRotationOffset = Vector3.zero;
  23.     public Vector3 rightTwoPositionOffset = Vector3.zero;
  24.     public Vector3 rightTwoRotationOffset = Vector3.zero;
  25.  
  26.     // Edible item properties
  27.     public bool isEdible = false;
  28.     public float healthEffect = 0f;
  29.     public float hydrationEffect = 0f;
  30.     public float calorieEffect = 0f;
  31.  
  32.     // Backpack property
  33.     public bool isBackpack = false;
  34.     public bool isBlanket = false;
  35.  
  36.     public virtual void Use()
  37.     {
  38.         Debug.Log($"Using {itemName}");
  39.     }
  40.  
  41.     private void Awake()
  42.     {
  43.         // Initialize properties specific to certain items
  44.         if (itemName.ToLower().Contains("blanket"))
  45.         {
  46.             isBlanket = true; // Automatically set 'isBlanket' for blanket items
  47.         }
  48.         else
  49.         {
  50.             isBlanket = false;
  51.         }
  52.     }
  53. }
  54.  
Advertisement
Add Comment
Please, Sign In to add comment