GameVsJam/3d Prototyp/Assets/Scripts/NPC_Behavior.cs

61 lines
1.7 KiB
C#

using System.Collections;
using System.Collections.Generic;
using UnityEngine;
public class NPC_Behavior : MonoBehaviour
{
[SerializeField] private double _caffeineLevel = 0.0; // max 100, min 0
[SerializeField] private double _hungerLevel = 0.0; // max 100, min 0
[SerializeField] private double _happinessLevel = 100.0; // max 100, min 0
[SerializeField] private double _developementPower = 100.0; // max unlimited, min 0
[SerializeField] double eventRate = 1.0; // max 60, min 0 -> how many events are requested per minute
// Start is called before the first frame update
void Start()
{
}
// Update is called once per frame
void Update()
{
}
public Dictionary<string, double> GetStats()
{
return new Dictionary<string, double>
{
{ "Caffine", _caffeineLevel },
{ "Hunger", _hungerLevel },
{ "Happiness", _happinessLevel },
{ "Developement Power", _developementPower }
};
}
public void SetStats(Dictionary<string, double> stats)
{
foreach (string key in stats.Keys)
{
switch (key)
{
case "Caffine":
_caffeineLevel = stats[key];
break;
case "Hunger":
_hungerLevel = stats[key];
break;
case "Happiness":
_happinessLevel = stats[key];
break;
case "Developement Power":
_developementPower = stats[key];
break;
default:
Debug.LogError("Unknown Stat/Key");
break;
}
}
}
}