Inventory and minigame tweaks
This commit is contained in:
@@ -92,7 +92,7 @@ public class InventoryItem : MonoBehaviour
|
||||
if (Count == 0)
|
||||
{
|
||||
//Destroys this gameobject if the count is 0 or lower
|
||||
Destroy(this);
|
||||
Destroy(gameObject);
|
||||
return true;
|
||||
}
|
||||
UpdateText();
|
||||
@@ -103,9 +103,10 @@ public class InventoryItem : MonoBehaviour
|
||||
|
||||
public void PopItem()
|
||||
{
|
||||
GameObject item = Instantiate(itemPrefab, transform.position + transform.forward, Quaternion.identity);
|
||||
GameObject item = Instantiate(_itemData.prefab, transform.position + transform.forward, Quaternion.identity);
|
||||
|
||||
item.transform.localScale = new Vector3(1, 1, 1);
|
||||
item.transform.localScale = Vector3.one;
|
||||
item.transform.name = _itemData.name;
|
||||
|
||||
var colliderComponent = item.GetComponent<Collider>();
|
||||
if (colliderComponent != null) colliderComponent.enabled = true;
|
||||
@@ -117,6 +118,9 @@ public class InventoryItem : MonoBehaviour
|
||||
rigidbodyComponent.useGravity = true;
|
||||
}
|
||||
|
||||
var xrGrabInteractableComponent = item.GetComponent<XRGrabInteractable>();
|
||||
if (xrGrabInteractableComponent != null) xrGrabInteractableComponent.enabled = true;
|
||||
|
||||
|
||||
ChangeCount(-1);
|
||||
}
|
||||
|
||||
@@ -10,6 +10,7 @@ public class ItemData : MonoBehaviour
|
||||
public bool canStack;
|
||||
public string itemName;
|
||||
public string itemDescription;
|
||||
public GameObject prefab;
|
||||
|
||||
public override string ToString()
|
||||
{
|
||||
|
||||
@@ -8,7 +8,7 @@ public class EssenceNodeController : MonoBehaviour
|
||||
[SerializeField]
|
||||
private AudioSource chime;
|
||||
|
||||
public Inventory playerInventory;
|
||||
private Inventory playerInventory;
|
||||
|
||||
public bool isTouched;
|
||||
private bool followPlayer = false;
|
||||
@@ -22,6 +22,7 @@ public class EssenceNodeController : MonoBehaviour
|
||||
private void Awake()
|
||||
{
|
||||
nodeMaterial = GetComponent<Renderer>().material;
|
||||
playerInventory = GameObject.Find("Inventory").GetComponent<Inventory>();
|
||||
}
|
||||
|
||||
public void Touched()
|
||||
|
||||
Reference in New Issue
Block a user