/** * Set the drop zone this block belongs too, handler */ public override void SetDropZone(IDropZone list) { var isoDropZone = list as IsoDropZone; if (isoDropZone != null) { SetDropZone(isoDropZone); } }
private void OnDrop(IDropZone newDropZone) { newDropZone.OnDrop(this); if (OnDropZoneChanged != null) { OnDropZoneChanged(newDropZone); } foreach (var item in connectedItems) { newDropZone.OnDrop(item); item.dropZone = newDropZone; item.MoveTo(item.HomePos); } dropZone = newDropZone; }
void OnMouseUp() { dragging = false; // if the item is in a dropzone, drop the item into it if (inDropZone) { MoveTo(homePos); } // otherwise, move the item back to its original position linearly else { endPosition = transform.position; float ratio = moveTimer / moveSeconds; transform.position = Vector3.Lerp(startPosition, endPosition, ratio); moveTimer = 0; } if (newDropZones.Count > 0) { if (dropZone != null) { dropZone.OnItemRemove(this); } newDropZones[0].OnDrop(this); dropZone = newDropZones[0]; newDropZones.Clear(); } else { if (dropZone != null) { dropZone.OnDragFinish(this); } } // move the player back to home position MoveTo(homePos); }
/// <summary> /// Sets the current drop zone of the Draggable object to the given drop zone /// </summary> public abstract void SetDropZone(IDropZone newDropZone);
public override void SetDropZone(IDropZone newDropZone) { dropZone = newDropZone; }
public override void SetDropZone(IDropZone list) { this.dropZone = list; }