コード例 #1
0
 public void BeginShowPose(MemoryCardHouse card)
 {
     /*
      * if(card.pose == null)
      * {
      *  Debug.Log("Pose = null");
      * }
      * else if(card.pose.motion == null)
      * {
      *  Debug.Log("PoseMotion = null");
      *
      * }*/
     BodyDisplay.Instance.DisplayHumanoid(card.pose.motion[0], true);
     Material[] mats = mR.materials;
     mats[card.index + 1].SetInt("_ShowTex", 1);
     mR.materials = mats;
 }
コード例 #2
0
 MemoryCardHouse[] ConstructUI(List <Motion> j)
 {
     MemoryCardHouse[] memory = new MemoryCardHouse[j.Count];
     Material[]        mats   = windowController.MR.materials;
     for (int i = 0; i < conf.amount; i++)
     {
         MemoryCardHouse card = new MemoryCardHouse {
             index = i, pose = j[i], window = mat
         };
         memory[i]   = card;
         mats[i + 1] = Instantiate(mat);
         mats[card.index + 1].SetTexture("_MainTex", cameraRenderTexture);
         mats[card.index + 1].SetInt("_ShowTex", 0);
     }
     windowController.MR.materials = mats;
     return(memory);
 }
コード例 #3
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));
            }
        }
    }
コード例 #4
0
 public void StopOutline(MemoryCardHouse card)
 {
     Material[] mats = mR.materials;
     mats[card.index + 1].SetInt("_LightsOn", 0);
     mR.materials = mats;
 }
コード例 #5
0
 public void StopShowPose(MemoryCardHouse card)
 {
     Material[] mats = mR.materials;
     mats[card.index + 1].SetInt("_ShowTex", 0);
     mR.materials = mats;
 }
コード例 #6
0
    IEnumerator CardGuessingPhase()
    {
        yield return(timer.SimpleTimer(2f));

        int tempStackSize = tempStack.Count;

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

            MemoryCardHouse card        = tempStack[GetRandom(tempStack.Count)];
            int             maxAccuracy = 0;
            windowController.BeginOutline(card);

            float remainingTime = conf.motionGuessingTime;
            comparePercentage.text = "";
            BodyDisplay.Instance.comparePercentage = 0;

            yield return(timer.SimpleTimer(conf.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 > solvePercentage)
                {
                    solved.Add(card);
                    StopCoroutine(cR);
                    break;
                }
                comparePercentage.text = StringRes.Get("_Accuracy") + ": " + maxAccuracy.ToString() + "%";

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

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


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

            windowController.BeginShowPose(card);

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

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

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

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


            //Debug.Log("Acc: "+ maxAccuracy);
            if (maxAccuracy <= solvePercentage)
            {
                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(conf.timeBetweenCardsGuessing));
            }
        }
    }