Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- using UnityEngine;
- using System.Collections;
- using System.Collections.Generic;
- public class QuestionHandler : MonoBehaviour {
- [System.Serializable]
- public class Question
- {
- public string QuestionString;
- public bool IsItPictorial;
- public bool IsInBengali;
- public Texture2D BengaliQuestion;
- public Texture2D QuestionPictorial;
- }
- public List<Question> Internet_Questions = new List<Question>();
- public List<Question> G_Science_Questions = new List<Question>();
- public List<Question> General_Knowledge_Questions = new List<Question>();
- public List<Question> Chosen_Internet_Question = new List<Question>();
- public List<Question> Chosen_G_science_Question = new List<Question>();
- public List<Question> Chosen_General_knowledge_Question = new List<Question>();
- public static Question CurrentQuestion = new Question();
- // Use this for initialization
- void Start ()
- {
- if (CurrentQuestion.IsItPictorial) { Debug.Log("asdasdasd"); }
- // Please Change this values accoridding to requirments;
- int num_of_Internet_Question = 8;
- int num_of_G_science_Question = 8;
- int num_of_General_knowledge_Question = 7;
- Chosen_Internet_Question = ChooseQuestion(Internet_Questions, num_of_Internet_Question);
- Chosen_G_science_Question = ChooseQuestion(Internet_Questions, num_of_G_science_Question);
- Chosen_General_knowledge_Question = ChooseQuestion(Internet_Questions, num_of_General_knowledge_Question);
- }
- // Update is called once per frame
- void Update () {
- }
- List<Question> ChooseQuestion(List<Question> inputQuestion, int countNumber)
- {
- List<Question> tempQuestion = inputQuestion;
- List<Question> chosenQuestion = new List<Question>();
- if (tempQuestion.Count == 0)
- {
- Debug.Log("List Empty");
- }
- else
- {
- for (int i = 0; i < countNumber; i++)
- {
- int chosenIndex = Random.Range(0, tempQuestion.Count);
- chosenQuestion.Add(tempQuestion[chosenIndex]);
- tempQuestion.Remove(tempQuestion[chosenIndex]);
- }
- }
- return chosenQuestion;
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement