Exemplo n.º 1
0
    IEnumerator CardShowingStage()
    {
        taskText.text = StringRes.Get("_MotionMemorize");

        yield return(timer.SimpleTimer(timeBetweenCardsShowing));

        int remainingGroupSize = unsolved.Count < maxGroupSize ? unsolved.Count : maxGroupSize;

        for (int i = 0; i < remainingGroupSize; i++)
        {
            MemoryCard card = unsolved[GetRandom(unsolved.Count)];
            BeginShowPose(card);
            //wait for minimum accuracy or minimum time to pass
            progressBar.enabled = true;
            yield return(timer.UITimer(cardShowingTime, progressBarMask, remainingTimeText));

            progressBar.enabled = false;
            StopShowPose(card);

            tempStack.Add(card);
            unsolved.Remove(card);
            if (i < remainingGroupSize)
            {
                yield return(timer.SimpleTimer(timeBetweenCardsShowing));
            }
        }
    }
Exemplo n.º 2
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 Init()
    {
        headerText.text = StringRes.Get("_RoomCalibration");

        KinectDeviceManager.Instance.BeginBodyTracking();
        return(base.Init());
    }
Exemplo n.º 4
0
 void DisplayLanguageText()
 {
     header.text          = StringRes.Get("_MainMenuHeader");
     triviaQuizBtn.text   = StringRes.Get("_TriviaQuizName");
     motionMemoryBtn.text = StringRes.Get("_MotionMemoryName");
     duplikBtn.text       = StringRes.Get("_DuplikName");
     virtualWorldBtn.text = StringRes.Get("_EnterVirtualWorld");
     moCapStudioBtn.text  = StringRes.Get("_MoCapStudio");
     saveExitBtn.text     = StringRes.Get("_SaveAndReturn");
 }
    protected override IEnumerator Execute()
    {
        yield return(new WaitForSeconds(1));

        int cornersToConfigure = 3;

        Vector3[] corners = new Vector3[cornersToConfigure];
        BodyDisplay.PositionCompare hRC = BodyDisplay.handRaisedCompare;

        for (int i = 0; i < cornersToConfigure; i++)
        {
            taskText.text = StringRes.Get("_GoToCorner");
            //glow a lamp
            //show UI Text
            //leave some time for the person to raise their hand
            //save the position in the corners[]

            float remainingTime = TIMEOUT;
            while (remainingTime > 0f)
            {
                remainingTime -= Time.deltaTime;
                yield return(null);

                if (BodyDisplay.Instance.JointCompare(JointId.Head, JointId.HandLeft, hRC) ||
                    BodyDisplay.Instance.JointCompare(JointId.Head, JointId.HandRight, hRC)
                    )
                {
                    Vector3 position = BodyDisplay.Instance.GetBodyPosition();
                    Instantiate(cornerMarker, position, Quaternion.Euler(90, 0, 0));
                    corners[i] = position;
                    //Debug.Log("DetectedHandRaised! Set Corner at " + position);
                    yield return(new WaitForSeconds(3));

                    //set corner at position
                    break;
                }
            }
            if (remainingTime <= 0f)
            {
                Debug.LogError("Corner Configuration timed out");
                yield break;
            }
        }

        RoomManager.Instance.CreateRoom(corners, true);
        yield break;
    }
Exemplo n.º 6
0
    void Start()
    {
        VirtualWorldController.Instance.FlipMainSceneControl();

        GameObject canvas = GameObject.FindGameObjectWithTag("MainCanvas");

        transform.SetParent(canvas.transform, false);

        for (int i = 0; i < buildIndizes.Length; i++)
        {
            Button btn = Instantiate(buttonPrefab);
            int    v   = i; //no idea why this is nessessary
            btn.onClick.AddListener(delegate { Choose(buildIndizes[v]); });
            btn.gameObject.GetComponentInChildren <Text>().text = StringRes.Get(stringRes[i]);
            btn.transform.SetParent(transform, false);
        }
    }
Exemplo n.º 7
0
    /*
     * public static void ResolveLimbConstraints(Limb[] limbConstraints)
     * {
     *  AppConfig.LimbConstraints = new JointId[0];
     *
     *  foreach (var constraint in limbConstraints)
     *  {
     *      int upper, lower;
     *      switch (constraint)
     *      {
     *          case Limb.UPPER_BODY:
     *              lower = (int)Limb.UPPER_BODY;
     *              upper = lower + 17;
     *              break;
     *          case Limb.LOWER_BODY:
     *              lower = (int)Limb.LOWER_BODY;
     *              upper = lower + 7;
     *              break;
     *          case Limb.LEFT_ARM_UPPER:
     *              lower = (int)Limb.LEFT_ARM_UPPER;
     *              upper = lower + 5;
     *              break;
     *          case Limb.LEFT_ARM_LOWER:
     *              lower = (int)Limb.LEFT_ARM_LOWER;
     *              upper = lower + 4;
     *              break;
     *          case Limb.RIGHT_ARM_UPPER:
     *              lower = (int)Limb.RIGHT_ARM_UPPER;
     *              upper = lower + 5;
     *              break;
     *          case Limb.RIGHT_ARM_LOWER:
     *              lower = (int)Limb.RIGHT_ARM_LOWER;
     *              upper = lower + 4;
     *              break;
     *          case Limb.LEFT_LEG_UPPER:
     *              lower = (int)Limb.LEFT_LEG_UPPER + 1;
     *              upper = lower + 3;
     *              break;
     *          case Limb.LEFT_LEG_LOWER:
     *              lower = (int)Limb.LEFT_LEG_LOWER;
     *              upper = lower + 2;
     *              break;
     *          case Limb.RIGHT_LEG_UPPER:
     *              lower = (int)Limb.RIGHT_LEG_UPPER;
     *              upper = lower + 3;
     *              break;
     *          case Limb.RIGHT_LEG_LOWER:
     *              lower = (int)Limb.RIGHT_LEG_LOWER;
     *              upper = lower + 2;
     *              break;
     *      }
     *  }
     * }
     */

    public static bool Initialize()
    {
        if (!LoadConfig())
        {
            return(false);
        }

        if (!StringRes.LoadStringResources())
        {
            return(false);
        }

        //ResolveLimbConstraints(AppConfig.LimbConstraints);

        vfxGraphSupported = SystemInfo.supportsComputeShaders && SystemInfo.maxComputeBufferInputsVertex != 0;

        applicationInitialized = true;
        return(true);
    }
Exemplo n.º 8
0
    protected override IEnumerator Init()
    {
        //get the required resources from the virtual world
        if (AppManager.useVirtualWorld)
        {
            positionController = VirtualWorldController.Instance.positionController;
            gras.SetActive(false);

            Camera cam = GameController.Instance.mainSceneCamera;
            gameCamera.enabled = false;
            mainLight.enabled  = false;
            //Debug.Log(positionController.ToString());

            Transform grasT = positionController.transform;

            curtain.transform.position = grasT.position + grasT.right * curtainPositionOffset.x + grasT.up * curtainPositionOffset.y + grasT.forward * curtainPositionOffset.z;

            Vector3 positionOffset = grasT.right * cameraPositionOffset.x + grasT.up * cameraPositionOffset.y + grasT.forward * cameraPositionOffset.z;

            yield return(StartCoroutine(Tween.TweenPositionAndRotation(cam.transform, grasT.position + positionOffset, grasT.rotation * cameraRotation, 3f)));
        }

        modeText.text          = StringRes.Get("_DuplikLevelSeniors");
        remainingTimeText.text = "";
        if (Panel != null)
        {
            Panel.SetActive(true);
        }
        if (ProgressBar != null)
        {
            ProgressBar.SetActive(true);
        }
        presentGameObjects = new List <GameObject>();
        grammars           = GenerativeGrammatiken.Instance;
        sentenceArray[0]   = sentence1;
        sentenceArray[1]   = sentence2;
        sentenceArray[2]   = sentence3;
        sentenceArray[3]   = sentence4;
        sentenceArray[4]   = sentence5;
        yield break;
    }
Exemplo n.º 9
0
    IEnumerator CardShowingStage()
    {
        taskText.text = StringRes.Get("_MotionMemorizeHouse");

        yield return(timer.SimpleTimer(3f));

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

        int remainingGroupSize = unsolved.Count < conf.maxGroupSize ? unsolved.Count : conf.maxGroupSize;

        for (int i = 0; i < remainingGroupSize; i++)
        {
            MemoryCardHouse card = unsolved[GetRandom(unsolved.Count)];
            windowController.BeginOutline(card);
            windowController.BeginShowPose(card);

            yield return(windowController.OpenWindows(card.index, WINDOW_ANIM_TIME));

            //wait for minimum accuracy or minimum time to pass

            progressBar.enabled = true;
            yield return(timer.UITimer(conf.cardShowingTime, progressBarMask, remainingTimeText));

            progressBar.enabled = false;
            yield return(windowController.CloseWindows(card.index, WINDOW_ANIM_TIME));

            windowController.StopShowPose(card);
            windowController.StopOutline(card);

            tempStack.Add(card);
            unsolved.Remove(card);
            if (i < remainingGroupSize)
            {
                yield return(timer.SimpleTimer(conf.timeBetweenCardsShowing));
            }
        }
    }
Exemplo n.º 10
0
    /// <summary>
    /// The Lamps glow for the set "glowTime" while reading the available Answers.
    /// The mesh filter changes from glowing to normal after the glowTime is finished.
    /// The User has the set time "answerTime" to think what the right answer is.
    /// The Lamp corresponding to the right answer glows up and the other Lamps and answers disappear (are disabled).
    /// </summary>
    /// <param name="q"></param>
    /// <returns></returns>
    IEnumerator AskQuestion(QuestionCard q)
    {
        q.Reshuffle();
        InitQuestionUI(q);

        yield return(new WaitForSeconds(conf.questionTime));

        bool correct = false;

        switch (conf.answeringMode)
        {
        case AnsweringMode.MOVE_X_AXIS:
        {
            Vector3 playerPosition = Vector3.zero;

            ToggleSlider(true);

            float remainingTime = conf.answerTime;
            countDownBar.enabled = true;
            countDownMask.gameObject.SetActive(true);
            while (remainingTime > 0f)
            {
                playerPosition = BodyDisplay.Instance.GetBodyPosition();
                float adjustedX = Mathf.Clamp(playerPosition.x, -1, 1f);

                if (conf.flipX)
                {
                    adjustedX *= -1;
                }

                adjustedX   *= 0.5f;
                adjustedX   += 0.5f;
                slider.value = adjustedX;

                remainingTime           -= Time.deltaTime;
                countDownMask.fillAmount = 1 - remainingTime / conf.answerTime;
                countDownText.text       = Mathf.RoundToInt(remainingTime).ToString();
                yield return(null);
            }

            //yield return timer.UITimer(answerTime, countDownMask, countDownText);

            countDownText.text   = "";
            countDownBar.enabled = false;
            countDownMask.gameObject.SetActive(false);
            ToggleSlider(false);

            correct = (q.TrueAnswer == 0) ?
                      playerPosition.x <= 0f :
                      playerPosition.x > 0f;
            break;
        }

        case AnsweringMode.RAISE_HANDS:
        {
            float remainingTime = conf.answerTime / 2f;
            countDownBar.enabled = true;
            countDownMask.gameObject.SetActive(true);
            while (remainingTime > 0f)
            {
                remainingTime           -= Time.deltaTime;
                countDownMask.fillAmount = 1 - remainingTime / conf.answerTime;
                countDownText.text       = Mathf.RoundToInt(remainingTime).ToString();
                yield return(null);
            }

            //yield return timer.UITimer(answerTime, countDownMask, countDownText);

            countDownText.text   = "";
            countDownBar.enabled = false;
            countDownMask.gameObject.SetActive(false);

            bool leftHandRaised  = BodyDisplay.Instance.JointCompare(JointId.Head, JointId.HandLeft, hRC);
            bool rightHandRaised = BodyDisplay.Instance.JointCompare(JointId.Head, JointId.HandRight, hRC);

            //Debug.Log("Left" + leftHandRaised);
            //Debug.Log("Right" + rightHandRaised);

            correct = (q.TrueAnswer == 0) ?
                      leftHandRaised && !rightHandRaised :
                      rightHandRaised && !leftHandRaised;

            break;
        }
        }

        answerFeedback.gameObject.SetActive(true);
        countDownBar.gameObject.SetActive(false);
        countDownText.gameObject.SetActive(false);

        if (correct)
        {
            answerFeedback.text = StringRes.Get("_RightAnswer");
            ConfettiBurst();
        }
        else
        {
            answerFeedback.text = StringRes.Get("_WrongAnswer");
        }

        for (int i = 0; i < q.Answers.Count; i++)
        {
            AnswerPanel p = panels[i];
            if (i != q.TrueAnswer)
            {
                p.gameObject.SetActive(false);
            }
        }

        centerImg.gameObject.SetActive(false);

        yield return(new WaitForSeconds(conf.showCorrectAnswerTime));

        answerFeedback.gameObject.SetActive(false);
        countDownBar.gameObject.SetActive(true);
        countDownText.gameObject.SetActive(true);
    }
Exemplo n.º 11
0
 void Start()
 {
     StringRes.LoadStringResources();
     PlayGame();
 }
Exemplo n.º 12
0
    IEnumerator CardGuessingPhase()
    {
        yield return(timer.SimpleTimer(2f));

        int tempStackSize = tempStack.Count;

        for (int i = 0; i < tempStackSize; i++)
        {
            taskText.text = StringRes.Get("_MotionGuess");

            MemoryCard card        = tempStack[GetRandom(tempStack.Count)];
            int        maxAccuracy = 0;
            BeginOutline(card);
            float remainingTime = motionGuessingTime - timeBeforeMotionTracking;
            comparePercentage.text = "";
            BodyDisplay.Instance.comparePercentage = 0;

            yield return(timer.SimpleTimer(timeBeforeMotionTracking));

            Coroutine cR = StartCoroutine(BodyDisplay.Instance.BodyCompareCoroutine(card.pose.motion[0], remainingTime));

            progressBar.enabled = true;
            while (remainingTime > 0f)
            {
                int currentAccuracy = BodyDisplay.Instance.comparePercentage;

                if (currentAccuracy > maxAccuracy)
                {
                    maxAccuracy = currentAccuracy;
                }

                if (maxAccuracy > 95)
                {
                    solved.Add(card);
                    StopCoroutine(cR);
                    break;
                }
                comparePercentage.text = maxAccuracy.ToString();

                remainingTime -= Time.deltaTime;
                progressBarMask.fillAmount = 1 - remainingTime / motionGuessingTime;
                remainingTimeText.text     = Mathf.RoundToInt(remainingTime).ToString();
                yield return(null);
            }

            if (maxAccuracy > 95)
            {
                ConfettiBurst();
                taskText.text = StringRes.Get("_RightAnswer");
            }
            else
            {
                taskText.text = StringRes.Get("_WrongAnswer");
            }


            comparePercentage.text     = "";
            remainingTimeText.text     = "";
            progressBarMask.fillAmount = 0f;
            progressBar.enabled        = false;

            StopOutline(card);

            BeginShowPose(card);
            yield return(timer.SimpleTimer(cardShowingTime));

            StopShowPose(card);

            //Debug.Log("Acc: "+ maxAccuracy);
            if (maxAccuracy <= 90)
            {
                unsolved.Add(card);
            }
            else
            {
                //if the card was solved, hide it
                card.uiElement.GetComponent <RawImage>().enabled = false;
            }

            tempStack.Remove(card);



            if (i < tempStackSize)
            {
                yield return(timer.SimpleTimer(timeBetweenCardsGuessing));
            }
        }
    }