Exemple #1
0
    private void HandleShowResult(ShowResult result)
    {
        Time.timeScale = 1.0f;
        switch (result)
        {
        case ShowResult.Finished:
            Debug.Log("The ad was successfully shown.");
            if (!bonusControl.BonusStat())
            {
                bonusControl.EnableBonus();
            }
            break;

        case ShowResult.Skipped:
            Debug.Log("The ad was skipped before reaching the end.");
            break;

        case ShowResult.Failed:
            Debug.LogError("The ad failed to be shown.");
            break;
        }
    }
Exemple #2
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();
                }
            }
        }
    }