diff --git a/Assets/Scripts/Enemies' Scprits/PatrollingEnemy.cs b/Assets/Scripts/Enemies' Scprits/PatrollingEnemy.cs index 335bfd28..66d460b3 100644 --- a/Assets/Scripts/Enemies' Scprits/PatrollingEnemy.cs +++ b/Assets/Scripts/Enemies' Scprits/PatrollingEnemy.cs @@ -13,7 +13,6 @@ public class PatrollingEnemy : Enemy //public Transform target; public Animator anim; - public int isKilled; //isKilled = 0 - mob ALIVE //isKilled = 1 - mob DEAD diff --git a/Assets/Scripts/REFACTORING/Application/Dialogue/Manager/DialogueManager.cs b/Assets/Scripts/REFACTORING/Application/Dialogue/Manager/DialogueManager.cs index 4952b2f0..4030966d 100644 --- a/Assets/Scripts/REFACTORING/Application/Dialogue/Manager/DialogueManager.cs +++ b/Assets/Scripts/REFACTORING/Application/Dialogue/Manager/DialogueManager.cs @@ -36,9 +36,9 @@ public class DialogueManager : MonoBehaviour /// public bool OpenInDefaultWay = true; - public virtual void Start() + public virtual void Start() { - if(languageDetector.InstanceTemplates.Count() > 0) + if (languageDetector.InstanceTemplates.Count() > 0) { // create and config dailogue CreateInstanceBasedOnLanguage(); @@ -52,6 +52,14 @@ public class DialogueManager : MonoBehaviour { if (OpenInDefaultWay && Input.GetKeyDown(keyToOpen) && OpenPanelCondition()) { + if (languageDetector.InstanceTemplates.Count() > 0) + { + // create and config dailogue + CreateInstanceBasedOnLanguage(); + + Dialogue.BuildCurrentDialogue(); + } + OpenDialoguePanel(); } } diff --git a/Assets/Scripts/REFACTORING/Application/Mission/NpcMissionManager.cs b/Assets/Scripts/REFACTORING/Application/Mission/NpcMissionManager.cs index 915f6b91..d57dfc96 100644 --- a/Assets/Scripts/REFACTORING/Application/Mission/NpcMissionManager.cs +++ b/Assets/Scripts/REFACTORING/Application/Mission/NpcMissionManager.cs @@ -30,8 +30,8 @@ public class NpcMissionManager : DialogueManager // ScriptableObject CanBeOpened = false; OpenInDefaultWay = false; - CreateInstanceBasedOnLanguage(); + CreateInstanceBasedOnLanguage(); // UPDATE DIALOGUE // search in scene manager list @@ -53,7 +53,6 @@ public class NpcMissionManager : DialogueManager // ScriptableObject Mission.BuildMission(); - if (FreeDialogue != null) FreeDialogue.Build(); } @@ -70,6 +69,29 @@ public class NpcMissionManager : DialogueManager // ScriptableObject { CanBeOpened = true; + + CreateInstanceBasedOnLanguage(); + + + // UPDATE DIALOGUE + // search in scene manager list + if (Mission != null) + { + var machedDialogueData = ((MissionDataManager)MissionDataManager.Instance).GetMission(Mission); + + if (machedDialogueData != null) + { + UpdateMissionState(machedDialogueData); + } + else + { + Debug.Log("Start - UpdateProggres"); + UpdateProggres(); + } + } + + Mission.BuildMission(); + Mission.StartDialogue(); } } diff --git a/Assets/Scripts/REFACTORING/Application/NPC/NpcDialogueManager.cs b/Assets/Scripts/REFACTORING/Application/NPC/NpcDialogueManager.cs index d1e8e005..e4501c79 100644 --- a/Assets/Scripts/REFACTORING/Application/NPC/NpcDialogueManager.cs +++ b/Assets/Scripts/REFACTORING/Application/NPC/NpcDialogueManager.cs @@ -15,6 +15,14 @@ public class NpcDialogueManager : DialogueManager CanBeOpened = false; OpenInDefaultWay = false; + if (languageDetector.InstanceTemplates.Count() > 0) + { + // create and config dailogue + CreateInstanceBasedOnLanguage(); + + Dialogue.BuildCurrentDialogue(); + } + // UPDATE DIALOGUE // search in scene manager list if (Dialogue != null) @@ -36,6 +44,31 @@ public class NpcDialogueManager : DialogueManager { if (Input.GetKeyDown(keyToOpen) && OpenPanelCondition()) { + // Refrsh dialogue language and proggres after each opening trial + if (languageDetector.InstanceTemplates.Count() > 0) + { + // create and config dailogue + CreateInstanceBasedOnLanguage(); + + Dialogue.BuildCurrentDialogue(); + } + + // UPDATE DIALOGUE + // search in scene manager list + if (Dialogue != null) + { + var machedDialogueData = ((MultiDialogueDataManager)MultiDialogueDataManager.Instance).GetDialogue(Dialogue); + + if (machedDialogueData != null) + { + UpdateDialogueState(machedDialogueData); + } + else + { + UpdateProggres(); + } + } + OpenDialoguePanel(); } } diff --git a/Assets/Scripts/REFACTORING/Application/NPC/NpcShopManager.cs b/Assets/Scripts/REFACTORING/Application/NPC/NpcShopManager.cs index 6fe83ea9..769d7cb2 100644 --- a/Assets/Scripts/REFACTORING/Application/NPC/NpcShopManager.cs +++ b/Assets/Scripts/REFACTORING/Application/NPC/NpcShopManager.cs @@ -68,6 +68,8 @@ public class NpcShopManager : MonoBehaviour */ if (gameObject.GetComponent().CanBeOpened && Input.GetKeyDown(ShopUIManager.Instance.keyToOpen) && !ShopUIManager.Instance.GetPanelStatus()) { + CreateInstanceBasedOnLanguage(); + // Open dialogue panel (Shop will be opened later) Dialogue.StartDialogue();