Download Assets/Scripts/Inventory/ItemData.cs from AliAch/my-unity-assets: direct link, hf CLI and curl.
- Browser
- Download file 1.47 kB
-
https://huggingface.co/datasets/AliAch/my-unity-assets/resolve/main/Assets/Scripts/Inventory/ItemData.cs
- Command line
-
hf download hf://datasets/AliAch/my-unity-assets/Assets/Scripts/Inventory/ItemData.cs
-
curl -L -o ItemData.cs https://huggingface.co/datasets/AliAch/my-unity-assets/resolve/main/Assets/Scripts/Inventory/ItemData.cs
1.47 kB
| using UnityEngine; | |
| public class ItemData : MonoBehaviour | |
| { | |
| public string itemID; | |
| [] | |
| public Vector3Int baseFootprint = new Vector3Int(1, 1, 1); | |
| // Variables used by InventoryPlacer | |
| [] public Vector3Int gridPosition; | |
| [] public Vector3Int currentFootprint; | |
| [] public int swapState = 0; | |
| // Defines how the item rotates logically. | |
| // State0: (W, H, D) - default, bulk consumes Y (vertical). | |
| // State1: (H, W, D) - swap W<->H, bulk consumes X (horizontal). | |
| // State2: (W, D, H) - swap H<->D, bulk consumes Z (depth). | |
| // Priority when placing: try State0 first, then State1, then State2 - i.e. prefer vertical, | |
| // then horizontal, then depth. | |
| public Vector3Int FootprintAtState(int state) | |
| { | |
| switch (state) | |
| { | |
| case 0: | |
| return baseFootprint; // Normal (W, H, D) - bulk on Y | |
| case 1: | |
| return new Vector3Int(baseFootprint.y, baseFootprint.x, baseFootprint.z); // Swap Width and Height - bulk on X | |
| case 2: | |
| return new Vector3Int(baseFootprint.x, baseFootprint.z, baseFootprint.y); // Swap Height and Depth - bulk on Z | |
| default: | |
| return baseFootprint; | |
| } | |
| } | |
| public void ApplySwapState(int state) | |
| { | |
| swapState = state; | |
| currentFootprint = FootprintAtState(state); | |
| } | |
| } |