示例#1
0
    private IEnumerator Delay()
    {
        yield return(new WaitForSeconds(0.1f));

        foreach (var g in Variables.ButtonNames)
        {
            Destroy(g);
        }

        Variables.LastRoundFailed = false;
        Variables.Count           = 1;
        Variables.NextIndex       = 0;
        Variables.Times.Clear();
        Variables.Round = (Variables.Round + 1) % (Variables.AmountOfRounds);
        if (Variables.Round == 0)
        {
            //Close last HandData save
            SaveHandPosition.closeIfOpen();
            Variables.isTrialActive = false;
            //Wait after last trial and show timer
            float elapsedTime = 5.0f;
            while (elapsedTime > 0.0f)
            {
                elapsedTime   -= Time.deltaTime;
                TableText.text = "End of Task \n " + Mathf.Round(elapsedTime);
                if (Input.GetKeyDown(KeyCode.Escape))
                {
                    elapsedTime = 0.0f;
                }
                else
                {
                    yield return(null);
                }
            }
            TableText.text = "";
            _objects.TableTop.GetComponent <Questionnaire>().SetActiveQ(true, _objects.Fragebogen);
            _objects.Fragebogen.GetComponent <CreateQuestionnaire>().CreateQuestions();
            while (Variables.IsConfirmPressed == false)
            {
                yield return(null);
            }

            if (Variables.IsConfirmPressed)
            {
                SaveQuestionnaire.SaveCollecter(SaveQuestionnaire.QuestionnaireType.Post);
                _objects.TableTop.GetComponent <Questionnaire>().SetActiveQ(false, _objects.Fragebogen);
                Variables.IsConfirmPressed = false;
                print("Trial: " + Variables.Trial + " von " + Variables.AmountOfTrials);
                if (Variables.Trial == Variables.AmountOfTrials - 1)
                {
                    float endTime = 120.0f;
                    while (endTime > 0.0f)
                    {
                        endTime       -= Time.deltaTime;
                        TableText.text = "End of Study \n Thanks for participating!";
                        if (Input.GetKeyDown(KeyCode.Escape))
                        {
                            endTime = 0.0f;
                        }
                        else
                        {
                            yield return(null);
                        }
                    }
                    TableText.text = "";
                }
                Variables.Trial++;
                SaveClickData._repetitionDict.Clear();
                _objects.Buttons.GetComponent <Setup>().ShuffleList(Variables.UserId, Variables.Trial);
                _objects.HandController.GetComponent <GetHandMovement>().NextHand();
                yield return(StartCoroutine(CreatePreQuestionnaire()));
            }
        }

        Debug.Log("Round: " + Variables.Round + " von " + Variables.AmountOfRounds);
        yield return(new WaitForSeconds(1));

        Setup.SetupInstance.CreateButtons();
    }
 private void OnApplicationQuit()
 {
     SaveHandPosition.closeIfOpen();
 }
示例#3
0
 public void OnApplicationQuit()
 {
     SaveClickData.closeIfOpen();
     SaveQuestionnaire.CloseIfOpen();
     SaveHandPosition.closeIfOpen();
 }