Ejemplo n.º 1
0
    public void SetObjSelected(BoxTTS box)
    {
        if ((box.nextHorizontal != null || box.prevHorizontal != null) && (box.nextVertical != null || box.prevVertical != null))
        {
            Debug.Log("Persimpangan");
            SetObjSelected(box, Arah.Horizontal);
            return;
        }

        SoundBase.MAIN.PlaySound("Klik");

        if (Mathf.Abs(RightSoal.localPosition.x) < 1)
        {
            ShowRight();
        }

        int count = boxSelectedParent.childCount;

        for (int i = 0; i < count; i++)
        {
            boxSelectedParent.GetChild(0).GetComponent <BoxTTS>().setToSelected();
            boxSelectedParent.GetChild(0).GetChild(1).gameObject.SetActive(false);
            boxSelectedParent.GetChild(0).SetParent(boxNotSelectedParent);
        }

        List <GameObject> allObj = new List <GameObject>();

        box.activateSelected(ref allObj, ref currentArah, ref currentBtts);


        if (currentBtts == null)
        {
            Debug.Log("BTTS NULL");
            return;
        }


        foreach (GameObject obj in allObj)
        {
            obj.transform.SetParent(boxSelectedParent);
        }
        currentBtts.setToFocus();

        cameraTarget    = currentBtts.transform.position;
        cameraTarget.z  = -10;
        cameraTarget.y -= 3;
        movingCamera    = true;
    }
Ejemplo n.º 2
0
    public void activateSelected(ref List <GameObject> allBoxObj, ref Arah currArah, ref BoxTTS prior)
    {
        // Jika dia adalah persimpangan
        if ((nextHorizontal != null || prevHorizontal != null) && (nextVertical != null || prevVertical != null))
        {
            this.gameObject.name = "persimpangan";
            Debug.Log("Persimpangan");
            return;
        }

        allBoxObj.Add(this.gameObject);
        backCol.gameObject.SetActive(true);
        setToSelected();

        if (_currentAnswer == "")
        {
            prior = this;
        }


        if (nextHorizontal != null || prevHorizontal != null)
        {
            currArah = Arah.Horizontal;
            if (nextHorizontal != null && _currentAnswer != "")
            {
                nextHorizontal.activateSelected(Arah.Horizontal, true, ref allBoxObj, ref prior);
            }
            else if (nextHorizontal != null)
            {
                nextHorizontal.activateSelected(Arah.Horizontal, true, ref allBoxObj);
            }
            else
            {
                prior = this;
            }


            if (prevHorizontal != null && _currentAnswer == "")
            {
                prevHorizontal.activateSelected(Arah.Horizontal, false, ref allBoxObj, ref prior);
            }
            else if (prevHorizontal != null)
            {
                prevHorizontal.activateSelected(Arah.Horizontal, false, ref allBoxObj);
            }
        }
        else if (nextVertical != null || prevVertical != null)
        {
            currArah = Arah.Vertical;
            if (nextVertical != null && _currentAnswer != "")
            {
                nextVertical.activateSelected(Arah.Vertical, true, ref allBoxObj, ref prior);
            }
            else if (nextVertical != null)
            {
                nextVertical.activateSelected(Arah.Vertical, true, ref allBoxObj);
            }
            else
            {
                prior = this;
            }



            if (prevVertical != null && _currentAnswer == "")
            {
                prevVertical.activateSelected(Arah.Vertical, false, ref allBoxObj, ref prior);
            }
            else if (prevVertical != null)
            {
                prevVertical.activateSelected(Arah.Vertical, false, ref allBoxObj);
            }
        }
    }