示例#1
0
    protected override IEnumerator Execute()
    {
        KinectDeviceManager.Instance.BeginBodyTracking();

        memoryCanvas.SetActive(false);
        startScreen.SetActive(true);
        startScreenText.text = StringRes.Get("_GetReady");

        progressBar.enabled = true;
        yield return(timer.UITimer(timeBeforeStart, progressBarMask, startScreenCountdown));

        progressBar.enabled = false;

        startScreenText.text = "";
        startScreen.SetActive(false);
        memoryCanvas.SetActive(true);


        BodyDisplay.Instance.OnBeginDisplay();

        int remainingRounds = maximumRounds;

        unsolved  = new List <MemoryCard>(cards);
        tempStack = new List <MemoryCard>();
        solved    = new List <MemoryCard>();

        while (unsolved.Count > 0)
        {
            remainingRounds--;

            yield return(CardShowingStage());

            taskText.text = StringRes.Get("_MotionGuess");

            yield return(timer.SimpleTimer(timeBetweenShowingAndGuessing));

            yield return(CardGuessingPhase());

            if (remainingRounds == 0)
            {
                break;
            }

            yield return(timer.SimpleTimer(timeBetweenRounds));
        }

        BodyDisplay.Instance.OnStopDisplay();
        taskText.text = "";

        memoryCanvas.SetActive(false);
        startScreen.SetActive(true);

        if (unsolved.Count <= 0)
        {
            ConfettiBurst();
        }
        startScreenText.text = (unsolved.Count > 0) ? StringRes.Get("_NoRoundsRemaining") : StringRes.Get("_Win");

        AppManager.bodyTrackingRunning = false;
    }
    protected override IEnumerator Execute()
    {
        int remainingRounds = conf.rounds;

        while (remainingRounds > 0)
        {
            Panel.SetActive(true);
            //Debug.Log("starting Round: " + maxRounds);
            for (int i = 0; i < MAX_SENTENCES; i++)
            {
                PaintPicture();
                sentenceArray[i].text = grammars.PrintSentence();
                progressBar.enabled   = true;
                yield return(timer.UITimer(conf.drawingTime, progressBarMask, remainingTimeText));

                progressBar.enabled = false;
            }

            Panel.SetActive(false);
            curtain.GetComponentInChildren <CurtainOpen>().MoveCurtain();
            remainingRounds--;

            yield return(timer.SimpleTimer(conf.showingTime));

            if (remainingRounds == 0)
            {
                yield break;
            }

            curtain.GetComponentInChildren <CurtainOpen>().MoveCurtain();
            foreach (TextMeshProUGUI t in sentenceArray)
            {
                t.text = "";
            }

            //Array.Clear(sentenceArray, 0, sentenceArray.Length);
            //Debug.Log("waiting 10 to restart");
            yield return(timer.SimpleTimer(10));

            foreach (GameObject presentOb in presentGameObjects)
            {
                Destroy(presentOb);
            }

            presentGameObjects.Clear();
        }
    }