show player energy, change daytimecontroller to TimeManager
This commit is contained in:
@@ -4,10 +4,10 @@ using UnityEngine;
|
||||
|
||||
public class PlayerController : MonoBehaviour
|
||||
{
|
||||
public Stat money = new Stat("Money", 100.00);
|
||||
public Stat money = new Stat("Money", 100.0f);
|
||||
public Stat rentAccount = new Stat("Rent Account", 0);
|
||||
public Stat foodEnergy = new Stat("Food Energy", 0);
|
||||
public Stat restEnergy = new Stat("Rest Energy", 0);
|
||||
public Stat energy = new Stat("Energy", 100);
|
||||
|
||||
// bank
|
||||
public Stat bankAccount = new Stat("Bank Account", 0);
|
||||
@@ -40,11 +40,15 @@ public class PlayerController : MonoBehaviour
|
||||
public Stat tvItem = new Stat("Tv Item", 1500, 1);
|
||||
public Stat laptopItem = new Stat("Laptop Item", 3000, 1);
|
||||
|
||||
private void OnEnable()
|
||||
{
|
||||
TimeManager.OnMinuteChanged += DecreaseEnergy;
|
||||
}
|
||||
|
||||
private int _day;
|
||||
public int Clock;
|
||||
|
||||
|
||||
private void OnDisable()
|
||||
{
|
||||
TimeManager.OnMinuteChanged -= DecreaseEnergy;
|
||||
}
|
||||
// Start is called before the first frame update
|
||||
void Start()
|
||||
{
|
||||
@@ -53,13 +57,11 @@ public class PlayerController : MonoBehaviour
|
||||
// Update is called once per frame
|
||||
void Update()
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
|
||||
public void StartNewDay()
|
||||
public void DecreaseEnergy()
|
||||
{
|
||||
Clock = 24;
|
||||
energy.deduct(0.096f); // 24 hours it's 100, 100/1440=~0.096 per minute
|
||||
}
|
||||
|
||||
public bool TryBuyAction(BaseAction action)
|
||||
|
||||
Reference in New Issue
Block a user