diff --git a/Assets/Scenes/Level_01.unity b/Assets/Scenes/Level_01.unity index 4e5b21753930edd88465275179324a340b8355a7..b7090a46d5d4eb187e0253ddae767015213ab727 100644 --- a/Assets/Scenes/Level_01.unity +++ b/Assets/Scenes/Level_01.unity @@ -1012,7 +1012,7 @@ MonoBehaviour: m_OnCullStateChanged: m_PersistentCalls: m_Calls: [] - m_text: Quest Description + m_text: m_isRightToLeft: 0 m_fontAsset: {fileID: 11400000, guid: 8f586378b4e144a9851e7b34d9b748ee, type: 2} m_sharedMaterial: {fileID: 2180264, guid: 8f586378b4e144a9851e7b34d9b748ee, type: 2} @@ -1130,7 +1130,7 @@ RectTransform: m_AnchorMin: {x: 0, y: 0} m_AnchorMax: {x: 1, y: 1} m_AnchoredPosition: {x: 0, y: 0} - m_SizeDelta: {x: -500, y: -200} + m_SizeDelta: {x: 0, y: 0} m_Pivot: {x: 0.5, y: 0.5} --- !u!114 &223198310 MonoBehaviour: @@ -1145,7 +1145,7 @@ MonoBehaviour: m_Name: m_EditorClassIdentifier: m_Material: {fileID: 0} - m_Color: {r: 0.3490566, g: 0.3490566, b: 0.3490566, a: 0.78431374} + m_Color: {r: 0.11764706, g: 0.11764706, b: 0.29411766, a: 1} m_RaycastTarget: 1 m_RaycastPadding: {x: 0, y: 0, z: 0, w: 0} m_Maskable: 1 @@ -2824,7 +2824,7 @@ MonoBehaviour: m_OnCullStateChanged: m_PersistentCalls: m_Calls: [] - m_text: (0/0) + m_text: m_isRightToLeft: 0 m_fontAsset: {fileID: 11400000, guid: 8f586378b4e144a9851e7b34d9b748ee, type: 2} m_sharedMaterial: {fileID: 2180264, guid: 8f586378b4e144a9851e7b34d9b748ee, type: 2} @@ -3587,7 +3587,7 @@ RectTransform: m_AnchorMin: {x: 0, y: 0} m_AnchorMax: {x: 1, y: 1} m_AnchoredPosition: {x: 0, y: 0} - m_SizeDelta: {x: -600, y: -300} + m_SizeDelta: {x: 0, y: 0} m_Pivot: {x: 0.5, y: 0.5} --- !u!114 &862835715 MonoBehaviour: @@ -3602,7 +3602,7 @@ MonoBehaviour: m_Name: m_EditorClassIdentifier: m_Material: {fileID: 0} - m_Color: {r: 0.3490566, g: 0.3490566, b: 0.3490566, a: 0.78431374} + m_Color: {r: 0.11764706, g: 0.11764706, b: 0.2924528, a: 1} m_RaycastTarget: 1 m_RaycastPadding: {x: 0, y: 0, z: 0, w: 0} m_Maskable: 1 @@ -9668,7 +9668,7 @@ MonoBehaviour: m_OnCullStateChanged: m_PersistentCalls: m_Calls: [] - m_text: Quest Description + m_text: m_isRightToLeft: 0 m_fontAsset: {fileID: 11400000, guid: 8f586378b4e144a9851e7b34d9b748ee, type: 2} m_sharedMaterial: {fileID: 2180264, guid: 8f586378b4e144a9851e7b34d9b748ee, type: 2} @@ -10070,7 +10070,7 @@ MonoBehaviour: m_OnCullStateChanged: m_PersistentCalls: m_Calls: [] - m_text: (0/0) + m_text: m_isRightToLeft: 0 m_fontAsset: {fileID: 11400000, guid: 8f586378b4e144a9851e7b34d9b748ee, type: 2} m_sharedMaterial: {fileID: 2180264, guid: 8f586378b4e144a9851e7b34d9b748ee, type: 2} @@ -11107,7 +11107,7 @@ RectTransform: m_AnchorMin: {x: 0, y: 0} m_AnchorMax: {x: 1, y: 1} m_AnchoredPosition: {x: 0, y: 0} - m_SizeDelta: {x: -700, y: -300} + m_SizeDelta: {x: 0, y: 0} m_Pivot: {x: 0.5, y: 0.5} --- !u!114 &1615574074 MonoBehaviour: @@ -11122,7 +11122,7 @@ MonoBehaviour: m_Name: m_EditorClassIdentifier: m_Material: {fileID: 0} - m_Color: {r: 0.3490566, g: 0.3490566, b: 0.3490566, a: 0.78431374} + m_Color: {r: 0.11764706, g: 0.11764706, b: 0.29411766, a: 1} m_RaycastTarget: 1 m_RaycastPadding: {x: 0, y: 0, z: 0, w: 0} m_Maskable: 1 @@ -12226,8 +12226,12 @@ MonoBehaviour: questDisplayProgress2: {fileID: 635668785} sm: {fileID: 0} shop: {fileID: 1752408730} + player: {fileID: 624092162} enemyManager: {fileID: 192641034} playerGold: {fileID: 624092177} + saveGame: {fileID: 1615574072} + questDisplay: {fileID: 510115068} + inputHandler: {fileID: 624092173} --- !u!114 &1939156179 MonoBehaviour: m_ObjectHideFlags: 0 @@ -12243,6 +12247,7 @@ MonoBehaviour: saveGameAgreement: {fileID: 1615574072} saveGameSlots: {fileID: 223198308} saveGameInput: {fileID: 862835713} + inputHandler: {fileID: 624092173} --- !u!1 &1970749370 GameObject: m_ObjectHideFlags: 0 diff --git a/Assets/Scripts/Command/InputHandler.cs b/Assets/Scripts/Command/InputHandler.cs index e0efc129b218be88a25de2211e2f021f0edc0919..112bf3e4153c8d3835bc8e1dcb9acbdac70c14c7 100644 --- a/Assets/Scripts/Command/InputHandler.cs +++ b/Assets/Scripts/Command/InputHandler.cs @@ -6,6 +6,7 @@ public class InputHandler : MonoBehaviour { public PlayerMovement playerMovement; public PlayerShooting playerShooting; + private bool isSaving = true; //Queue untuk menyimpan list command Queue<Command> commands = new Queue<Command>(); @@ -14,7 +15,7 @@ public class InputHandler : MonoBehaviour { //Menghandle input movement Command moveCommand = InputMovementHandling(); - if (moveCommand != null) + if (moveCommand != null && !isSaving) { commands.Enqueue(moveCommand); @@ -26,7 +27,7 @@ public class InputHandler : MonoBehaviour { //Mengahndle shoot Command shootCommand = InputShootHandling(); - if (shootCommand != null) + if (shootCommand != null && !isSaving) { shootCommand.Execute(); } @@ -85,4 +86,9 @@ public class InputHandler : MonoBehaviour return null; } } + + public void setIsSaving(bool isSaving) + { + this.isSaving = isSaving; + } } diff --git a/Assets/Scripts/Player/PlayerShooting.cs b/Assets/Scripts/Player/PlayerShooting.cs index 43bac0d204b209772a7417209e5d96c19e898fd3..db204b63a489e5d2d431594c486983b68c76768c 100644 --- a/Assets/Scripts/Player/PlayerShooting.cs +++ b/Assets/Scripts/Player/PlayerShooting.cs @@ -100,4 +100,5 @@ public class PlayerShooting : MonoBehaviour gunLine.SetPosition(1, shootRay.origin + shootRay.direction * range); } } + } \ No newline at end of file diff --git a/Assets/Scripts/Quest/QuestManager.cs b/Assets/Scripts/Quest/QuestManager.cs index 69afed134ae84de16f2ce9e116224a4ccaf1ca83..e40a6c43a53f7be30280013fbea72183e9cd6928 100644 --- a/Assets/Scripts/Quest/QuestManager.cs +++ b/Assets/Scripts/Quest/QuestManager.cs @@ -16,7 +16,8 @@ public class QuestManager : MonoBehaviour public TextMeshProUGUI questDisplayProgress2; public ScoreboardManager sm; public GameObject shop; - + public GameObject player; + private List<Tuple<MonsterType, int>> deadMonsters = new List<Tuple<MonsterType, int>>(); private Animator anim; @@ -26,6 +27,12 @@ public class QuestManager : MonoBehaviour public PlayerGold playerGold; + public GameObject saveGame; + public GameObject questDisplay; + public InputHandler inputHandler; + + private bool isTransitioning = true; + void Start() { anim = GetComponent<Animator>(); @@ -72,7 +79,7 @@ public class QuestManager : MonoBehaviour 100 )); - nextQuest(); + StartCoroutine(nextQuest()); } void Update() @@ -83,9 +90,12 @@ public class QuestManager : MonoBehaviour { playerGold.increaseGoldAmount(questItems[activeQuestIdx].getGoldReward()); enemyManager.killAllEnemies(); + isTransitioning = true; + inputHandler.setIsSaving(true); + StartCoroutine(SaveGameActivation()); StartCoroutine(ShopActivation()); activeQuestIdx++; - nextQuest(); + StartCoroutine(nextQuest()); } else if (!questItems[activeQuestIdx].isFinished()) { @@ -111,14 +121,17 @@ public class QuestManager : MonoBehaviour } } deadMonsters.Clear(); - questDisplayProgress.text = "(" + questItems[activeQuestIdx].getCurrentFinished()[0].ToString() + "/" + questItems[activeQuestIdx].getTargetCounts()[0].ToString() + ")"; - if (questItems[activeQuestIdx].getNumSubquests() == 2) + if (!isTransitioning) { - questDisplayProgress2.text = "(" + questItems[activeQuestIdx].getCurrentFinished()[1].ToString() + "/" + questItems[activeQuestIdx].getTargetCounts()[1].ToString() + ")"; - } - else - { - questDisplayProgress2.text = ""; + questDisplayProgress.text = "(" + questItems[activeQuestIdx].getCurrentFinished()[0].ToString() + "/" + questItems[activeQuestIdx].getTargetCounts()[0].ToString() + ")"; + if (questItems[activeQuestIdx].getNumSubquests() == 2) + { + questDisplayProgress2.text = "(" + questItems[activeQuestIdx].getCurrentFinished()[1].ToString() + "/" + questItems[activeQuestIdx].getTargetCounts()[1].ToString() + ")"; + } + else + { + questDisplayProgress2.text = ""; + } } } else { @@ -134,8 +147,9 @@ public class QuestManager : MonoBehaviour } } - void nextQuest() + private IEnumerator nextQuest() { + yield return new WaitForSeconds(3); enemyManager.setQuestNum(activeQuestIdx + 1); List<string> questDescriptions = questItems[activeQuestIdx].getQuestDescriptions(); questNotificationDescription.text = questItems[activeQuestIdx].getQuestTitle(); @@ -148,6 +162,7 @@ public class QuestManager : MonoBehaviour questDisplayDescription2.text = ""; } anim.SetTrigger("NewQuest"); + isTransitioning = false; } public void monsterDeadNotification(MonsterType monsterType, int score) @@ -159,6 +174,15 @@ public class QuestManager : MonoBehaviour { return activeQuestIdx; } + + private IEnumerator SaveGameActivation() + { + yield return new WaitForSeconds(2); + Time.timeScale = 0; + saveGame.SetActive(true); + questDisplay.SetActive(false); + } + private IEnumerator ShopActivation() { Debug.Log("Shop Activated"); @@ -173,7 +197,7 @@ public class QuestManager : MonoBehaviour public void setQuestIdx(int questNum) { this.activeQuestIdx = questNum; - nextQuest(); + StartCoroutine(nextQuest()); } } diff --git a/Assets/Scripts/Save/SaveHandler.cs b/Assets/Scripts/Save/SaveHandler.cs index b664879f8fc9532f5c6606e91d7b2d441604d9b7..d261099b4711cc1f90b15a756092ce1fd24a10f9 100644 --- a/Assets/Scripts/Save/SaveHandler.cs +++ b/Assets/Scripts/Save/SaveHandler.cs @@ -11,6 +11,7 @@ public class SaveHandler : MonoBehaviour public GameObject saveGameAgreement; public GameObject saveGameSlots; public GameObject saveGameInput; + public InputHandler inputHandler; public void OnSaveAgreement() { @@ -44,6 +45,8 @@ public class SaveHandler : MonoBehaviour public void OnSaveDisagreement() { saveGameAgreement.SetActive(false); + Time.timeScale = 1; + inputHandler.setIsSaving(false); } public void OnSaveSlotSelection(int slotIdx) @@ -71,6 +74,8 @@ public class SaveHandler : MonoBehaviour saveName = "SaveSlot" + (slotIdx + 1).ToString(); } OnSaveGame(slotIdx, saveName); + Time.timeScale = 1; + inputHandler.setIsSaving(false); } public void OnSaveInputBack()