// Start is called before the first frame update void Start() { AttackOne.onClick.AddListener(() => { GameManager.Instance.TriggerAttack(0); }); AttackTwo.onClick.AddListener(() => { GameManager.Instance.TriggerAttack(1); }); AttackOne.GetComponent <SlotUI>().OnObjectEquipped += OnObjectEquipped; AttackTwo.GetComponent <SlotUI>().OnObjectEquipped += OnObjectEquipped; _slotPrefab = Grid.GetComponentInChildren <SlotUI>(); if (_slotPrefab != null) { _slots = new SlotUI[12]; for (int i = 0; i < 12; ++i) { SlotUI s = Instantiate(_slotPrefab, Grid.transform); s.gameObject.name = $"Slot[{i}]"; s.InventoryIndex = i; s.OnObjectDropped += ChangeInventory; _slots[i] = s; } } _slotPrefab.gameObject.SetActive(false); GameManager.Instance.Player.OnItemMoved += OnItemMoved; GameManager.OnInventoryDisplay += () => { Grid.gameObject.SetActive(!Grid.gameObject.activeSelf); }; }