void IPointerExitHandler.OnPointerExit(PointerEventData eventData) { if (DragHandler.commandBeingDragged) { outsidePanel = true; } if (SpawnCMDHandler.commandBeingSpawned) { if (GetComponentsInChildren <TopCommandSlot>().Length == maxCommands) { return; } ExecuteEvents.Execute <IUpdateNumbers>(targetPanel.gameObject, null, (x, y) => x.UpdateNumbers(false)); emptySlot.destructCommand(); Destroy(emptySlot.gameObject); acceptingNewCommand = false; } }
void IHasFinalised.HasFinalised() { int hasDestroied = 0; if (DragHandler.commandBeingDragged) { if (outsidePanel) { TopCommandSlot tobeDiscarded = DragHandler.commandBeingDragged.GetComponentInParent <TopCommandSlot>(); tobeDiscarded.destructCommand(); Destroy(tobeDiscarded.gameObject); hasDestroied = 1; outsidePanel = false; } else { DragHandler.commandBeingDragged.transform.localPosition = Vector2.zero; } } if (SpawnCMDHandler.commandBeingSpawned) { emptySlot.AcceptCommand(SpawnCMDHandler.commandBeingSpawned); acceptingNewCommand = false; emptySlot = null; } //Only shows debugging tool when there are commands in the panel if (GetLength() == hasDestroied) { debugPanel.gameObject.SetActive(false); } else { debugPanel.gameObject.SetActive(true); } }