void Start() { _canvasGroup = GetComponent <CanvasGroup>(); slotParent = GetComponentInParent <DragAndDropSlot>(); _distToRemove = slotParent.childSize.y * 0.85f; }
public void HasChanged(DragAndDropSlot affectedSlot, DragHandler affectedDraggable, DragAndDropSlot fromSlot, DragHandler beingDragged) { SetParent(beingDragged.transform, affectedSlot.transform); SetParent(affectedDraggable.transform, fromSlot.transform); //_canvas.MinionOrderUpdated(fromSlot.index, affectedSlot.index); }
void OnDeleteSlot(DragAndDropSlot slot) { //_canvas.MinionDeleted(slot.index); _slots.Remove(slot); Destroy(slot.gameObject); ReorderSlotsIndeces(); }
public void PointerDrag() { if (dragState == DragStates.notDragging) { if (draggingObj == null) { draggingObj = this.gameObject; } if (this.gameObject == draggingObj) { Vector2 pos; RectTransformUtility.ScreenPointToLocalPointInRectangle(gameCanvas.transform as RectTransform, Input.mousePosition, Camera.main, out pos); draggingObj.transform.position = gameCanvas.transform.TransformPoint(pos); this.gameObject.transform.SetAsLastSibling(); } if (currentSlot != null) { currentSlot.checkedSlot = false; //Descheca o slot atual quando o drag é removido dele if (clearCurrentSlotImage) { currentSlot.ResetSlot(); } currentSlot.receivedSlot = null; currentSlot = null; } } }
void Update() { //TODO/// Change this f*****g shit. if (slotParent.GetInstanceID() != transform.parent.GetInstanceID()) { slotParent = GetComponentInParent <DragAndDropSlot>(); } }
public void ClearCurrentSlot() { currentSlot = null; }