Version 17.5
This commit is contained in:
56
Profesor Atom/Assets/Scripts/QuizController.cs
Normal file
56
Profesor Atom/Assets/Scripts/QuizController.cs
Normal file
@@ -0,0 +1,56 @@
|
||||
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];
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user