Exemple #1
0
    void Update()
    {
#if UNITY_ADS
        if (Advertisement.IsReady("rewardedVideo") && !bonusControl.BonusStat())
        {
            AdButton.interactable = true;
        }
        else
        {
            AdButton.interactable = false;
        }
#endif
    }
Exemple #2
0
    void Update()
    {
        RaycastHit    hit;
        Ray           ray;
        CloudBehavior casual;
        int           indx;

        foreach (Touch touch in Input.touches)
        {
            indx = (int)touch.fingerId;
            ray  = Camera.main.ScreenPointToRay(touch.position);
            switch (touch.phase)
            {
            case TouchPhase.Began:
                if (Physics.Raycast(ray, out hit, 20.0f))
                {
                    switch (hit.collider.tag)
                    {
                    case "Cloud":
                        casual = hit.collider.gameObject.GetComponent <CloudBehavior>();
                        if ((casual.state != 1) && bonusTouch)
                        {
                            casual.turnWhite();
                            bonusTouch = false;
                            GameControl.ClearWayCloud();
                        }
                        else
                        {
                            casual.cloudID = indx;
                            casual.cloudSelect();
                        }
                        break;

                    case "Bonus":
                        if (bonusControl.BonusStat())
                        {
                            bonusTouch = true;
                            bonusControl.EmptyBonus();
                        }
                        break;
                    }
                }
                break;

            case TouchPhase.Canceled:
                GameControl.CloudVerify();
                break;

            case TouchPhase.Ended:
                GameControl.CloudVerify();
                break;

            case TouchPhase.Moved:
                if (Physics.Raycast(ray, out hit, 20.0f))
                {
                    if (hit.collider.tag == "Cloud")
                    {
                        casual         = hit.collider.gameObject.GetComponent <CloudBehavior>();
                        casual.cloudID = indx;
                        casual.cloudSelect();
                    }
                }
                break;

            case TouchPhase.Stationary:
                if (Physics.Raycast(ray, out hit, 20.0f))
                {
                    if (hit.collider.tag == "Cloud")
                    {
                        casual         = hit.collider.gameObject.GetComponent <CloudBehavior>();
                        casual.cloudID = indx;
                        casual.cloudSelect();
                    }
                }
                break;
            }
        }
    }
Exemple #3
0
    public void CloudVerify()
    {
        Vector2[] vect;
        vect = new Vector2 [3];
        int  vectCount = 0;
        bool stat      = true;

        for (int i = 0; i < powerClouds; i++)
        {
            for (int j = 0; j < powerClouds; j++)
            {
                if (cloudMatrix [i] [j].GetComponent <CloudBehavior> ().cloudID > -1)
                {
                    if (vectCount == 0)
                    {
                        vect [vectCount] = new Vector2(i, j);
                        vectCount        = 1;
                        stat             = true;
                    }
                    else if (stat)
                    {
                        if ((Mathf.Abs((int)vect [vectCount - 1].x - i) == 1 && Mathf.Abs((int)vect [vectCount - 1].y - j) == 1))
                        {
                            if (vectCount < 3)
                            {
                                vect [vectCount] = new Vector2(i, j);
                                vectCount       += 1;
                                stat             = true;
                            }
                            else
                            {
                                stat = false;
                            }
                        }
                        else
                        {
                            stat = false;
                        }
                    }
                    cloudMatrix [i] [j].GetComponent <CloudBehavior> ().cloudID = -1;
                    cloudMatrix [i] [j].GetComponent <CloudBehavior> ().turnCloud();
                }
            }
        }
        if (vectCount >= 2 && vectCount <= 3 && stat)
        {
            switch (vectCount)
            {
            case 2:
                if (cloudMatrix [(int)vect [0].x] [(int)vect [0].y].GetComponent <CloudBehavior> ().state == 1)
                {
                    if (cloudMatrix [(int)vect [1].x] [(int)vect [1].y].GetComponent <CloudBehavior> ().state == 2)
                    {
                        cloudMatrix [(int)vect [0].x] [(int)vect [0].y].GetComponent <CloudBehavior> ().turnGray();
                        cloudMatrix [(int)vect [1].x] [(int)vect [1].y].GetComponent <CloudBehavior> ().turnWhite();
                    }
                    else
                    {
                        stat = false;
                    }
                }
                else if (cloudMatrix [(int)vect [0].x] [(int)vect [0].y].GetComponent <CloudBehavior> ().state == 2)
                {
                    if (cloudMatrix [(int)vect [1].x] [(int)vect [1].y].GetComponent <CloudBehavior> ().state == 1)
                    {
                        cloudMatrix [(int)vect [0].x] [(int)vect [0].y].GetComponent <CloudBehavior> ().turnWhite();
                        cloudMatrix [(int)vect [1].x] [(int)vect [1].y].GetComponent <CloudBehavior> ().turnGray();
                    }
                    else
                    {
                        stat = false;
                    }
                }
                break;

            case 3:
                if (cloudMatrix [(int)vect [0].x] [(int)vect [0].y].GetComponent <CloudBehavior> ().state == 3)
                {
                    if (cloudMatrix [(int)vect [1].x] [(int)vect [1].y].GetComponent <CloudBehavior> ().state == 1)
                    {
                        if (cloudMatrix [(int)vect [2].x] [(int)vect [2].y].GetComponent <CloudBehavior> ().state == 1)
                        {
                            cloudMatrix [(int)vect [0].x] [(int)vect [0].y].GetComponent <CloudBehavior> ().turnWhite();
                            cloudMatrix [(int)vect [1].x] [(int)vect [1].y].GetComponent <CloudBehavior> ().turnGray();
                            cloudMatrix [(int)vect [2].x] [(int)vect [2].y].GetComponent <CloudBehavior> ().turnGray();
                        }
                        else
                        {
                            stat = false;
                        }
                    }
                    else
                    {
                        stat = false;
                    }
                }
                else if (cloudMatrix [(int)vect [2].x] [(int)vect [2].y].GetComponent <CloudBehavior> ().state == 3)
                {
                    if (cloudMatrix [(int)vect [0].x] [(int)vect [0].y].GetComponent <CloudBehavior> ().state == 1)
                    {
                        if (cloudMatrix [(int)vect [1].x] [(int)vect [1].y].GetComponent <CloudBehavior> ().state == 1)
                        {
                            cloudMatrix [(int)vect [0].x] [(int)vect [0].y].GetComponent <CloudBehavior> ().turnGray();
                            cloudMatrix [(int)vect [1].x] [(int)vect [1].y].GetComponent <CloudBehavior> ().turnGray();
                            cloudMatrix [(int)vect [2].x] [(int)vect [2].y].GetComponent <CloudBehavior> ().turnWhite();
                        }
                        else
                        {
                            stat = false;
                        }
                    }
                    else
                    {
                        stat = false;
                    }
                }
                break;
            }
        }
        if (stat)
        {
            ClearWayCloud();
            gamePoints += vectCount - 1;
            if ((gamePoints % 20) == 0)
            {
                if (!bonusControl.BonusStat())
                {
                    bonusControl.EnableBonus();
                }
            }
        }
    }