diff --git a/Assets/Resources/NPC/WizardHouse/WizardController.controller b/Assets/Resources/NPC/WizardHouse/WizardController.controller index 9ae3c14c..47118203 100644 --- a/Assets/Resources/NPC/WizardHouse/WizardController.controller +++ b/Assets/Resources/NPC/WizardHouse/WizardController.controller @@ -88,7 +88,7 @@ BlendTree: - serializedVersion: 2 m_Motion: {fileID: 7400000, guid: b900c5133de323a46a58498a00abc987, type: 2} m_Threshold: 0 - m_Position: {x: 0, y: -1} + m_Position: {x: 0, y: 1} m_TimeScale: 1 m_CycleOffset: 0 m_DirectBlendParameter: Blend @@ -96,7 +96,7 @@ BlendTree: - serializedVersion: 2 m_Motion: {fileID: 7400000, guid: 3233cd06998b20547adc8836d0a3f51a, type: 2} m_Threshold: 0.33333334 - m_Position: {x: 0, y: 1} + m_Position: {x: 0, y: -1} m_TimeScale: 1 m_CycleOffset: 0 m_DirectBlendParameter: Blend @@ -117,8 +117,8 @@ BlendTree: m_CycleOffset: 0 m_DirectBlendParameter: Blend m_Mirror: 0 - m_BlendParameter: moveX - m_BlendParameterY: moveY + m_BlendParameter: Xinfo + m_BlendParameterY: Yinfo m_MinThreshold: 0 m_MaxThreshold: 1 m_UseAutomaticThresholds: 1 @@ -139,13 +139,13 @@ AnimatorController: m_DefaultInt: 0 m_DefaultBool: 0 m_Controller: {fileID: 0} - - m_Name: moveX + - m_Name: Xinfo m_Type: 1 m_DefaultFloat: 0 m_DefaultInt: 0 m_DefaultBool: 0 m_Controller: {fileID: 0} - - m_Name: moveY + - m_Name: Yinfo m_Type: 1 m_DefaultFloat: 0 m_DefaultInt: 0 diff --git a/Assets/Scripts/ChangeScene.cs b/Assets/Scripts/ChangeScene.cs index 31e305f4..687bbe4c 100644 --- a/Assets/Scripts/ChangeScene.cs +++ b/Assets/Scripts/ChangeScene.cs @@ -38,6 +38,7 @@ public class ChangeScene : MonoBehaviour if(collision.gameObject.tag == "AnimatedDoorSceneTransition") { Debug.Log("Starting coroutine"); + StartCoroutine(WaitForAnimationAndMoveToScene(0.3f, collision)); } } diff --git a/Assets/Scripts/Door/TriggerDoor.cs b/Assets/Scripts/Door/TriggerDoor.cs index ed7592bf..38f67c4d 100644 --- a/Assets/Scripts/Door/TriggerDoor.cs +++ b/Assets/Scripts/Door/TriggerDoor.cs @@ -5,7 +5,7 @@ using UnityEngine; public class TriggerDoor : DetectionZone { public string DoorOpenAnimatorParamName = "DoorOpen"; - + public static bool ableToOpen = false; Animator animator; void Start(){ @@ -15,6 +15,8 @@ public class TriggerDoor : DetectionZone void Update() { if(detectedObjs.Count > 0) { animator.SetBool(DoorOpenAnimatorParamName, true); + ableToOpen = true; + } else { animator.SetBool(DoorOpenAnimatorParamName, false); } diff --git a/Assets/Scripts/NPCs' Scripts/NPCFollowing.cs b/Assets/Scripts/NPCs' Scripts/NPCFollowing.cs index 9b303d8d..29030665 100644 --- a/Assets/Scripts/NPCs' Scripts/NPCFollowing.cs +++ b/Assets/Scripts/NPCs' Scripts/NPCFollowing.cs @@ -1,5 +1,6 @@ using System.Collections; using System.Collections.Generic; +using GUI_Scripts.ProceduralGeneration; using UnityEngine; [RequireComponent(typeof(NPC))] @@ -69,6 +70,7 @@ public class NPCFollowing : MonoBehaviour public void CheckDistance() { + anim.SetBool("isRunning", true); StopAllCoroutines(); if (isAfterAction == false) @@ -78,13 +80,14 @@ public class NPCFollowing : MonoBehaviour agent.FindPath(); StartCoroutine(agent.FollowPath()); + } else if (approaching) { //start dialogue here gameObject.GetComponent().State = NPCStateEnum.Talking; - + anim.SetBool("isRunning", false); agent.path.Clear(); // if we are able to talgk we dont want go go further player } } @@ -105,6 +108,7 @@ public class NPCFollowing : MonoBehaviour } else { + anim.SetBool("isChasing", false); gameObject.GetComponent().State = NPCStateEnum.Pending; } } diff --git a/Assets/Scripts/Pathfinding/AStarPathfindingAgent.cs b/Assets/Scripts/Pathfinding/AStarPathfindingAgent.cs index 9bc99c15..f6f1f9ec 100644 --- a/Assets/Scripts/Pathfinding/AStarPathfindingAgent.cs +++ b/Assets/Scripts/Pathfinding/AStarPathfindingAgent.cs @@ -53,6 +53,14 @@ public class AStarPathfindingAgent : MonoBehaviour { Pathfinder.FindPath(transform.position, point, this); } + + public void ControlAnim() + { + moveX = point.x - transform.position.x; + moveY = point.y - transform.position.y; + myAnim.SetFloat("Yinfo", moveY); + myAnim.SetFloat("Xinfo", moveX); + } public IEnumerator FollowPath() { @@ -101,8 +109,10 @@ public class AStarPathfindingAgent : MonoBehaviour myAnim.SetBool("Left", false); } - moveX = point.x - current.x; - moveY = point.y - current.y; + //moveX = path[targetIndex].worldPosition.x - current.x; + //moveY = path[targetIndex].worldPosition.y - current.y; + moveX = point.x - current.x; + moveY = point.y - current.y; myAnim.SetFloat("Yinfo", moveY); myAnim.SetFloat("Xinfo", moveX); diff --git a/Assets/Scripts/SceneManager/NPC/NPCManager.cs b/Assets/Scripts/SceneManager/NPC/NPCManager.cs index 4b841fad..d5207ea4 100644 --- a/Assets/Scripts/SceneManager/NPC/NPCManager.cs +++ b/Assets/Scripts/SceneManager/NPC/NPCManager.cs @@ -46,9 +46,14 @@ public class NPCManager : MonoBehaviour { throw new Exception("Object not found"); } - CreateThugs(); - CreateBossThug(); + if (GameObject.FindGameObjectWithTag("EnemyCollection").transform.Find(bossThug.name) == null) + { + Debug.Log("Build me :D"); + CreateBossThug(); + CreateThugs(); + } } + private void CreateThugs() { @@ -83,6 +88,7 @@ public class NPCManager : MonoBehaviour private void CreateBossThug() { + Debug.Log("BOSS THUG IS CREATED!"); var modelBossThug = Resources.Load("SampleScene/Enemies/BossThug") as GameObject; var BossThugClone = GameObject.Instantiate(modelBossThug, bossThug.position, Quaternion.identity, NPCCollection.transform); diff --git a/UserSettings/EditorUserSettings.asset b/UserSettings/EditorUserSettings.asset index fa36b319..5827d731 100644 --- a/UserSettings/EditorUserSettings.asset +++ b/UserSettings/EditorUserSettings.asset @@ -6,35 +6,35 @@ EditorUserSettings: serializedVersion: 4 m_ConfigSettings: RecentlyUsedScenePath-0: - value: 22424703114646680e0b0227036c7c151b12163e2d3a3f7e38271427fb - flags: 0 - RecentlyUsedScenePath-1: - value: 22424703114646680e0b0227036c72111f1958072926337e38271427fb - flags: 0 - RecentlyUsedScenePath-2: value: 22424703114646680e0b0227036c72111f19352f223d667d6d0a123df6f23b34f1a923e7ee2e26 flags: 0 - RecentlyUsedScenePath-3: + RecentlyUsedScenePath-1: value: 200b1b3316501b4842040d290521103419001626232922236202182ac0e93a3cf1a817faf43f2b2f7631ec390a3b4f2afc031d12 flags: 0 - RecentlyUsedScenePath-4: + RecentlyUsedScenePath-2: value: 22424703114646680e0b0227036c7c1102161b25212a357e38271427fb flags: 0 - RecentlyUsedScenePath-5: + RecentlyUsedScenePath-3: value: 22424703114646680e0b0227036c761e1821112620292135633c133af6f9 flags: 0 - RecentlyUsedScenePath-6: + RecentlyUsedScenePath-4: value: 22424703114646680e0b0227036c7c1100123d24383a273e2e2c5326ece92021 flags: 0 - RecentlyUsedScenePath-7: - value: 22424703114646680e0b0227036c6c111b07142f1f2b233e2867083debf42d + RecentlyUsedScenePath-5: + value: 22424703114646680e0b0227036c791904040c1c25242a312a2c5326ece92021 flags: 0 - RecentlyUsedScenePath-8: + RecentlyUsedScenePath-6: value: 22424703114646680e0b0227036c70050204112e291f2f2a2c3b1920caef212be7a923e7ee2e26 flags: 0 - RecentlyUsedScenePath-9: + RecentlyUsedScenePath-7: + value: 22424703114646680e0b0227036c72111f1958072926337e38271427fb + flags: 0 + RecentlyUsedScenePath-8: value: 22424703114646680e0b0227036c68190c160a2e042733232867083debf42d flags: 0 + RecentlyUsedScenePath-9: + value: 22424703114646680e0b0227036c6c111b07142f1f2b233e2867083debf42d + flags: 0 vcSharedLogLevel: value: 0d5e400f0650 flags: 0