using Managers; using UnityEngine; // DebugManager is a singleton that persists between scenes and is used to log debug messages. // It is used to trigger events for testing purposes. As well as give items to the player. // It is also used to spawn items in the world. public class DebugManager : MonoBehaviour { public static DebugManager Instance { get; private set; } private void Awake() { if (Instance == null) { Instance = this; DontDestroyOnLoad(gameObject); HotkeyManager.Instance.RegisterHotkey("Give Random Item", KeyCode.F2, GiveRandomItem); } else { Destroy(gameObject); } } private void GiveRandomItem() { var item = GameItemManager.Instance.GetRandomItem(); PlayerManager.Instance.AddItemToInventorySlot(item); } public void SpawnItemInWorld(GameItem item) { var itemPrefab = PrefabManager.Instance.GetItemPrefab(); Instantiate(itemPrefab, new Vector3(0, 0, 0), Quaternion.identity); // todo: assign to a tile in the world } public void SpawnItemInWorld(GameItem item, Vector3 position) { var itemPrefab = PrefabManager.Instance.GetItemPrefab(); Instantiate(itemPrefab, position, Quaternion.identity); } // spawn box in world with random items in it public void SpawnBoxInWorld() { // var boxPrefab = PrefabManager.Instance.GetBoxPrefab(); // Instantiate(boxPrefab, new Vector3(0, 0, 0), Quaternion.identity); } }