From a8b90c30b664d91d5738f9815bc068ee29b78208 Mon Sep 17 00:00:00 2001
From: Malik Rafsanjani <pro.malikakbar2357@gmail.com>
Date: Sun, 16 Apr 2023 13:15:26 +0700
Subject: [PATCH] feat: show shop temporary only

---
 Assets/Scripts/Quest/Temple/Temple.cs | 25 ++++++++++++++++++++++++-
 Assets/Scripts/Shops/ShopCollider.cs  | 15 +++++++++++++--
 2 files changed, 37 insertions(+), 3 deletions(-)

diff --git a/Assets/Scripts/Quest/Temple/Temple.cs b/Assets/Scripts/Quest/Temple/Temple.cs
index b43992e..8321b77 100644
--- a/Assets/Scripts/Quest/Temple/Temple.cs
+++ b/Assets/Scripts/Quest/Temple/Temple.cs
@@ -55,10 +55,24 @@ public class Temple : MonoBehaviour
         }
     }
 
+    private GameObject shop;
+    public GameObject Shop
+    {
+        get
+        {
+            if (shop == null)
+            {
+                shop = GameObject.Find("Environment/stall_001");
+            }
+
+            return shop;
+        }
+    }
+
     // Start is called before the first frame update
     void Start()
     {
-        
+        Shop.SetActive(false);
     }
 
     // Update is called once per frame
@@ -83,8 +97,17 @@ public class Temple : MonoBehaviour
         timer.StartTimer();
     }
 
+    private IEnumerator ShowShop()
+    {
+        Shop.SetActive(true);
+        yield return new WaitForSeconds(30f);
+        Shop.SetActive(false);
+    }
+
     private void ExitingQuest()
     {
+        StartCoroutine(ShowShop());
+
         var reward = questNumberEnemy.Reward;
         GameControl.control.addCurrency(reward);
         timer.StopTimer();
diff --git a/Assets/Scripts/Shops/ShopCollider.cs b/Assets/Scripts/Shops/ShopCollider.cs
index 2f68f3f..fdd22b8 100644
--- a/Assets/Scripts/Shops/ShopCollider.cs
+++ b/Assets/Scripts/Shops/ShopCollider.cs
@@ -29,6 +29,12 @@ public class ShopCollider : MonoBehaviour
         }
     }
 
+    private void OnDisable()
+    {
+        Close();
+        shop.SetActive(false);
+    }
+
     private void OnCollisionEnter(Collision other)
     {
         if(!temple.OnQuest && other.gameObject.name.Equals("Player"))
@@ -42,8 +48,13 @@ public class ShopCollider : MonoBehaviour
     {
         if(other.gameObject.name.Equals("Player"))
         {
-            stall_state = false;
-            Hud.CloseMessagePanel();
+            Close();
         }
     }
+
+    private void Close()
+    {
+        stall_state = false;
+        Hud.CloseMessagePanel();
+    }
 }
-- 
GitLab