Beispiel #1
0
    // Create a list of NPCStates, one for each audio source. Audio delays aren't implemented yet, standard of 1f for all. Every trigger plays on "Next".
    // Initialize the initial question and prompt states as well as the stateController. stateController is hardcoded.
    void Start()
    {
        reactionTimer = System.Diagnostics.Stopwatch.StartNew();

        curAnimator = markNPC.GetComponent <Animator>();

        NPCIndex  = 0;
        NPCStates = new List <NPCState>();
        foreach (var audio in audioSources)
        {
            NPCStates.Add(new NPCState(audio, "Next", 1f));
        }

        questionState = BasicQuestionsEnum.Question0;
        promptState   = BasicPromptEnum.Prompt0;

        // The sequence that the states will progress in. questionState and promptState will be changing too so this just controls whether a prompt or question will appear.
        stateIndex      = 0;
        stateController = new List <string> {
            "Prompt", "Question", "Prompt", "Question", "Prompt", "Question", "Prompt", "Prompt", "Question", "Prompt", "Question", "Prompt", "Question"
        };

        Debug.Log("NPCStates size: " + NPCStates.Count);

        running        = true;
        countDownTimer = new System.Diagnostics.Stopwatch();

        DatabaseInserts.CreateSession(Constants.BASIC_SCENEID);

        data = new List <BasicAnswerData>();
    }
Beispiel #2
0
    // The button press for a negative answer. It advances the question state and plays the next state.
    public void NegativeClick()
    {
        Debug.Log("Negative pressed in " + reactionTimer.ElapsedMilliseconds / 1000.0 + " seconds");
        data.Add(new BasicAnswerData(questionState.GetSentence(), questionState.GetNegative(), "Negative", reactionTimer.ElapsedMilliseconds / 1000.0));
        questions.SetActive(false);

        questionState = questionState.next();
        PlayNextState();
    }
 // Gets the next Question state.
 public static BasicQuestionsEnum next(this BasicQuestionsEnum value)
 {
     return(Enum.GetValues(typeof(BasicQuestionsEnum)).Cast <BasicQuestionsEnum>()
            .SkipWhile(e => e != value).Skip(1).First());
 }
 // Returns what delay to play the question with.
 public static float GetDelay(this BasicQuestionsEnum value)
 {
     return(value.GetBasicQuestionAttribute <BasicQuestionsAttribute>().Delay);
 }
 // Returns the question's sentence.
 public static string GetSentence(this BasicQuestionsEnum value)
 {
     return(value.GetBasicQuestionAttribute <BasicQuestionsAttribute>().Question);
 }
 // Returns the negative interpretation.
 public static string GetNegative(this BasicQuestionsEnum value)
 {
     return(value.GetBasicQuestionAttribute <BasicQuestionsAttribute>().Negative);
 }