merge joonasp joonasty
This commit is contained in:
@@ -248,3 +248,4 @@ MonoBehaviour:
|
||||
canStack: 1
|
||||
itemName: Red Mushroom
|
||||
itemDescription:
|
||||
prefab: {fileID: 4385080170328260021}
|
||||
|
||||
@@ -248,3 +248,4 @@ MonoBehaviour:
|
||||
canStack: 1
|
||||
itemName: Brown Mushroom
|
||||
itemDescription:
|
||||
prefab: {fileID: 5440707293445505367}
|
||||
|
||||
@@ -15,6 +15,7 @@ GameObject:
|
||||
- component: {fileID: 364742329878811599}
|
||||
- component: {fileID: 3113279289267004298}
|
||||
- component: {fileID: 965315076614651339}
|
||||
- component: {fileID: 4869442126406565975}
|
||||
m_Layer: 10
|
||||
m_Name: EssenceNode
|
||||
m_TagString: Untagged
|
||||
@@ -301,6 +302,23 @@ AudioSource:
|
||||
m_PreInfinity: 2
|
||||
m_PostInfinity: 2
|
||||
m_RotationOrder: 4
|
||||
--- !u!114 &4869442126406565975
|
||||
MonoBehaviour:
|
||||
m_ObjectHideFlags: 0
|
||||
m_CorrespondingSourceObject: {fileID: 0}
|
||||
m_PrefabInstance: {fileID: 0}
|
||||
m_PrefabAsset: {fileID: 0}
|
||||
m_GameObject: {fileID: 3467985268477833302}
|
||||
m_Enabled: 1
|
||||
m_EditorHideFlags: 0
|
||||
m_Script: {fileID: 11500000, guid: fc417ab3a5b06f04db2149be4cfdf6e4, type: 3}
|
||||
m_Name:
|
||||
m_EditorClassIdentifier:
|
||||
itemId: 10
|
||||
canStack: 1
|
||||
itemName: Magic essence
|
||||
itemDescription:
|
||||
prefab: {fileID: 3467985268477833302}
|
||||
--- !u!1 &5463776654730074005
|
||||
GameObject:
|
||||
m_ObjectHideFlags: 0
|
||||
|
||||
@@ -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();
|
||||
@@ -101,6 +101,30 @@ public class InventoryItem : MonoBehaviour
|
||||
return true;
|
||||
}
|
||||
|
||||
public void PopItem()
|
||||
{
|
||||
GameObject item = Instantiate(_itemData.prefab, transform.position + transform.forward, Quaternion.identity);
|
||||
|
||||
item.transform.localScale = Vector3.one;
|
||||
item.transform.name = _itemData.name;
|
||||
|
||||
var colliderComponent = item.GetComponent<Collider>();
|
||||
if (colliderComponent != null) colliderComponent.enabled = true;
|
||||
|
||||
var rigidbodyComponent = item.GetComponent<Rigidbody>();
|
||||
if (rigidbodyComponent != null)
|
||||
{
|
||||
rigidbodyComponent.isKinematic = false;
|
||||
rigidbodyComponent.useGravity = true;
|
||||
}
|
||||
|
||||
var xrGrabInteractableComponent = item.GetComponent<XRGrabInteractable>();
|
||||
if (xrGrabInteractableComponent != null) xrGrabInteractableComponent.enabled = true;
|
||||
|
||||
|
||||
ChangeCount(-1);
|
||||
}
|
||||
|
||||
public int GetItemid()
|
||||
{
|
||||
return _itemId;
|
||||
|
||||
@@ -10,6 +10,7 @@ public class ItemData : MonoBehaviour
|
||||
public bool canStack;
|
||||
public string itemName;
|
||||
public string itemDescription;
|
||||
public GameObject prefab;
|
||||
|
||||
public override string ToString()
|
||||
{
|
||||
|
||||
@@ -4,22 +4,15 @@ using UnityEngine;
|
||||
|
||||
public class PlayerInfo : MonoBehaviour
|
||||
{
|
||||
public static PlayerInfo Instance;
|
||||
|
||||
private int health;
|
||||
|
||||
private int essence_basic;
|
||||
|
||||
private GameObject rightHandHeld;
|
||||
private GameObject leftHandHeld;
|
||||
//Add elemental essences?
|
||||
|
||||
private void Awake()
|
||||
{
|
||||
Instance = this;
|
||||
health = 5;
|
||||
essence_basic = 0;
|
||||
rightHandHeld = null;
|
||||
leftHandHeld = null;
|
||||
}
|
||||
|
||||
public void AddHealth(int value)
|
||||
@@ -27,7 +20,7 @@ public class PlayerInfo : MonoBehaviour
|
||||
health += value;
|
||||
if (health <= 0)
|
||||
{
|
||||
Debug.Log("NO HEALTH REAMINING");
|
||||
Debug.Log("NO HEALTH REMAINING");
|
||||
}
|
||||
}
|
||||
|
||||
@@ -35,39 +28,8 @@ public class PlayerInfo : MonoBehaviour
|
||||
{
|
||||
if (essence_basic + value < 0)
|
||||
{
|
||||
Debug.Log("NOT ENOUGH ESSENCE");
|
||||
Debug.LogError("NOT ENOUGH ESSENCE");
|
||||
}
|
||||
else essence_basic += value;
|
||||
}
|
||||
|
||||
public void AddLeftHand(GameObject obj)
|
||||
{
|
||||
leftHandHeld = obj;
|
||||
}
|
||||
|
||||
public void AddRightHand(GameObject obj)
|
||||
{
|
||||
rightHandHeld = obj;
|
||||
}
|
||||
|
||||
public void RemoveLeftHand()
|
||||
{
|
||||
leftHandHeld = null;
|
||||
}
|
||||
|
||||
public void RemoveRightHand()
|
||||
{
|
||||
rightHandHeld = null;
|
||||
}
|
||||
|
||||
public GameObject GetLeftHand()
|
||||
{
|
||||
return leftHandHeld;
|
||||
}
|
||||
|
||||
public GameObject GetRightHand()
|
||||
{
|
||||
return rightHandHeld;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 51150922d2ca8cc44b6fc27d9365a8d4
|
||||
guid: 08f72f5d017837743b67d344a6a7ed52
|
||||
MonoImporter:
|
||||
externalObjects: {}
|
||||
serializedVersion: 2
|
||||
|
||||
Reference in New Issue
Block a user