public void EndDrag(AbilityUIElement abilityUIElement, GameObject onto) { if (onto == null) { //Debug.Log("EndDrag onto nothing"); CancelDrag(abilityUIElement); return; } if (onto.GetComponent <AbilityUIElement>() != null) { if (onto == tempUISlot) { //Debug.Log("Same object"); CancelDrag(abilityUIElement); return; } //Debug.Log("EndDrag onto another element"); AbilityUIElement other = onto.GetComponent <AbilityUIElement>(); CancelDrag(abilityUIElement); if (other.IsEmpty) { other.Setup(abilityUIElement.ability); abilityUIElement.Reset(); } else { SpecialAttack temp = other.ability; other.Setup(abilityUIElement.ability); abilityUIElement.Setup(temp); } } else if (onto.transform == availableAbilitiesContainer || onto.transform == selectedAbilitiesContainer) { Debug.Log("EndDrag onto container"); CancelDrag(abilityUIElement); GetEmptySlot(onto.transform).Setup(abilityUIElement.ability); abilityUIElement.Reset(); } else { CancelDrag(abilityUIElement); } ShowHideStartButton(); }
public void Move(AbilityUIElement abilityUI) { AbilityUIElement newSlot = null; if (abilityUI.transform.parent == availableAbilitiesContainer && NotEmptyAmount(selectedAbilitiesContainer) < amountToSelect) { newSlot = GetEmptySlot(selectedAbilitiesContainer); } else if (abilityUI.transform.parent == selectedAbilitiesContainer) { newSlot = GetEmptySlot(availableAbilitiesContainer); } if (newSlot == null) { Debug.Log("Can't find empty slot"); } newSlot.Setup(abilityUI.ability); abilityUI.Reset(); ShowHideStartButton(); }