예제 #1
0
    public void OnDrop(PointerEventData eventData)
    {
        DragFicha d = eventData.pointerDrag.GetComponent <DragFicha>();

        if (d != null)
        {
            if (this.transform.name == "ZonaFichas")
            {
                d.parentToReturnTo = this.transform;
            }
            else if (this.transform.name == "TableroJuego")
            {
                Transform miniDrop = boardCalculations.MeasureDistance(d.transform);
                if (miniDrop != null)
                {
                    d.parentToReturnTo = this.transform.GetChild(0).transform;
                    d.SetChip(miniDrop.GetComponent <RectTransform> ());
                }
                else
                {
                    //Si se suelta en el tablero de juego demasiado lejos ed cualquier miniDrop, se llama a ColocarFicha
                    //y se utiliza como parentToReturn ZonAFichas (que se le asigna en OnBeginDrag)
                    d.SetChip(null);
                }
            }
            else    //SI ES ZONA DE DROP INICIAL
            {
                d.parentToReturnTo = this.transform.parent;
                d.SetChip(this.transform.GetComponent <RectTransform>());
                RecoverInitialColor();
            }
        }
    }
예제 #2
0
    override public void CleanAllBoard()
    {
        stackChipSet.Clear();
        dropHereTableroJuego.enabled = false;
        isFirstChipSet   = false;
        currentWord.text = "";
        timeWithoutSet   = 0;
        List <DragFicha> cleanListChips = new List <DragFicha>(); //Usamos esta lista para no quitar hijos mientras los busca. Primero buscamos y luego quitamos.

        foreach (Transform child in chipsSet.transform)
        {
            DragFicha componente = child.GetComponent <DragFicha>();
            if (child.tag == "MiniDrop")
            {
                child.gameObject.SetActive(false);
            }
            if (componente != null)
            {
                cleanListChips.Add(componente);
            }
        }

        foreach (DragFicha chip in cleanListChips)   //Tras haberlo buscado, ya los podemos quitar.
        {
            print(chip.transform.name + "ESTA SIENDO ENABLED");
            chip.enabled = true;
            print(chip.transform.name + " ES " + chip.enabled);
            chip.BackToInitialPosition();
        }

        //Recuperar zona de drop grande y recolocar en el centro.
        initialDropZone.SetActive(true);
        chipsSet.transform.localPosition = Vector3.zero;
        if (powerupFirstChipSet)
        {
            firstCorrectChip.GetComponent <DragFicha>().shouldSound      = false;
            firstCorrectChip.GetComponent <DragFicha>().parentToReturnTo = chipsSet.transform;
            firstCorrectChip.GetComponent <DragFicha>().SetChip(initialDropZone.transform.GetComponent <RectTransform>());           //Al limpiar el tablero vuelve a poner la primera ficha colocada.
        }
    }
예제 #3
0
    public void cleanAllBoard()
    {
        dropHereTableroJuego.enabled = false;
        primeraFichaColocada         = false;
        palabraFormada.text          = "";
        tiempoSinColocar             = 0;
        List <DragFicha> fichasAColocar = new List <DragFicha>();

        foreach (Transform child in fichasColocadas.transform)
        {
            DragFicha componente = child.GetComponent <DragFicha>();

            if (child.tag == "MiniDrop")
            {
                child.gameObject.SetActive(false);
            }

            if (componente != null)
            {
                fichasAColocar.Add(componente);
            }
        }

        foreach (DragFicha ficha in fichasAColocar)
        {
            ficha.enabled = true;
            ficha.volverAMiPosicionInicial();
        }
        //3. Recuperar zona de drop grande y recolocar en el centro.
        zonaDropInicial.SetActive(true);
        fichasColocadas.transform.localPosition = Vector3.zero;
        if (powerUpPrimeraFichaColocada)
        {
            primeraFichaCorrecta.GetComponent <DragFicha>().deboSonar        = false;
            primeraFichaCorrecta.GetComponent <DragFicha>().parentToReturnTo = fichasColocadas.transform;
            primeraFichaCorrecta.GetComponent <DragFicha>().ColocarFicha(zonaDropInicial.transform.GetComponent <RectTransform>());
        }
    }
예제 #4
0
    override public void CleanAllBoard()
    {
        dropHereTableroJuego.enabled = false;
        isFirtsChipSet   = false;
        currentWord.text = "";
        timeWithoutSet   = 0;
        List <DragFicha> recolocationChips = new List <DragFicha>();

        foreach (Transform child in chipsSet.transform)
        {
            DragFicha componente = child.GetComponent <DragFicha>();
            if (child.tag == "MiniDrop")
            {
                child.gameObject.SetActive(false);
            }
            if (componente != null)
            {
                recolocationChips.Add(componente);
            }
        }

        foreach (DragFicha chip in recolocationChips)
        {
            chip.enabled = true;
            chip.volverAMiPosicionInicial();
        }

        //Recuperar zona de drop grande y recolocar en el centro.
        initialDropZone.SetActive(true);
        chipsSet.transform.localPosition = Vector3.zero;
        if (powerupFirstChipSet)
        {
            firstCorrectChip.GetComponent <DragFicha>().deboSonar        = false;
            firstCorrectChip.GetComponent <DragFicha>().parentToReturnTo = chipsSet.transform;
            firstCorrectChip.GetComponent <DragFicha>().ColocarFicha(initialDropZone.transform.GetComponent <RectTransform>());
        }
    }
예제 #5
0
    override public void CleanAllBoard()
    {
        stackChipSet.Clear();
        dropHereTableroJuego.enabled = false;
        currentWord.text             = "";
        List <DragFicha> cleanListChips = new List <DragFicha>(); //Usamos esta lista para no quitar hijos mientras los busca. Primero buscamos y luego quitamos.

        foreach (Transform child in chipsSet.transform)
        {
            DragFicha componente = child.GetComponent <DragFicha>();
            if (child.tag == "MiniDrop")
            {
                child.gameObject.SetActive(false);
            }
            if (componente != null)
            {
                cleanListChips.Add(componente);
            }
        }

        foreach (DragFicha chip in cleanListChips)
        {
            chip.enabled = true;
            chip.BackToInitialPosition();
        }

        //Recuperar zona de drop grande y recolocar en el centro.
        initialDropZone.SetActive(true);
        chipsSet.transform.localPosition = Vector3.zero;
        if (powerupFirstChipSet)
        {
            firstCorrectChip.GetComponent <DragFicha>().shouldSound      = false;
            firstCorrectChip.GetComponent <DragFicha>().parentToReturnTo = chipsSet.transform;
            firstCorrectChip.GetComponent <DragFicha>().SetChip(initialDropZone.transform.GetComponent <RectTransform>());
        }
    }