Esempio n. 1
0
    public void OnEndDrag(PointerEventData eventData)
    {
        //Debug.Log("OnEndDrag");
        SoundManager.instance.RandomizeSound(dropSound1, dropSound2);

        this.transform.SetParent(parentToReturnTo);
        this.transform.SetSiblingIndex(placeholder.transform.GetSiblingIndex());
        GetComponent <CanvasGroup>().blocksRaycasts = true;

        this.transform.localScale = this.transform.localScale / 1.3f;

        Destroy(placeholder);
        SetDiscardCountTextDnD();

        //to reactive as soon as the blockers' parameters are met
        blueBlocker.SetActive(DropZone.discardNum <= 1);
        redBlocker.SetActive(DropZone.discardNum <= 2);
        projBlocker.SetActive(DropZone.discardNum <= 4);
        if (GetComponent <Score>().determineWorldNum == 1 || GetComponent <Score>().determineWorldNum == 2 ||
            GetComponent <Score>().determineWorldNum == 3 || GetComponent <Score>().determineWorldNum == 4 ||
            GetComponent <Score>().determineWorldNum == 5 || GetComponent <Score>().determineWorldNum == 6 ||
            GetComponent <Score>().determineWorldNum == 7 || GetComponent <Score>().determineWorldNum == 8 ||
            GetComponent <Score>().determineWorldNum == 9 || GetComponent <Score>().determineWorldNum == 10)
        {
            Debug.Log("this works");
            greyBlocker.SetActive(false);
        }
        else
        {
            Debug.Log("this is working instead");
            greyBlocker.SetActive(Score.greyCountFromDnD >= 3 /*&& GetComponent<Score>().worldBlocker.activeSelf == true*/);
        }


        if (typeOfItem == Slot.GREY ||
            typeOfItem == Slot.BLUE ||
            typeOfItem == Slot.RED ||
            typeOfItem == Slot.PROJ ||
            typeOfItem == Slot.WORLD)
        {
            DragAndDrop.Slot s = parentToReturnTo.GetComponent <DropZone>().typeOfItem;
            typeOfItem = s;
        }

        cardPrefab = GameObject.FindWithTag("greyCard");

        if (typeOfItem == Slot.DISCARD)
        {
            Destroy(cardPrefab);
            //Debug.Log("discarded card");
        }
    }
Esempio n. 2
0
 public abstract void Drop(Slot slot, ObjectContainer fromContainer);
Esempio n. 3
0
 public virtual bool CanDrop(Draggable dragged, Slot slot)
 {
     return(true);
 }