ColorSelector.DisableSwap C# (CSharp) Метод

DisableSwap() публичный Метод

public DisableSwap ( ) : void
Результат void
    public void DisableSwap()
    {
        canSwap = false;
    }

Usage Example

Пример #1
0
    IEnumerator Tutorial()
    {
        TutorialText tText = GameObject.Find("TutorialText").GetComponentInChildren <TutorialText> ();

        gridPlaces[60].hexaCube.SlowSpawn(Constants.ChooseColor(2));
        gridPlaces[59].hexaCube.SlowSpawn(Constants.ChooseColor(2));
        gridPlaces[58].hexaCube.SlowSpawn(Constants.ChooseColor(0));
        gridPlaces[57].hexaCube.SlowSpawn(Constants.ChooseColor(2));
        gridPlaces[56].hexaCube.SlowSpawn(Constants.ChooseColor(0));
        gridPlaces[55].hexaCube.SlowSpawn(Constants.ChooseColor(0));
        gridPlaces[54].hexaCube.SlowSpawn(Constants.ChooseColor(0));

        colorSelector.Init(0, 3);
        colorSelector.DisableSwap();

        startScore  = 0;
        targetScore = 4000;

        bool passed    = false;
        int  failcount = 0;

        canFlood   = true;
        canDestroy = false;

        yield return(StartCoroutine(ShowWaitTap(tText, "welcome to hexciter", "(tap to continue)")));

        while (!passed)
        {
            flooded   = false;
            destroyed = false;

            yield return(StartCoroutine(tText.Show("press and hold the center hex", "")));

            yield return(StartCoroutine(WaitForCenterSelect()));

            yield return(StartCoroutine(tText.Hide()));

            colorSelector.GetComponentInChildren <TutorialArrow> ().FadeIn();
            yield return(StartCoroutine(tText.Show("swipe left to flood", "this uses the color shown here")));

            yield return(StartCoroutine(WaitForMoveCenter()));

            colorSelector.GetComponentInChildren <TutorialArrow> ().FadeOut();
            disabled = true;

            //Check if they're purposefully failing
            if (failcount > 4)
            {
                break;
            }

            if (!flooded)
            {
                //did the wrong move
                if (destroyed)
                {
                    failcount++;
                }

                yield return(StartCoroutine(tText.Hide()));

                continue;
            }

            //Player flooded
            passed = true;
        }
        if (!passed)
        {
            StartCoroutine(FailInstructions());
            yield break;
        }
        yield return(StartCoroutine(tText.Hide()));

        yield return(StartCoroutine(ShowWaitTap(tText, "well done!", "the hexes changed color")));

        colorSelector.GetComponentInChildren <TutorialArrow> ().FadeIn();
        yield return(StartCoroutine(ShowWaitTap(tText, "you'll always flood using this color", "(tap to continue)")));

        yield return(StartCoroutine(tText.Show("tap the palette to swap colors", "")));

        colorSelector.EnableSwap();
        yield return(StartCoroutine(WaitForSwap()));

        colorSelector.DisableSwap();
        yield return(StartCoroutine(tText.Hide()));

        colorSelector.GetComponentInChildren <TutorialArrow> ().FadeOut();

        passed     = false;
        canFlood   = false;
        canDestroy = true;

        while (!passed)
        {
            flooded   = false;
            destroyed = false;

            yield return(StartCoroutine(tText.Show("press and hold the center hex", "")));

            yield return(StartCoroutine(WaitForCenterSelect()));

            yield return(StartCoroutine(tText.Hide()));

            yield return(StartCoroutine(tText.Show("swipe right to destroy!", "")));

            yield return(StartCoroutine(WaitForMoveCenter()));

            disabled = true;

            //Check if they're purposefully failing
            if (failcount > 4)
            {
                break;
            }

            if (!destroyed)
            {
                //did the wrong move
                if (flooded)
                {
                    failcount++;
                }

                yield return(StartCoroutine(tText.Hide()));

                continue;
            }

            //Player destroyed
            passed = true;
        }
        if (!passed)
        {
            StartCoroutine(FailInstructions());
            yield break;
        }

        yield return(StartCoroutine(tText.Hide()));

        yield return(StartCoroutine(ShowWaitTap(tText, "destroying hexes earns points", "match the color palette to earn bonus points!")));

        GameObject.Find("GUICamera/MiddleRight").GetComponentInChildren <TutorialArrow> ().FadeIn();
        yield return(StartCoroutine(ShowWaitTap(tText, "as you earn points, this bar fills", "(tap to continue)")));

        GameObject.Find("GUICamera/MiddleRight").GetComponentInChildren <TutorialArrow> ().FadeOut();
        GameObject.Find("GUICamera/MoveProgress/tutorialArrow1").GetComponent <TutorialArrow> ().FadeIn();
        yield return(StartCoroutine(ShowWaitTap(tText, "each turn uses a grey hex", "(tap to continue)")));

        yield return(StartCoroutine(ShowWaitTap(tText, "fill the bar before you use them all!", "(tap to continue)")));

        GameObject.Find("GUICamera/MoveProgress/tutorialArrow1").GetComponent <TutorialArrow> ().FadeOut();

        for (int i = 0; i < 54; i++)
        {
            gridPlaces[i].hexaCube.SlowSpawn(Constants.RandomColor());
        }

        for (int i = 0; i < 6; i++)
        {
            moves.DoMove();
        }

        //GameObject.Find ("GUICamera/MoveProgress/tutorialArrow2").GetComponent<TutorialArrow> ().FadeIn ();

        yield return(StartCoroutine(tText.Show("try making a move yourself", "you have one turn left")));

        disabled  = false;
        flooded   = false;
        destroyed = false;
        colorSelector.EnableSwap();
        targetScore = 8000;
        yield return(StartCoroutine(WaitForMove()));

        //GameObject.Find ("GUICamera/MoveProgress/tutorialArrow2").GetComponent<TutorialArrow> ().FadeOut ();
        while (GridBusy())
        {
            yield return(new WaitForSeconds(0.1f));
        }
        StartCoroutine(NextLevel());
        while (GridBusy())
        {
            yield return(new WaitForSeconds(0.1f));
        }
        yield return(StartCoroutine(tText.Hide()));

        disabled = true;
        colorSelector.DisableSwap();

        yield return(StartCoroutine(ShowWaitTap(tText, "you ran out of turns", "before the score bar was filled")));

        yield return(StartCoroutine(ShowWaitTap(tText, "when the board is empty...", "it's gameover!")));

        yield return(StartCoroutine(ShowWaitTap(tText, "now you're ready to play!", "(tap to start the game)")));

        SocialManager.Instance.UnlockAchievement("hello world");

        FadeCam.Instance.FadeOut(() => { Application.LoadLevel("game"); });
    }