57 lines
1.6 KiB
C#
57 lines
1.6 KiB
C#
using System.Collections;
|
|
using System.Collections.Generic;
|
|
using UnityEngine;
|
|
using UnityEngine.UI;
|
|
|
|
public class QuizController : MonoBehaviour {
|
|
|
|
|
|
string[] questions = new string[] { "Q1", "Q2", "Q3" };
|
|
|
|
public Text quizQuestionText;
|
|
|
|
public GameObject television;
|
|
|
|
private int questionIdx = 0;
|
|
|
|
Vector3 answerOnePosition = new Vector3(200.0f, 50.0f, 0.0f);
|
|
Vector3 answerTwoPosition = new Vector3(100.0f, 0.0f, 0.0f);
|
|
Vector3 answerThreePosition = new Vector3(-50.0f, 0.0f, 0.0f);
|
|
Vector3 answerFourPosition = new Vector3(-100.0f, 50.0f, 0.0f);
|
|
|
|
// Use this for initialization
|
|
void Start () {
|
|
quizQuestionText.text = questions[questionIdx];
|
|
GameObject obj = Instantiate(Resources.Load("dimnjak")) as GameObject;
|
|
|
|
Object.Instantiate(obj, answerOnePosition, Quaternion.identity);
|
|
Object.Instantiate(obj, answerTwoPosition, Quaternion.identity);
|
|
Object.Instantiate(obj, answerThreePosition, Quaternion.identity);
|
|
GameObject a = Object.Instantiate(obj, answerFourPosition, Quaternion.identity);
|
|
|
|
}
|
|
|
|
void Update()
|
|
{
|
|
if (Input.GetMouseButtonDown(0))
|
|
|
|
Debug.Log("Rotate Started");
|
|
|
|
Ray ray = Camera.main.ScreenPointToRay(Input.mousePosition);
|
|
RaycastHit hit;
|
|
|
|
if (Physics.Raycast(ray, out hit, 100))
|
|
{
|
|
Debug.Log(hit.transform.gameObject.name);
|
|
}
|
|
}
|
|
|
|
|
|
public void LoadNextQuestion()
|
|
{
|
|
Debug.Log("Next question btn");
|
|
questionIdx = (questionIdx + 1) % questions.Length;
|
|
quizQuestionText.text = questions[questionIdx];
|
|
}
|
|
}
|