Exemplo n.º 1
0
    protected override void UserTestUpdate()
    {
        // First check if user test setup is complete (instructions available)
        if (userTestManager.HasInstructions())
        {
            // Check if user has done a move, and is ready for next round
            if (elementManager.CurrentMoving != null)
            {
                // Dont do anything while moving element
            }
            else if (userTestManager.ReadyForNext == userTestManager.UserActionToProceed)
            {
                // Reset counter
                userTestManager.ReadyForNext = 0;

                // Checking if all sorting elements are sorted
                if (!userTestManager.HasInstructions() && elementManager.AllSorted())
                {
                    sortAlgorithm.IsTaskCompleted = true;
                    Debug.Log(">>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>> This update loop needs some fixes.... Ever getting into this case????"); // ???
                }
                else
                {
                    // Still some elements not sorted, so go on to next round
                    bool hasInstruction = userTestManager.IncrementToNextInstruction();

                    // Hot fix - solve in some other way?
                    if (hasInstruction)
                    {
                        userTestManager.ReadyForNext += algorithmManagerBase.PrepareNextInstruction(userTestManager.GetInstruction());
                    }
                    else if (elementManager.AllSorted())
                    {
                        WaitForSupportToComplete++;
                        StartCoroutine(FinishUserTest());
                    }
                }
            }

            if (Settings.IsUserTest() && sortSettings.UserTestScore)
            {
                displayUnitManager.SetTextWithIndex(UtilSort.RIGHT_BLACKBOARD, userTestManager.FillInBlackboard(), 1);
            }
        }
    }