machte ich ein Quiz, aber wahr und falsch die einzigen Tasten sind,UNITY C#: Ist es möglich, die Taste True und False auf 4 verschiedene Tasten zu setzen und trotzdem "public bool" zu benutzen?
sie aus einem Tutorial erhielt die brackeys
ist, wie ich sie mit 4 verschiedenen Optionen 4 Anstecker.
und ordnen sie Schaltfläche Objekte in der Einheit
hier sind meine Codes für wahr und falsch (GameManager.cs)
using UnityEngine;
using UnityEngine.UI;
using System.Collections;
using System.Collections.Generic;
using System.Linq;
public class GameManager : MonoBehaviour
{
public Question[] questions;
private static List<Question> unansweredQuestions;
private Question currentQuestion;
[SerializeField]
private Text factText;
void Start()
{
if (unansweredQuestions == null || unansweredQuestions.Count == 0)
{
unansweredQuestions = questions.ToList<Question>();
}
SetCurrentQuestion();
}
void SetCurrentQuestion()
{
int randomQuestionIndex = Random.Range(0, unansweredQuestions.Count);
currentQuestion = unansweredQuestions[randomQuestionIndex];
factText.text = currentQuestion.fact;
unansweredQuestions.RemoveAt(randomQuestionIndex);
}
public void UserSelectTrue()
{
if (currentQuestion.isTrue)
{
Debug.Log("CORRECT");
} else
{
Debug.Log("WRONG");
}
public void UserSelectFalse()
{
if (!currentQuestion.isTrue)
{
Debug.Log("CORRECT");
} else
{
Debug.Log("WRONG");
}
}
Question.cs
[System.Serializable]
public class Question {
public string fact;
public bool isTrue;
}