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

60 lines
1.6 KiB
C#
Raw Normal View History

2024-04-04 12:05:18 +02:00
using System.Collections;
using System.Collections.Generic;
using UnityEngine;
public class NPC_Behavior : MonoBehaviour
{
[SerializeField] private double _caffeine_level = 0.0; // max 100
[SerializeField] private double _hunger_level = 0.0; // max 100
[SerializeField] private double _happiness_level = 100.0; // max 100
[SerializeField] private double _developement_power = 100.0; // max unlimited
// 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", _caffeine_level },
{ "Hunger", _hunger_level },
{ "Happiness", _happiness_level },
{ "Developement Power", _developement_power }
};
}
public void SetStats(Dictionary<string, double> stats)
{
foreach (string key in stats.Keys)
{
switch (key)
{
case "Caffine":
_caffeine_level = stats[key];
break;
case "Hunger":
_hunger_level = stats[key];
break;
case "Happiness":
_happiness_level = stats[key];
break;
case "Developement Power":
_developement_power = stats[key];
break;
default:
Debug.LogError("Unknown Stat/Key");
break;
}
}
}
}