From 2f7df8d55e9346bf7adce0da0164c63516349af2 Mon Sep 17 00:00:00 2001 From: Anonymous Raccoon <32224410+AnonymusRaccoon@users.noreply.github.com> Date: Tue, 14 Aug 2018 11:03:22 +0200 Subject: [PATCH] Adding a start menu UI code. --- Assets/Script/InventoryManager.cs | 8 ++++++++ Assets/Script/Mission.cs | 3 ++- 2 files changed, 10 insertions(+), 1 deletion(-) diff --git a/Assets/Script/InventoryManager.cs b/Assets/Script/InventoryManager.cs index 1a9f6bd..82bffb5 100644 --- a/Assets/Script/InventoryManager.cs +++ b/Assets/Script/InventoryManager.cs @@ -13,7 +13,9 @@ public class InventoryManager : MonoBehaviour public Tilemap selectorMap; public TileBase[] selector; public TextMeshProUGUI turnCount; + public GameObject StartUI; public AudioSource music; + private bool started = false; [Space] public GameObject[] slots; @@ -64,6 +66,12 @@ public class InventoryManager : MonoBehaviour } draggedPosition = -1; } + if(!started && Input.anyKeyDown) + { + started = true; + StartUI.SetActive(false); + GetComponent().Initiate(); + } if (Input.GetKeyDown(KeyCode.R)) { ClearBoard(); diff --git a/Assets/Script/Mission.cs b/Assets/Script/Mission.cs index 90cd8ce..6f5a473 100644 --- a/Assets/Script/Mission.cs +++ b/Assets/Script/Mission.cs @@ -20,7 +20,8 @@ public class Mission : MonoBehaviour { TreeItem[] items; public GameObject WinUI; public GameObject LooseUI; - private void Start() + + public void Initiate() { items = GetComponent().items; if(items == null)