From defd3598522d26c67477bb71cb65ef80a3cbed1b Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Simon=20L=C3=BCbe=C3=9F?= Date: Mon, 8 Apr 2024 20:33:29 +0200 Subject: [PATCH] Entwickler machen ein paar Sachen --- .../Animations/NPCAnimationController.cs | 93 ++++++++---- ...P Upgrade (2019.4 LTS +).unitypackage.meta | 7 - 3d Prototyp/Assets/DeveloperInfoUi.cs | 2 +- 3d Prototyp/Assets/Scenes/GameJamScene.unity | 141 +++++++++++++++--- 3d Prototyp/Assets/Scripts/Developer.cs | 27 +++- 3d Prototyp/Assets/Scripts/TimeManager.cs | 9 +- 3d Prototyp/Assets/Scripts/UiController.cs | 2 +- 3d Prototyp/Assets/ToiletManager.cs | 9 ++ 3d Prototyp/Assets/ToiletManager.cs.meta | 11 ++ 9 files changed, 236 insertions(+), 65 deletions(-) delete mode 100644 3d Prototyp/Assets/Confetti FX/Upgrade/Confetti FX URP Upgrade (2019.4 LTS +).unitypackage.meta create mode 100644 3d Prototyp/Assets/ToiletManager.cs create mode 100644 3d Prototyp/Assets/ToiletManager.cs.meta diff --git a/3d Prototyp/Assets/Animations/NPCAnimationController.cs b/3d Prototyp/Assets/Animations/NPCAnimationController.cs index 2e131175..0d6fff3d 100644 --- a/3d Prototyp/Assets/Animations/NPCAnimationController.cs +++ b/3d Prototyp/Assets/Animations/NPCAnimationController.cs @@ -16,6 +16,11 @@ public class NPCAnimationController : MonoBehaviour private NavMeshAgent agent; private Animator animator; + public Developer Developer; + + [SerializeField] + private bool _canTakeNewJob; + private void Awake() { agent = GetComponent(); @@ -25,21 +30,23 @@ public class NPCAnimationController : MonoBehaviour } private IEnumerator GetToWorkRoutine() { + yield return TakeLock(); + animator.SetLayerWeight(animator.GetLayerIndex("Typing"), 0); animator.SetTrigger("Walk"); yield return new WaitUntil(() => animator.GetCurrentAnimatorStateInfo(0).IsName("WalkBack")); MoveTo(workPosition.position); yield return new WaitUntil(() => agent.remainingDistance <= agent.stoppingDistance); - animator.ResetTrigger("Walk"); // Setze den Lauf-Trigger zurück + animator.ResetTrigger("Walk"); // Setze den Lauf-Trigger zur�ck animator.SetTrigger("SitDown"); yield return new WaitUntil(() => animator.GetCurrentAnimatorStateInfo(0).IsName("Sit")); transform.rotation = workPosition.rotation; yield return StartCoroutine(FadeLayerWeight(animator.GetLayerIndex("Typing"), 1, 1f)); + + ReleaseLock(); } - - - private IEnumerator FadeLayerWeight(int layerIndex, float targetWeight, float duration) + private IEnumerator FadeLayerWeight(int layerIndex, float targetWeight, float duration) { float time = 0; float startWeight = animator.GetLayerWeight(layerIndex); @@ -56,15 +63,25 @@ public class NPCAnimationController : MonoBehaviour public void DrinkCoffee() { - - StartCoroutine(DrinkCoffeeRoutine()); - } + private IEnumerator TakeLock() + { + yield return new WaitUntil(() => _canTakeNewJob); + + _canTakeNewJob = false; + } + + private void ReleaseLock() + { + _canTakeNewJob = true; + } + private IEnumerator DrinkCoffeeRoutine() { - + yield return TakeLock(); + yield return StartCoroutine(FadeLayerWeight(animator.GetLayerIndex("Coffee"), 1, 1f)); // 1 Sekunde zum Einblenden animator.SetTrigger("DrinkCoffee"); yield return new WaitForSeconds(1.5f); @@ -78,7 +95,7 @@ public class NPCAnimationController : MonoBehaviour animator.ResetTrigger("DrinkCoffee"); Cup.SetActive(true); - + ReleaseLock(); } public void GoToToilet() @@ -88,7 +105,17 @@ public class NPCAnimationController : MonoBehaviour private IEnumerator GoToToiletRoutine() { + yield return TakeLock(); + yield return StartCoroutine(FadeLayerWeight(animator.GetLayerIndex("Typing"), 0, 1f)); + + while (ToiletManager.Instance.IsOccupied) + { + yield return new WaitForSeconds(2); + } + + ToiletManager.Instance.IsOccupied = true; + // Beginne mit dem Laufen zur Toilette. animator.SetTrigger("Walk"); yield return new WaitUntil(() => animator.GetCurrentAnimatorStateInfo(0).IsName("Walk")); @@ -97,24 +124,33 @@ public class NPCAnimationController : MonoBehaviour yield return new WaitUntil(() => agent.remainingDistance <= agent.stoppingDistance); - // Hört auf zu laufen und beginnt zu sitzen. - animator.ResetTrigger("Walk"); // Es ist wichtig, den vorherigen Trigger zurückzusetzen + // H�rt auf zu laufen und beginnt zu sitzen. + animator.ResetTrigger("Walk"); // Es ist wichtig, den vorherigen Trigger zur�ckzusetzen transform.LookAt(new Vector3(toiletLookAtTransform.position.x, toiletLookAtTransform.position.y, toiletLookAtTransform.position.z)); animator.SetTrigger("SitDown"); + transform.LookAt(new Vector3(toiletLookAtTransform.position.x, toiletLookAtTransform.position.y, toiletLookAtTransform.position.z)); yield return new WaitUntil(() => animator.GetCurrentAnimatorStateInfo(0).IsName("Ready")); - // Stehe auf und gehe zurück zum Ausgangspunkt. + + Developer.Pee(1.0, true); + + // Stehe auf und gehe zur�ck zum Ausgangspunkt. transform.LookAt(new Vector3(toiletLookAtTransform.position.x, toiletLookAtTransform.position.y, toiletLookAtTransform.position.z)); - animator.ResetTrigger("SitDown"); // Setze den Sitzen-Trigger zurück + animator.ResetTrigger("SitDown"); // Setze den Sitzen-Trigger zur�ck + + ToiletManager.Instance.IsOccupied = false; + animator.SetTrigger("Walk"); yield return new WaitUntil(() => animator.GetCurrentAnimatorStateInfo(0).IsName("WalkBack")); MoveTo(workPosition.position); yield return new WaitUntil(() => agent.remainingDistance <= agent.stoppingDistance); - animator.ResetTrigger("Walk"); // Setze den Lauf-Trigger zurück + animator.ResetTrigger("Walk"); // Setze den Lauf-Trigger zur�ck animator.SetTrigger("SitDown"); yield return new WaitUntil(() => animator.GetCurrentAnimatorStateInfo(0).IsName("Sit")); transform.rotation = workPosition.rotation; yield return StartCoroutine(FadeLayerWeight(animator.GetLayerIndex("Typing"), 1, 1f)); + + ReleaseLock(); } // Hier kannst du entscheiden, ob der Charakter wieder sitzt oder steht. // Beispiel: Setze IsSitting oder IsStanding entsprechend. @@ -126,12 +162,15 @@ public class NPCAnimationController : MonoBehaviour private IEnumerator GettingMadRoutine() { + yield return TakeLock(); + animator.SetTrigger("GetMad"); yield return StartCoroutine(FadeLayerWeight(animator.GetLayerIndex("Coffee"), 1, 2f)); // 1 Sekunde zum Einblenden yield return new WaitForSeconds(8f); yield return StartCoroutine(FadeLayerWeight(animator.GetLayerIndex("Coffee"), 0, 1f)); // 1 Sekunde zum Ausblenden animator.ResetTrigger("GetMad"); - + + ReleaseLock(); } public void CaffeinOverdose() @@ -141,6 +180,8 @@ public class NPCAnimationController : MonoBehaviour private IEnumerator CaffeinRoutine() { + yield return TakeLock(); + yield return StartCoroutine(FadeLayerWeight(animator.GetLayerIndex("Typing"), 0, 1f)); // Beginne mit dem Laufen zur Toilette. animator.SetTrigger("Walk"); @@ -149,24 +190,23 @@ public class NPCAnimationController : MonoBehaviour yield return new WaitUntil(() => agent.remainingDistance <= agent.stoppingDistance); animator.ResetTrigger("Walk"); animator.SetTrigger("TooMuchCaffein"); - yield return new WaitForSeconds(8f); + + yield return new WaitWhile(() => Developer.IsOvercaffeinated); + animator.ResetTrigger("TooMuchCaffein"); animator.SetTrigger("Walk"); yield return new WaitUntil(() => animator.GetCurrentAnimatorStateInfo(0).IsName("WalkBack")); MoveTo(workPosition.position); yield return new WaitUntil(() => agent.remainingDistance <= agent.stoppingDistance); transform.rotation = workPosition.rotation; - animator.ResetTrigger("Walk"); // Setze den Lauf-Trigger zurück + animator.ResetTrigger("Walk"); // Setze den Lauf-Trigger zur�ck animator.SetTrigger("SitDown"); yield return new WaitUntil(() => animator.GetCurrentAnimatorStateInfo(0).IsName("Sit")); yield return StartCoroutine(FadeLayerWeight(animator.GetLayerIndex("Typing"), 1, 1f)); - - - + + ReleaseLock(); } - - private void MoveTo(Vector3 destination) { agent.destination = destination; @@ -175,28 +215,27 @@ public class NPCAnimationController : MonoBehaviour private void Update() { - // Prüft, ob der Buchstabe 'C' gedrückt wurde + // Pr�ft, ob der Buchstabe 'C' gedr�ckt wurde if (Input.GetKeyDown(KeyCode.C)) { DrinkCoffee(); } - // Prüft, ob der Buchstabe 'T' gedrückt wurde + // Pr�ft, ob der Buchstabe 'T' gedr�ckt wurde if (Input.GetKeyDown(KeyCode.T)) { GoToToilet(); } - // Prüft, ob der Buchstabe 'M' gedrückt wurde + // Pr�ft, ob der Buchstabe 'M' gedr�ckt wurde if (Input.GetKeyDown(KeyCode.M)) { GettingMad(); } - // Prüft, ob der Buchstabe 'C' gedrückt wurde + // Pr�ft, ob der Buchstabe 'C' gedr�ckt wurde if (Input.GetKeyDown(KeyCode.O)) { CaffeinOverdose(); } } - } diff --git a/3d Prototyp/Assets/Confetti FX/Upgrade/Confetti FX URP Upgrade (2019.4 LTS +).unitypackage.meta b/3d Prototyp/Assets/Confetti FX/Upgrade/Confetti FX URP Upgrade (2019.4 LTS +).unitypackage.meta deleted file mode 100644 index 51cb9f68..00000000 --- a/3d Prototyp/Assets/Confetti FX/Upgrade/Confetti FX URP Upgrade (2019.4 LTS +).unitypackage.meta +++ /dev/null @@ -1,7 +0,0 @@ -fileFormatVersion: 2 -guid: 73951a4b66414d24999d439134425a40 -DefaultImporter: - externalObjects: {} - userData: - assetBundleName: - assetBundleVariant: diff --git a/3d Prototyp/Assets/DeveloperInfoUi.cs b/3d Prototyp/Assets/DeveloperInfoUi.cs index 994e7e9d..7c52f5eb 100644 --- a/3d Prototyp/Assets/DeveloperInfoUi.cs +++ b/3d Prototyp/Assets/DeveloperInfoUi.cs @@ -38,7 +38,7 @@ public class DeveloperInfoUi : MonoBehaviour // Update is called once per frame void Update() { - _happinessImage.color = _statusGradient.Evaluate((float)_developer.CurrentUrgeToUrinate); + _happinessImage.color = _statusGradient.Evaluate((float)_developer.CurrentHappiness); _caffeineImage.color = _statusGradient.Evaluate((float)_developer.CurrentCaffeination); _hungerImage.color = _statusGradient.Evaluate((float)_developer.CurrentHunger); _toiletImage.color = _statusGradient.Evaluate((float)_developer.CurrentUrgeToUrinate); diff --git a/3d Prototyp/Assets/Scenes/GameJamScene.unity b/3d Prototyp/Assets/Scenes/GameJamScene.unity index 22148481..c639bb1f 100644 --- a/3d Prototyp/Assets/Scenes/GameJamScene.unity +++ b/3d Prototyp/Assets/Scenes/GameJamScene.unity @@ -1606,6 +1606,9 @@ PrefabInstance: - targetCorrespondingSourceObject: {fileID: 6540681369557983152, guid: d77999c19b7f3294599d4029e5b08ace, type: 3} insertIndex: -1 addedObject: {fileID: 1961302941} + - targetCorrespondingSourceObject: {fileID: 6540681369557983152, guid: d77999c19b7f3294599d4029e5b08ace, type: 3} + insertIndex: -1 + addedObject: {fileID: 1961302943} m_SourcePrefab: {fileID: 100100000, guid: d77999c19b7f3294599d4029e5b08ace, type: 3} --- !u!4 &30470408 stripped Transform: @@ -12085,7 +12088,7 @@ Transform: m_GameObject: {fileID: 249942517} serializedVersion: 2 m_LocalRotation: {x: -0, y: 0.88022256, z: -0, w: 0.47456104} - m_LocalPosition: {x: -0.085, y: 0.155, z: -0.13} + m_LocalPosition: {x: -0.22, y: 0.155, z: -0.365} m_LocalScale: {x: 1, y: 1, z: 1} m_ConstrainProportionsScale: 0 m_Children: [] @@ -14328,6 +14331,19 @@ MonoBehaviour: _secondsPerDay: 120 _totalTime: 0 _sun: {fileID: 124226107} +--- !u!114 &322315147 +MonoBehaviour: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 322315138} + m_Enabled: 1 + m_EditorHideFlags: 0 + m_Script: {fileID: 11500000, guid: 459a8de1571412a44927af6c9cc4ef5e, type: 3} + m_Name: + m_EditorClassIdentifier: + IsOccupied: 0 --- !u!1 &324516778 GameObject: m_ObjectHideFlags: 0 @@ -24016,6 +24032,9 @@ PrefabInstance: - targetCorrespondingSourceObject: {fileID: 6839065564630337043, guid: 950f64c9c1d51e14b84b4e4d4a7b775a, type: 3} insertIndex: -1 addedObject: {fileID: 1295157960} + - targetCorrespondingSourceObject: {fileID: 6839065564630337043, guid: 950f64c9c1d51e14b84b4e4d4a7b775a, type: 3} + insertIndex: -1 + addedObject: {fileID: 1295157962} m_SourcePrefab: {fileID: 100100000, guid: 950f64c9c1d51e14b84b4e4d4a7b775a, type: 3} --- !u!4 &523081034 stripped Transform: @@ -27902,10 +27921,30 @@ PrefabInstance: propertyPath: Needs.Array.size value: 4 objectReference: {fileID: 0} + - target: {fileID: 3650884189301972455, guid: e1e33f0b2075b5c40817665dd8a86f31, type: 3} + propertyPath: Needs.Array.data[0] + value: + objectReference: {fileID: 2907046783514947559, guid: 92b71cfc6a2687d44b165ead746233f0, type: 3} + - target: {fileID: 3650884189301972455, guid: e1e33f0b2075b5c40817665dd8a86f31, type: 3} + propertyPath: Needs.Array.data[1] + value: + objectReference: {fileID: 3355435593704932208, guid: b31fb59d198e53b459943bf898293618, type: 3} + - target: {fileID: 3650884189301972455, guid: e1e33f0b2075b5c40817665dd8a86f31, type: 3} + propertyPath: Needs.Array.data[2] + value: + objectReference: {fileID: 7697340910557049827, guid: 5d809e3a343d45f4185615db92384dc7, type: 3} + - target: {fileID: 3650884189301972455, guid: e1e33f0b2075b5c40817665dd8a86f31, type: 3} + propertyPath: Needs.Array.data[3] + value: + objectReference: {fileID: 2350437210533342175, guid: 2122156ae265fcc4da01213f31a64901, type: 3} - target: {fileID: 3650884189301972455, guid: e1e33f0b2075b5c40817665dd8a86f31, type: 3} propertyPath: _developers.Array.size value: 4 objectReference: {fileID: 0} + - target: {fileID: 3650884189301972455, guid: e1e33f0b2075b5c40817665dd8a86f31, type: 3} + propertyPath: _generalNeedDrainScaling + value: 0.01 + objectReference: {fileID: 0} - target: {fileID: 3650884189301972455, guid: e1e33f0b2075b5c40817665dd8a86f31, type: 3} propertyPath: _developers.Array.data[0] value: @@ -27933,6 +27972,9 @@ PrefabInstance: - targetCorrespondingSourceObject: {fileID: 2703668081068178613, guid: e1e33f0b2075b5c40817665dd8a86f31, type: 3} insertIndex: -1 addedObject: {fileID: 322315144} + - targetCorrespondingSourceObject: {fileID: 2703668081068178613, guid: e1e33f0b2075b5c40817665dd8a86f31, type: 3} + insertIndex: -1 + addedObject: {fileID: 322315147} m_SourcePrefab: {fileID: 100100000, guid: e1e33f0b2075b5c40817665dd8a86f31, type: 3} --- !u!1 &604851636 GameObject: @@ -56397,16 +56439,17 @@ MonoBehaviour: _caffeineLevel: 1 _hungerLevel: 1 _urgeToUrinateLevel: 1 - _happiness: 0.75 + _happiness: 1 _isSleeping: 0 _isHyperactive: 0 _isOvercaffeinated: 0 - _developerNeeds: {fileID: 1502578694} + _developerNeeds: {fileID: 1295157962} _caffeineNeed: {fileID: 0} _wantedDrink: 0 _hungerNeed: {fileID: 0} _wantedFood: 0 _toiletNeed: {fileID: 0} + _npcAnimation: {fileID: 1295157958} _maxPrivateContextBufferSize: 2 _talkTimer: 0 --- !u!82 &1295157950 @@ -56595,7 +56638,7 @@ NavMeshAgent: m_Acceleration: 8 avoidancePriority: 50 m_AngularSpeed: 120 - m_StoppingDistance: 0 + m_StoppingDistance: 0.2 m_AutoTraverseOffMeshLink: 1 m_AutoBraking: 1 m_AutoRepath: 1 @@ -56621,6 +56664,8 @@ MonoBehaviour: toiletTransform: {fileID: 249942518} dancePlace: {fileID: 677901836} toiletLookAtTransform: {fileID: 2024028214} + Developer: {fileID: 1295157948} + _canTakeNewJob: 1 --- !u!114 &1295157960 MonoBehaviour: m_ObjectHideFlags: 0 @@ -56640,6 +56685,18 @@ MonoBehaviour: m_IgnoreFromBuild: 1 m_ApplyToChildren: 1 m_AffectedAgents: ffffffff +--- !u!114 &1295157962 +MonoBehaviour: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 1295157946} + m_Enabled: 1 + m_EditorHideFlags: 0 + m_Script: {fileID: 11500000, guid: f7e417f330c4dd845a8f3dc744dff25a, type: 3} + m_Name: + m_EditorClassIdentifier: --- !u!1 &1295976273 GameObject: m_ObjectHideFlags: 0 @@ -64953,10 +65010,10 @@ MonoBehaviour: _baseStats: BaseEfficiency: 1 Fingers: 10 - CaffeineDrainFactor: 1 - HungerDrainFactor: 1 - UrinationDrainFactor: 1 - HappinessDrainFactor: 1 + CaffeineDrainFactor: 1.21 + HungerDrainFactor: 0.79 + UrinationDrainFactor: 2 + HappinessDrainFactor: 0.82 CoffeePreference: 0.5 MatePreference: 0.5 _talkRange: 2 @@ -64965,7 +65022,7 @@ MonoBehaviour: _caffeineLevel: 1 _hungerLevel: 1 _urgeToUrinateLevel: 1 - _happiness: 0.75 + _happiness: 1 _isSleeping: 0 _isHyperactive: 0 _isOvercaffeinated: 0 @@ -64975,6 +65032,7 @@ MonoBehaviour: _hungerNeed: {fileID: 0} _wantedFood: 0 _toiletNeed: {fileID: 0} + _npcAnimation: {fileID: 1502578698} _maxPrivateContextBufferSize: 2 _talkTimer: 0 --- !u!114 &1502578688 @@ -65179,6 +65237,8 @@ MonoBehaviour: toiletTransform: {fileID: 249942518} dancePlace: {fileID: 677901836} toiletLookAtTransform: {fileID: 2024028214} + Developer: {fileID: 1502578686} + _canTakeNewJob: 1 --- !u!195 &1502578699 NavMeshAgent: m_ObjectHideFlags: 0 @@ -65193,7 +65253,7 @@ NavMeshAgent: m_Acceleration: 8 avoidancePriority: 50 m_AngularSpeed: 120 - m_StoppingDistance: 0 + m_StoppingDistance: 0.2 m_AutoTraverseOffMeshLink: 1 m_AutoBraking: 1 m_AutoRepath: 1 @@ -83920,10 +83980,10 @@ MonoBehaviour: _baseStats: BaseEfficiency: 1 Fingers: 10 - CaffeineDrainFactor: 1 - HungerDrainFactor: 1 - UrinationDrainFactor: 1 - HappinessDrainFactor: 1 + CaffeineDrainFactor: 0.82 + HungerDrainFactor: 1.36 + UrinationDrainFactor: 0.88 + HappinessDrainFactor: 0.94 CoffeePreference: 0.5 MatePreference: 0.5 _talkRange: 2 @@ -83932,16 +83992,17 @@ MonoBehaviour: _caffeineLevel: 1 _hungerLevel: 1 _urgeToUrinateLevel: 1 - _happiness: 0.75 + _happiness: 1 _isSleeping: 0 _isHyperactive: 0 _isOvercaffeinated: 0 - _developerNeeds: {fileID: 1502578694} + _developerNeeds: {fileID: 1961302943} _caffeineNeed: {fileID: 0} _wantedDrink: 0 _hungerNeed: {fileID: 0} _wantedFood: 0 _toiletNeed: {fileID: 0} + _npcAnimation: {fileID: 1961302939} _maxPrivateContextBufferSize: 2 _talkTimer: 0 --- !u!82 &1961302931 @@ -84130,7 +84191,7 @@ NavMeshAgent: m_Acceleration: 8 avoidancePriority: 50 m_AngularSpeed: 120 - m_StoppingDistance: 0 + m_StoppingDistance: 0.2 m_AutoTraverseOffMeshLink: 1 m_AutoBraking: 1 m_AutoRepath: 1 @@ -84156,6 +84217,8 @@ MonoBehaviour: toiletTransform: {fileID: 249942518} dancePlace: {fileID: 677901836} toiletLookAtTransform: {fileID: 2024028214} + Developer: {fileID: 1961302929} + _canTakeNewJob: 1 --- !u!114 &1961302941 MonoBehaviour: m_ObjectHideFlags: 0 @@ -84175,6 +84238,18 @@ MonoBehaviour: m_IgnoreFromBuild: 1 m_ApplyToChildren: 1 m_AffectedAgents: ffffffff +--- !u!114 &1961302943 +MonoBehaviour: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 1961302927} + m_Enabled: 1 + m_EditorHideFlags: 0 + m_Script: {fileID: 11500000, guid: f7e417f330c4dd845a8f3dc744dff25a, type: 3} + m_Name: + m_EditorClassIdentifier: --- !u!1 &1961564159 GameObject: m_ObjectHideFlags: 0 @@ -90091,6 +90166,9 @@ PrefabInstance: - targetCorrespondingSourceObject: {fileID: 360020996318003118, guid: c161c997c07308740af96a685231f764, type: 3} insertIndex: -1 addedObject: {fileID: 2100999012} + - targetCorrespondingSourceObject: {fileID: 360020996318003118, guid: c161c997c07308740af96a685231f764, type: 3} + insertIndex: -1 + addedObject: {fileID: 2100999014} m_SourcePrefab: {fileID: 100100000, guid: c161c997c07308740af96a685231f764, type: 3} --- !u!4 &2100998998 stripped Transform: @@ -90113,10 +90191,10 @@ MonoBehaviour: _baseStats: BaseEfficiency: 1 Fingers: 10 - CaffeineDrainFactor: 1 - HungerDrainFactor: 1 - UrinationDrainFactor: 1 - HappinessDrainFactor: 1 + CaffeineDrainFactor: 1.18 + HungerDrainFactor: 1.17 + UrinationDrainFactor: 0.75 + HappinessDrainFactor: 0.97 CoffeePreference: 0.5 MatePreference: 0.5 _talkRange: 2 @@ -90125,16 +90203,17 @@ MonoBehaviour: _caffeineLevel: 1 _hungerLevel: 1 _urgeToUrinateLevel: 1 - _happiness: 0.75 + _happiness: 1 _isSleeping: 0 _isHyperactive: 0 _isOvercaffeinated: 0 - _developerNeeds: {fileID: 1502578694} + _developerNeeds: {fileID: 2100999014} _caffeineNeed: {fileID: 0} _wantedDrink: 0 _hungerNeed: {fileID: 0} _wantedFood: 0 _toiletNeed: {fileID: 0} + _npcAnimation: {fileID: 2100999010} _maxPrivateContextBufferSize: 2 _talkTimer: 0 --- !u!82 &2100999002 @@ -90323,7 +90402,7 @@ NavMeshAgent: m_Acceleration: 8 avoidancePriority: 50 m_AngularSpeed: 120 - m_StoppingDistance: 0 + m_StoppingDistance: 0.2 m_AutoTraverseOffMeshLink: 1 m_AutoBraking: 1 m_AutoRepath: 1 @@ -90349,6 +90428,8 @@ MonoBehaviour: toiletTransform: {fileID: 249942518} dancePlace: {fileID: 677901836} toiletLookAtTransform: {fileID: 2024028214} + Developer: {fileID: 2100999000} + _canTakeNewJob: 1 --- !u!114 &2100999012 MonoBehaviour: m_ObjectHideFlags: 0 @@ -90368,6 +90449,18 @@ MonoBehaviour: m_IgnoreFromBuild: 1 m_ApplyToChildren: 1 m_AffectedAgents: ffffffff +--- !u!114 &2100999014 +MonoBehaviour: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 640532114} + m_Enabled: 1 + m_EditorHideFlags: 0 + m_Script: {fileID: 11500000, guid: f7e417f330c4dd845a8f3dc744dff25a, type: 3} + m_Name: + m_EditorClassIdentifier: --- !u!1 &2101986002 GameObject: m_ObjectHideFlags: 0 diff --git a/3d Prototyp/Assets/Scripts/Developer.cs b/3d Prototyp/Assets/Scripts/Developer.cs index a43e9414..efc2b35f 100644 --- a/3d Prototyp/Assets/Scripts/Developer.cs +++ b/3d Prototyp/Assets/Scripts/Developer.cs @@ -122,6 +122,8 @@ public class Developer : MonoBehaviour private List _needList = new List(); private bool _isDead = false; + [SerializeField] private NPCAnimationController _npcAnimation; + /// /// indicates wether the Dev is dead or not /// @@ -146,6 +148,9 @@ public class Developer : MonoBehaviour private bool _hasTalkedWhileOvercaffeinated = false; private bool _hasTalkedBeforeSleeping = false; + public bool IsOvercaffeinated => _isOvercaffeinated; + public bool IsHyperactive => _isHyperactive; + void Start() { _developerNeeds = gameObject.GetComponent(); @@ -240,6 +245,8 @@ public class Developer : MonoBehaviour _urgeToUrinateLevel -= caffeineAmount / 2.0; _wantedDrink = WantedConsumable.None; + + _npcAnimation.DrinkCoffee(); } public void GiveFood(double foodAmount, WantedConsumable foodType) @@ -307,15 +314,23 @@ public class Developer : MonoBehaviour _caffeineLevel -= caffeineDrain * _baseStats.CaffeineDrainFactor; _hungerLevel -= hungerDrain * _baseStats.HungerDrainFactor; _urgeToUrinateLevel -= urinationDrain * _baseStats.UrinationDrainFactor; - _happiness -= happinessDrain * _baseStats.UrinationDrainFactor; + _happiness -= happinessDrain * _baseStats.HappinessDrainFactor; _caffeineLevel = Math.Max(_caffeineLevel, 0.0); _hungerLevel = Math.Max(_hungerLevel, 0.0); _urgeToUrinateLevel = Math.Max(_urgeToUrinateLevel, 0.0); _happiness = Math.Max(_happiness, 0.0); - + _isHyperactive = _caffeineLevel > 1.0 && _caffeineLevel <= 1.5; + + bool wasOvercaffeinated = _isOvercaffeinated; _isOvercaffeinated = _caffeineLevel > 1.5; + + if (!wasOvercaffeinated && _isOvercaffeinated) + { + _npcAnimation.CaffeinOverdose(); + } + _isSleeping = _caffeineLevel <= 0.0; if (_caffeineLevel < GameManager.Instance.NeedNotificationThreshold && _caffeineNeed == null) @@ -351,6 +366,8 @@ public class Developer : MonoBehaviour _toiletNeed = _developerNeeds.SpawnToiletNeed(_needList.Count); _needList.Add(_toiletNeed); + + _npcAnimation.GoToToilet(); } if (_hungerLevel <= 0.0) @@ -458,11 +475,13 @@ public class Developer : MonoBehaviour private double CalculateUrinationEfficiency() { - if (_urgeToUrinateLevel > 1.0) + if (_urgeToUrinateLevel > GameManager.Instance.NeedNotificationThreshold) return 1.0; // https://easings.net/#easeOutExpo - return Math.Abs(_urgeToUrinateLevel - 1.0) < 0.0001f ? 1.0 : 1.0 - Math.Pow(2, -10 * _urgeToUrinateLevel); + return _urgeToUrinateLevel / GameManager.Instance.NeedNotificationThreshold; + + //Math.Abs(_urgeToUrinateLevel - 1.0) < 0.0001f ? 1.0 : 1.0 - Math.Pow(2, -10 * _urgeToUrinateLevel); } private double CalculateHappinessEfficiency() diff --git a/3d Prototyp/Assets/Scripts/TimeManager.cs b/3d Prototyp/Assets/Scripts/TimeManager.cs index 3aefa1a9..3f04c28b 100644 --- a/3d Prototyp/Assets/Scripts/TimeManager.cs +++ b/3d Prototyp/Assets/Scripts/TimeManager.cs @@ -47,7 +47,14 @@ public class TimeManager : MonoBehaviourSingleton double realSeconds = GameManager.Instance.ExpectedRemainingGameDuration; double gameDays = realSeconds / _secondsPerDay; - return CurrentDate.AddDays(gameDays); + if (double.IsFinite(gameDays)) + { + return CurrentDate.AddDays(gameDays); + } + else + { + return DateTime.MaxValue; + } } } diff --git a/3d Prototyp/Assets/Scripts/UiController.cs b/3d Prototyp/Assets/Scripts/UiController.cs index 7b916c68..512e378b 100644 --- a/3d Prototyp/Assets/Scripts/UiController.cs +++ b/3d Prototyp/Assets/Scripts/UiController.cs @@ -59,7 +59,7 @@ public class UiController : MonoBehaviour { _currentDateText.text = $"Aktuelle Zeit: {TimeManager.Instance.CurrentDate: dddd dd.MM.yy hh U\\hr}"; _deadlineText.text = $"Deadline: {TimeManager.Instance.Deadline: dddd dd.MM.yy hh U\\hr}"; - _predictedEndText.text = $"Vorraussichtlich fertig: {TimeManager.Instance.PredictedEndDate: dddd dd.MM.yy hh U\\hr}"; + _predictedEndText.text = $"Vorraussichtlich fertig: {(TimeManager.Instance.PredictedEndDate == DateTime.MaxValue ? "Nie" : TimeManager.Instance.PredictedEndDate.ToString("dddd dd.MM.yy hh U\\hr"))}"; _predictedEndText.color = _deadlineTextColors.Evaluate(TimeManager.Instance.PredictedMissesDeadline ? 0.0f : 1.0f); } diff --git a/3d Prototyp/Assets/ToiletManager.cs b/3d Prototyp/Assets/ToiletManager.cs new file mode 100644 index 00000000..7063f47e --- /dev/null +++ b/3d Prototyp/Assets/ToiletManager.cs @@ -0,0 +1,9 @@ +using System.Collections; +using System.Collections.Generic; +using UnityEngine; +using Utility; + +public class ToiletManager : MonoBehaviourSingleton +{ + public bool IsOccupied; +} diff --git a/3d Prototyp/Assets/ToiletManager.cs.meta b/3d Prototyp/Assets/ToiletManager.cs.meta new file mode 100644 index 00000000..95e5ff71 --- /dev/null +++ b/3d Prototyp/Assets/ToiletManager.cs.meta @@ -0,0 +1,11 @@ +fileFormatVersion: 2 +guid: 459a8de1571412a44927af6c9cc4ef5e +MonoImporter: + externalObjects: {} + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: + assetBundleName: + assetBundleVariant: