diff --git a/3d Prototyp/Assets/Scenes/NPC_Test.unity b/3d Prototyp/Assets/Scenes/NPC_Test.unity index 10baea8b..0f7776b4 100644 --- a/3d Prototyp/Assets/Scenes/NPC_Test.unity +++ b/3d Prototyp/Assets/Scenes/NPC_Test.unity @@ -1111,6 +1111,7 @@ MonoBehaviour: _baseDevelopementPower: 100 _developementPower: 100 eventRate: 1 + _startTime: 40 _talk: 0 _fullfillNeedManually: 0 _timer: 0 @@ -34301,6 +34302,7 @@ MonoBehaviour: _baseDevelopementPower: 100 _developementPower: 100 eventRate: 1 + _startTime: 60 _talk: 0 _fullfillNeedManually: 0 _timer: 0 @@ -46003,6 +46005,7 @@ MonoBehaviour: _baseDevelopementPower: 100 _developementPower: 100 eventRate: 1 + _startTime: 30 _talk: 1 _fullfillNeedManually: 0 _timer: 0 @@ -65138,6 +65141,7 @@ MonoBehaviour: _baseDevelopementPower: 100 _developementPower: 100 eventRate: 1 + _startTime: 50 _talk: 0 _fullfillNeedManually: 0 _timer: 0 diff --git a/3d Prototyp/Assets/Scripts/NPC_Behavior.cs b/3d Prototyp/Assets/Scripts/NPC_Behavior.cs index 35747890..acd7855b 100644 --- a/3d Prototyp/Assets/Scripts/NPC_Behavior.cs +++ b/3d Prototyp/Assets/Scripts/NPC_Behavior.cs @@ -13,6 +13,7 @@ public class NPC_Behavior : MonoBehaviour [SerializeField] private double _baseDevelopementPower = 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 + [SerializeField] private float _startTime = 30.0f; /// /// Gibt das Koffeinlevel des Entwicklers zurück @@ -69,7 +70,7 @@ public class NPC_Behavior : MonoBehaviour _eventStack = GetComponent(); _text2Speech = GetComponent(); _audioSource = GetComponent(); - ResetTimer(); + ResetTimer(_startTime); } // Update is called once per frame @@ -104,7 +105,7 @@ public class NPC_Behavior : MonoBehaviour } } - private void ResetTimer() + private void ResetTimer(float startTime = 0.0f) { if (eventRate <= 0) { @@ -113,7 +114,14 @@ public class NPC_Behavior : MonoBehaviour else { _timeBetweenEvents = 60f / (float)eventRate; - _timer = Random.Range(0.5f * _timeBetweenEvents, 1.25f * _timeBetweenEvents); + if (startTime > 0) + { + _timer = startTime; + } + else + { + _timer = Random.Range(0.5f * _timeBetweenEvents, 1.25f * _timeBetweenEvents); + } } }