public GameObject GetFirstOpenSlot() { for (int i = 0; i < slots.Count; i++) { GameObject slot = slots[i]; BenchSlot benchSlot = slot.GetComponent <BenchSlot>(); if (benchSlot.empty) { return(slot); } } return(null); }
public void SelectSlot(GameObject slotObj) { selectedSlot = slotObj; if (selectedUnit) { print("HAS UNIT"); BenchSlot slot = slotObj.GetComponent <BenchSlot>(); if (slot.empty) { print("NOT EMPTY"); MoveUnitToSlot(selectedUnit, selectedSlot); } } }
public void MoveToSlot(GameObject slotObj) { if (currentTile) { currentTile.RemoveUnit(gameObject); } if (currentSlot) { currentSlot.RemoveUnit(gameObject); } BenchSlot slot = slotObj.GetComponent <BenchSlot>(); currentSlot = slot; transform.position = slot.GetUnitSlotPosition(); slot.PlaceUnit(gameObject); onField = false; }