74 lines
1.4 KiB
C#
74 lines
1.4 KiB
C#
using System.Collections;
|
|
using System.Collections.Generic;
|
|
using UnityEngine;
|
|
|
|
public class PlayerInfo : MonoBehaviour
|
|
{
|
|
public static PlayerInfo Instance;
|
|
|
|
private int health;
|
|
|
|
private int essence_basic;
|
|
//Add elemental essences?
|
|
|
|
private GameObject rightHandHeld;
|
|
private GameObject leftHandHeld;
|
|
|
|
private void Awake()
|
|
{
|
|
Instance = this;
|
|
health = 5;
|
|
essence_basic = 1;
|
|
rightHandHeld = null;
|
|
leftHandHeld = null;
|
|
}
|
|
|
|
public bool AddHealth(int value)
|
|
{
|
|
health += value;
|
|
if (health <= 0)
|
|
{
|
|
Debug.Log("NO HEALTH REMAINING");
|
|
return false;
|
|
}
|
|
return true;
|
|
}
|
|
|
|
public bool AddEssenceBasic(int value)
|
|
{
|
|
if (essence_basic + value < 0)
|
|
{
|
|
Debug.Log("NOT ENOUGH ESSENCE");
|
|
return false;
|
|
}
|
|
else
|
|
{
|
|
essence_basic += value;
|
|
return true;
|
|
}
|
|
}
|
|
|
|
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 GetRightHand() { return rightHandHeld; }
|
|
public GameObject GetLeftHand() { return leftHandHeld; }
|
|
}
|