Example #1
0
    /**
     * 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);
        }
    }
Example #2
0
    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;
    }
Example #3
0
    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);
    }
Example #4
0
 /// <summary>
 /// Sets the current drop zone of the Draggable object to the given drop zone
 /// </summary>
 public abstract void SetDropZone(IDropZone newDropZone);
Example #5
0
 public override void SetDropZone(IDropZone newDropZone)
 {
     dropZone = newDropZone;
 }
Example #6
0
 public override void SetDropZone(IDropZone list)
 {
     this.dropZone = list;
 }