Added first NPC Scripts
This commit is contained in:
12216
3d Prototyp/Assets/Scenes/NPC_Test.unity
Normal file
12216
3d Prototyp/Assets/Scenes/NPC_Test.unity
Normal file
File diff suppressed because it is too large
Load Diff
7
3d Prototyp/Assets/Scenes/NPC_Test.unity.meta
Normal file
7
3d Prototyp/Assets/Scenes/NPC_Test.unity.meta
Normal file
@ -0,0 +1,7 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 4ac77a83fb60e1b43a2a8b9d22d07e93
|
||||
DefaultImporter:
|
||||
externalObjects: {}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
59
3d Prototyp/Assets/Scripts/NPC_Behavior.cs
Normal file
59
3d Prototyp/Assets/Scripts/NPC_Behavior.cs
Normal file
@ -0,0 +1,59 @@
|
||||
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;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
11
3d Prototyp/Assets/Scripts/NPC_Behavior.cs.meta
Normal file
11
3d Prototyp/Assets/Scripts/NPC_Behavior.cs.meta
Normal file
@ -0,0 +1,11 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 707d39e7a8ed7a44a8341ead8ee2a9ad
|
||||
MonoImporter:
|
||||
externalObjects: {}
|
||||
serializedVersion: 2
|
||||
defaultReferences: []
|
||||
executionOrder: 0
|
||||
icon: {instanceID: 0}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
Reference in New Issue
Block a user