コード例 #1
0
ファイル: DropSlot.cs プロジェクト: cri699/SEP4
    public void OnDrop(PointerEventData eventData)
    {
        Draggable d = eventData.pointerDrag.GetComponent <Draggable>();

        if (d != null && isOccupied != true)
        {
            if (this.gameObject.tag.Equals("DropSlot") && Draggable.inPlacingPhase == true)
            {
                d.placedSlot = this.slotNumber;
                pp.addCard(eventData.pointerDrag.gameObject);

                isOccupied     = true;
                d.canBeDragged = false;
                d.wasPlaced    = true;
            }
            else if (this.gameObject.tag.Equals("DropSlot"))
            {
                pp.addCardInRemember(eventData.pointerDrag.gameObject);
                d.rememberSlot = this.slotNumber;
                isOccupied     = true;
                d.canBeDragged = false;
            }



            eventData.pointerDrag.transform.position = this.transform.position;
            if (this.transform.tag.Equals("inventory"))
            {
                Debug.Log("Got here");

                d.transform.SetParent(GameObject.Find("Content").transform);
                d.canBeDragged = true;
                return;
            }
            d.currentParent = this.transform;
            isOccupied      = true;
            d.lastParent    = this.transform;
        }
    }