diff --git a/Assets/Graphics.meta b/Assets/Graphics.meta deleted file mode 100644 index 2f27852dee817f89c3c9f3c670d67c4e8a201894..0000000000000000000000000000000000000000 --- a/Assets/Graphics.meta +++ /dev/null @@ -1,8 +0,0 @@ -fileFormatVersion: 2 -guid: eec83b50c1e0c604aa91430f72c8dbb0 -folderAsset: yes -DefaultImporter: - externalObjects: {} - userData: - assetBundleName: - assetBundleVariant: diff --git a/Assets/InteractionEngine/Character_Animations/CharacterDialog.cs b/Assets/InteractionEngine/Character_Animations/CharacterDialog.cs index 9007d6872d06a91fce20832e7c658364f0edb801..928f988a3766479708f8d0e8cfb8f97e2aefb2d6 100644 --- a/Assets/InteractionEngine/Character_Animations/CharacterDialog.cs +++ b/Assets/InteractionEngine/Character_Animations/CharacterDialog.cs @@ -9,9 +9,12 @@ public class CharacterDialog : MonoBehaviour public TextMeshPro textDisplay; public TextMeshPro textHint; public string[] sentences; - private int index; + private int sentenceIndex; + private int letterIndex = 0; + private bool typingActive = false; //speed for typing the Text public float typingSpeed; + private float timer = 0; //Only reset once after Player is out of range of the TaskCharacter private bool textReseted = true; @@ -23,12 +26,15 @@ void Start() { CommunicationEvents.PushoutFactEvent.AddListener(PushoutSucceededSentence); //Type first sentence - StartCoroutine(Type()); + typingActive = true; + TypeFkt(); } private void Update() { + TypeFkt(); + if(!pushoutSucceeded && Input.GetKeyDown(KeyCode.Return) && TaskCharakterAnimation.getPlayerInTalkingZone()) { //Type Next sentence if player is in the talkinZone around the TaskCharacter AND the player typed the return-Key @@ -43,20 +49,48 @@ private void Update() //Type a sentence slowly IEnumerator Type() { - foreach (char letter in sentences[index].ToCharArray()) { + foreach (char letter in sentences[sentenceIndex].ToCharArray()) { textDisplay.text += letter; yield return new WaitForSeconds(typingSpeed); } } + public void TypeFkt() { + if (typingActive) + { + if (this.timer >= this.typingSpeed) + { + if (letterIndex < sentences[sentenceIndex].Length) + { + textDisplay.text += sentences[sentenceIndex].ToCharArray()[letterIndex]; + letterIndex++; + } + else + { + this.typingActive = false; + letterIndex = 0; + } + + this.timer = 0; + } + else + { + this.timer += Time.deltaTime; + } + } + } + public void NextSentence() { //-2 because the last sentence is only for SucceededPushout-Purposes - if (index < sentences.Length - 2) + if (sentenceIndex < sentences.Length - 2) { - index++; + sentenceIndex++; + letterIndex = 0; + typingActive = true; + timer = 0; textDisplay.text = ""; - StartCoroutine(Type()); + TypeFkt(); textReseted = false; } else { @@ -65,21 +99,27 @@ public void NextSentence() { } public void ResetSentence() { - index = 0; + sentenceIndex = 0; + letterIndex = 0; + typingActive = true; + timer = 0; textDisplay.text = ""; //Type first sentence again - StartCoroutine(Type()); + TypeFkt(); textReseted = true; } public void PushoutSucceededSentence(Fact startFact) { textDisplay.text = ""; //Last Sentence is the Pushout-Sentence - index = sentences.Length - 1; + sentenceIndex = sentences.Length - 1; + letterIndex = 0; + typingActive = true; + timer = 0; pushoutSucceeded = true; //Disable Hint With Enter-Key for Talking textHint.GetComponent<MeshRenderer>().enabled = false; //Type final message - StartCoroutine(Type()); + TypeFkt(); } } diff --git a/Assets/InteractionEngine/Character_Animations/TaskCharakterAnimation.cs b/Assets/InteractionEngine/Character_Animations/TaskCharakterAnimation.cs index de2542feac43c1546906fc5f245c7b408695c9be..0c3cec17a14a7ba5c771247b0e127c8a355e312d 100644 --- a/Assets/InteractionEngine/Character_Animations/TaskCharakterAnimation.cs +++ b/Assets/InteractionEngine/Character_Animations/TaskCharakterAnimation.cs @@ -64,6 +64,11 @@ void Update() else { //disable enter-key for talking setPlayerInTalkingZone(false); + //Change to walking State after Talking Zone so that player can stay inside the radiusAroundObject + rotate = false; + this.timer = 0; + //Change boolean for switching to Walking-State in AnimationController + anim.SetBool("standing", false); } //Calculate distance from tree, so that the TaskCharacter only walks in a specific radius around the tree @@ -142,6 +147,18 @@ public void stopHappy(Fact startFact) { //Set Variable in animationController to change the state anim.SetBool("solved", false); happy = false; + resetToStart(); + } + + public void resetToStart() { + //On Reset: Player must go into walking state, because it could be that after the happy/running-animation the player is + //out of radius and rotates -> AnimationController StateMachine always changes into walking-state after hyppAnimation + walking = true; + standing = false; + rotate = true; + nextRotation = 0; + rotationUnits = 0; + playerInTalkingZone = false; } //Static Method for CharacterDialog diff --git a/Assets/InventoryStuff/Inventory.meta b/Assets/InventoryStuff/Inventory.meta deleted file mode 100644 index 9818e1d19efb2406338d62594c7ffb0012b023e8..0000000000000000000000000000000000000000 --- a/Assets/InventoryStuff/Inventory.meta +++ /dev/null @@ -1,8 +0,0 @@ -fileFormatVersion: 2 -guid: b543d9677cbde534ab69c0a229bfdb06 -folderAsset: yes -DefaultImporter: - externalObjects: {} - userData: - assetBundleName: - assetBundleVariant: diff --git a/Assets/Polytope Studio/Lowpoly Medieval Characters/Sources/Animations/Anim_controllers/PT_Medieval_Peasant_01_e_Animator Controller.controller b/Assets/Polytope Studio/Lowpoly Medieval Characters/Sources/Animations/Anim_controllers/PT_Medieval_Peasant_01_e_Animator Controller.controller index 8a86e00846c1b0b3a39ed2e123ae98e8cb2280c2..cd62b77b26a681cdcf7feb6393b8edb5dd93c022 100644 --- a/Assets/Polytope Studio/Lowpoly Medieval Characters/Sources/Animations/Anim_controllers/PT_Medieval_Peasant_01_e_Animator Controller.controller +++ b/Assets/Polytope Studio/Lowpoly Medieval Characters/Sources/Animations/Anim_controllers/PT_Medieval_Peasant_01_e_Animator Controller.controller @@ -14,13 +14,13 @@ AnimatorController: m_DefaultFloat: 0 m_DefaultInt: 0 m_DefaultBool: 0 - m_Controller: {fileID: 0} + m_Controller: {fileID: 9100000} - m_Name: solved m_Type: 4 m_DefaultFloat: 0 m_DefaultInt: 0 m_DefaultBool: 0 - m_Controller: {fileID: 0} + m_Controller: {fileID: 9100000} m_AnimatorLayers: - serializedVersion: 5 m_Name: Base Layer @@ -55,9 +55,6 @@ AnimatorStateTransition: m_PrefabAsset: {fileID: 0} m_Name: m_Conditions: - - m_ConditionMode: 2 - m_ConditionEvent: standing - m_EventTreshold: 0 - m_ConditionMode: 2 m_ConditionEvent: solved m_EventTreshold: 0 @@ -100,34 +97,6 @@ AnimatorStateTransition: m_InterruptionSource: 0 m_OrderedInterruption: 1 m_CanTransitionToSelf: 1 ---- !u!1101 &1101526424927387364 -AnimatorStateTransition: - m_ObjectHideFlags: 1 - m_CorrespondingSourceObject: {fileID: 0} - m_PrefabInstance: {fileID: 0} - m_PrefabAsset: {fileID: 0} - m_Name: - m_Conditions: - - m_ConditionMode: 1 - m_ConditionEvent: standing - m_EventTreshold: 0 - - m_ConditionMode: 2 - m_ConditionEvent: solved - m_EventTreshold: 0 - m_DstStateMachine: {fileID: 0} - m_DstState: {fileID: 1102119675311824806} - m_Solo: 0 - m_Mute: 0 - m_IsExit: 0 - serializedVersion: 3 - m_TransitionDuration: 0 - m_TransitionOffset: 0 - m_ExitTime: 3 - m_HasExitTime: 0 - m_HasFixedDuration: 1 - m_InterruptionSource: 0 - m_OrderedInterruption: 1 - m_CanTransitionToSelf: 1 --- !u!1101 &1101676305976220748 AnimatorStateTransition: m_ObjectHideFlags: 1 @@ -271,7 +240,6 @@ AnimatorState: m_CycleOffset: 0 m_Transitions: - {fileID: 1101065367606003302} - - {fileID: 1101526424927387364} m_StateMachineBehaviours: [] m_Position: {x: 50, y: 50, z: 0} m_IKOnFeet: 0 diff --git a/Assets/Scenes.meta b/Assets/Scenes.meta deleted file mode 100644 index 157e8818897d6ed29501f87f879801a120255f46..0000000000000000000000000000000000000000 --- a/Assets/Scenes.meta +++ /dev/null @@ -1,8 +0,0 @@ -fileFormatVersion: 2 -guid: ac72be71662640f4ab0aaf102090fb95 -folderAsset: yes -DefaultImporter: - externalObjects: {} - userData: - assetBundleName: - assetBundleVariant: