46 lines
777 B
C#
46 lines
777 B
C#
using UnityEngine;
|
|
using UnityEngine.UI;
|
|
/// <summary>
|
|
/// code is similar to health
|
|
/// </summary>
|
|
public class Stamina : MonoBehaviour
|
|
{
|
|
|
|
public int maxStamina = 9;
|
|
public int currentStamina = 9;
|
|
public Image staminabar;
|
|
|
|
// stamina logic
|
|
void Start()
|
|
{
|
|
currentStamina = maxStamina;
|
|
RefreshStaminaBar();
|
|
}
|
|
|
|
// Update is called once per frame
|
|
private void Update()
|
|
{
|
|
|
|
}
|
|
|
|
public void UseStamina()
|
|
{
|
|
|
|
}
|
|
|
|
private void RefreshStaminaBar()
|
|
{
|
|
// code from Christian
|
|
staminabar.fillAmount = (float)currentStamina / (float)maxStamina;
|
|
|
|
// cd for stamina
|
|
|
|
// stamina reg
|
|
|
|
if (currentStamina < 0)
|
|
{
|
|
// longer cd for stamina reg
|
|
}
|
|
}
|
|
}
|