diff --git a/Assets/Scenes/Level_01.unity b/Assets/Scenes/Level_01.unity index 7555078c758d827372d245c062821977c319f3bd..dadff502a454c5a49dbf26619e214e2d7d1c2057 100644 --- a/Assets/Scenes/Level_01.unity +++ b/Assets/Scenes/Level_01.unity @@ -9705,7 +9705,7 @@ MonoBehaviour: m_EditorClassIdentifier: playerHealth: {fileID: 1968172701} enemy: {fileID: 152446141947964431, guid: 126948bc699e7da61ac66269cd743206, type: 3} - spawnTime: 3 + spawnTime: 10 spawnPoints: - {fileID: 1269603458} --- !u!4 &1605377956 @@ -9737,7 +9737,7 @@ MonoBehaviour: m_EditorClassIdentifier: playerHealth: {fileID: 1968172701} enemy: {fileID: 3972810617495639857, guid: 9a8837d6dea5bbb4498e9b639db329a0, type: 3} - spawnTime: 3 + spawnTime: 10 spawnPoints: - {fileID: 264091982} --- !u!114 &1605377958 @@ -9754,7 +9754,7 @@ MonoBehaviour: m_EditorClassIdentifier: playerHealth: {fileID: 1968172701} enemy: {fileID: 3663767924688358501, guid: 0d52eb49463a1ffc3a65c5e65d42d89f, type: 3} - spawnTime: 3 + spawnTime: 10 spawnPoints: - {fileID: 557110022} --- !u!1 &1679437323 diff --git a/Assets/Scripts/Pet/Attacker.cs b/Assets/Scripts/Pet/Attacker.cs index 98e45c765a5eac7985ea45871d848f256b29a97c..c2a11b0fcc6aecc1d2714d38c50932b8c9cfdced 100644 --- a/Assets/Scripts/Pet/Attacker.cs +++ b/Assets/Scripts/Pet/Attacker.cs @@ -40,7 +40,7 @@ public class Attacker : MonoBehaviour Debug.Log("menjauhi enemy"); nav.SetDestination(4*transform.position-3*closestEnemy.transform.position); anim.SetTrigger("Jump"); - }else if (distanceEnemy < 5 && timer>1.0f) + }else if (distanceEnemy < 3 && timer>1.0f) { eh.TakeDamage(10,new Vector3(0,0,0)); petAudio.clip = attackClip; diff --git a/Assets/Scripts/Quest/QuestDetail.cs b/Assets/Scripts/Quest/QuestDetail.cs index 84693da12f84a62d937d0b859c70fdee63eb8b93..e56382b62cd6eb302b8f01eb2efcd28f3481a597 100644 --- a/Assets/Scripts/Quest/QuestDetail.cs +++ b/Assets/Scripts/Quest/QuestDetail.cs @@ -20,6 +20,9 @@ public class QuestDetail : MonoBehaviour, IDataPersistence public static int zombearKilled; public static int zombunnyKilled; public static int hellephantKilled; + public static bool isQuestFinished=false; + float interval=5.0f; + float timer=5.0f; // Start is called before the first frame update void Start() @@ -41,8 +44,12 @@ public class QuestDetail : MonoBehaviour, IDataPersistence // Update is called once per frame void Update() { - QuestingMechanishm(); - + timer += Time.deltaTime; + if(timer >= interval) + { + QuestingMechanishm(); + } + if(onQuest == true && Panel.activeSelf == false) { OpenQuestStatus(); @@ -55,6 +62,8 @@ public class QuestDetail : MonoBehaviour, IDataPersistence public void questDone (){ QuestDescription.message= "\nCongrats! You have completed the quest"; onQuest = false; + timer=0.0f; + isQuestFinished=true; } public void OpenPanel(){ @@ -79,6 +88,7 @@ public class QuestDetail : MonoBehaviour, IDataPersistence SaveButton.SetActive(false); onQuest = true; + isQuestFinished = false; } if(onQuest== false && questLevel == 3) { @@ -92,6 +102,7 @@ public class QuestDetail : MonoBehaviour, IDataPersistence SaveButton.SetActive(false); onQuest = true; + isQuestFinished = false; } if(onQuest== false && questLevel == 6) { @@ -105,6 +116,7 @@ public class QuestDetail : MonoBehaviour, IDataPersistence SaveButton.SetActive(false); onQuest = true; + isQuestFinished = false; } @@ -119,6 +131,7 @@ public class QuestDetail : MonoBehaviour, IDataPersistence SaveButton.SetActive(false); onQuest = true; + isQuestFinished = false; } if(onQuest == true){ diff --git a/Assets/Scripts/Shopkeeper/ShopkeeperDetector.cs b/Assets/Scripts/Shopkeeper/ShopkeeperDetector.cs index 77a3b7b4f89099df4acaed130ae5dbb7f497f6ff..d79eb95cb696d2523e5e949e2f7712735a42ed8d 100644 --- a/Assets/Scripts/Shopkeeper/ShopkeeperDetector.cs +++ b/Assets/Scripts/Shopkeeper/ShopkeeperDetector.cs @@ -6,6 +6,8 @@ public class ShopkeeperDetector : MonoBehaviour { public ShopkeeperManager sm; + bool isShopping=false; + bool inside=false; // Start is called before the first frame update void Start() { @@ -15,20 +17,36 @@ public class ShopkeeperDetector : MonoBehaviour // Update is called once per frame void Update() { - if(Input.GetKey("c")) + if(Input.GetKey("c") && isShopping) { Time.timeScale=1; sm.HideShop(); + isShopping = false; } + + if(QuestDetail.isQuestFinished && Input.GetKey("o") && !isShopping && inside) + { + Debug.Log("masuk"); +Â Â Â Â Â Â Â Â Â Â Â Time.timeScale = 0; +Â Â Â Â Â Â Â Â Â Â Â sm.ShowShop(); + isShopping = true; + } } private void OnTriggerEnter(Collider other) Â Â Â { Â Â Â Â Â Â Â if (other.tag == "Player" && !other.isTrigger) Â Â Â Â Â Â Â { -Â Â Â Â Â Â Â Â Â Â Â Debug.Log("masuk"); -Â Â Â Â Â Â Â Â Â Â Â Time.timeScale = 0; -Â Â Â Â Â Â Â Â Â Â Â sm.ShowShop(); + inside=true; +Â Â Â Â Â Â Â } +Â Â Â } + + private void OnTriggerExit(Collider other) +Â Â Â { +Â Â Â Â Â Â Â if (other.tag == "Player" && !other.isTrigger) +Â Â Â Â Â Â Â { + inside=false; Â Â Â Â Â Â Â } Â Â Â } + }