public void NextQuestion() {
		FuzzyResponse fr = new FuzzyResponse();
		for (int index = 0; index < attributesInput.Length; index++) {
			fr.inputs[attributesInput[index]] = termLinguistics[questionState[index]];
		}
		for (int index = 0; index < attributesOutput.Length; index++) {
			string attr = attributesOutput[index];
			fr.outputs[attr] = sliders[attr].value;
		}
	
		fuzzyQuestionary.responses.Add(fr);

		questionStateIndex++;

		if (questionStateIndex > (Mathf.Pow(termLinguistics.Length, attributesInput.Length) - 1)) {
			FinishQuestions();
			return;
		}

		int remainValue = questionStateIndex;
		for (int index = 0; index < attributesInput.Length; index++) {
			int pos = attributesInput.Length - index - 1;

			int valuePowered = (int)(Mathf.Pow(termLinguistics.Length, pos));
			int currentValue = remainValue / valuePowered;
			remainValue -= currentValue * valuePowered;
			
			questionState[index] = currentValue;
		}

		ShowQuestion();
	}
Esempio n. 2
0
    public void NextQuestion()
    {
        FuzzyResponse fr = new FuzzyResponse();

        for (int index = 0; index < attributesInput.Length; index++)
        {
            fr.inputs[attributesInput[index]] = termLinguistics[questionState[index]];
        }
        for (int index = 0; index < attributesOutput.Length; index++)
        {
            string attr = attributesOutput[index];
            fr.outputs[attr] = sliders[attr].value;
        }

        fuzzyQuestionary.responses.Add(fr);

        questionStateIndex++;

        if (questionStateIndex > (Mathf.Pow(termLinguistics.Length, attributesInput.Length) - 1))
        {
            FinishQuestions();
            return;
        }

        int remainValue = questionStateIndex;

        for (int index = 0; index < attributesInput.Length; index++)
        {
            int pos = attributesInput.Length - index - 1;

            int valuePowered = (int)(Mathf.Pow(termLinguistics.Length, pos));
            int currentValue = remainValue / valuePowered;
            remainValue -= currentValue * valuePowered;

            questionState[index] = currentValue;
        }

        ShowQuestion();
    }