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

89 lines
2.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
2024-04-05 13:18:15 +02:00
[SerializeField] private double _baseDevelopementPower = 100.0; // max 100, min 0
2024-04-04 12:14:58 +02:00
[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
2024-04-05 13:18:15 +02:00
/// <summary>
/// Gibt das Koffeinlevel des Entwicklers zur<75>ck
/// </summary>
public double CaffeineLevel => _caffeineLevel;
/// <summary>
/// Gibt das Hungerlevel des Entwicklers zur<75>ck
/// </summary>
public double HungerLevel => _hungerLevel;
/// <summary>
/// Gibt das Zufriedenheitslevel des Entwicklers zur<75>ck
/// </summary>
public double HappnessLevel => _happinessLevel;
/// <summary>
/// Gibt die Basisentwicklungskraft des Entwicklers zur<75>ck
/// </summary>
public double BaseDevelopementPower => _baseDevelopementPower;
/// <summary>
/// Gibt die jetzige Entwicklungskraft des Entwicklers zur<75>ck
/// </summary>
public double DevelopmentPower => _developementPower;
public GameManager _gameManager;
2024-04-04 12:05:18 +02:00
// Start is called before the first frame update
void Start()
{
2024-04-05 13:18:15 +02:00
_gameManager = GameManager.Instance;
2024-04-04 12:05:18 +02:00
}
// Update is called once per frame
void Update()
{
2024-04-05 13:18:15 +02:00
// fire event
if (UnityEngine.Random.Range(0, 60) == 0)
{
Debug.Log("TEST");
}
2024-04-04 12:05:18 +02:00
}
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;
}
}
}
}