Heroes_of_Hiis/Assets/Project Files/Scripts/JoonasP/PlayerInfo.cs

74 lines
1.4 KiB
C#
Raw Permalink Normal View History

using System.Collections;
using System.Collections.Generic;
using UnityEngine;
public class PlayerInfo : MonoBehaviour
{
2022-04-14 14:56:04 +00:00
public static PlayerInfo Instance;
private int health;
private int essence_basic;
2022-04-11 15:56:51 +00:00
//Add elemental essences?
2022-04-14 14:56:04 +00:00
private GameObject rightHandHeld;
private GameObject leftHandHeld;
private void Awake()
{
2022-04-14 14:56:04 +00:00
Instance = this;
health = 5;
2022-05-02 11:28:44 +00:00
essence_basic = 1000;
2022-04-14 14:56:04 +00:00
rightHandHeld = null;
leftHandHeld = null;
}
public bool AddHealth(int value)
{
health += value;
if (health <= 0)
{
2022-04-11 15:56:51 +00:00
Debug.Log("NO HEALTH REMAINING");
return false;
}
return true;
}
public bool AddEssenceBasic(int value)
{
if (essence_basic + value < 0)
{
2022-04-14 14:56:04 +00:00
Debug.Log("NOT ENOUGH ESSENCE");
return false;
}
else
{
essence_basic += value;
return true;
}
}
2022-04-14 14:56:04 +00:00
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; }
}