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

61 lines
1.7 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
{
2024-04-04 12:14:58 +02:00
[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
2024-04-04 12:05:18 +02:00
// 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>
{
2024-04-04 12:14:58 +02:00
{ "Caffine", _caffeineLevel },
{ "Hunger", _hungerLevel },
{ "Happiness", _happinessLevel },
{ "Developement Power", _developementPower }
2024-04-04 12:05:18 +02:00
};
}
public void SetStats(Dictionary<string, double> stats)
{
foreach (string key in stats.Keys)
{
switch (key)
{
case "Caffine":
2024-04-04 12:14:58 +02:00
_caffeineLevel = stats[key];
2024-04-04 12:05:18 +02:00
break;
case "Hunger":
2024-04-04 12:14:58 +02:00
_hungerLevel = stats[key];
2024-04-04 12:05:18 +02:00
break;
case "Happiness":
2024-04-04 12:14:58 +02:00
_happinessLevel = stats[key];
2024-04-04 12:05:18 +02:00
break;
case "Developement Power":
2024-04-04 12:14:58 +02:00
_developementPower = stats[key];
2024-04-04 12:05:18 +02:00
break;
default:
Debug.LogError("Unknown Stat/Key");
break;
}
}
}
}