void Update() { if (Scr_Config.conf.isFree) { if (ansList.Count == 0) { Scr_OperationGen.ops.question = "Questão " + numQuestions.ToString() + ":"; Scr_OperationGen.ops.CreateOperation(); List <float> answers = new List <float>(); Scr_GameSave.sav.questList.Add(new Scr_QuestSave(Scr_GameSave.sav.register, Scr_Config.conf.scrsPQ)); LogSave.ls.SaveLog("question added to questList | "); answers.Add(Scr_OperationGen.ops.answer.correct); LogSave.ls.SaveLog("Corect Answer added | "); answers.Add(VerifyGenerate(answers)); answers.Add(VerifyGenerate(answers)); List <Vector3> oldPos = new List <Vector3>(); oldPos.Add(this.transform.position); while (answers.Count > 0) { Vector3 vec = SpawnPosition(oldPos); oldPos.Add(vec); GameObject temp = Object.Instantiate(sphere, vec, Quaternion.identity); ansList.Add(temp); Scr_Option component = temp.GetComponent <Scr_Option>(); int spherePos = Random.Range(0, answers.Count); component.answer = answers[spherePos]; answers.RemoveAt(spherePos); } LogSave.ls.SaveLog("All options spawned | "); } } }
public void OnCollisionEnter(Collision collision) { Scr_Option ao = collision.gameObject.GetComponent <Scr_Option>(); if (ao.answer == Scr_OperationGen.ops.answer.correct) { Scr_GameSave.sav.questList[Scr_GameSave.sav.questList.Count - 1].isCorrect = true; } LogSave.ls.SaveLog("OnCollisionEnter of Scr_OptionGen Executado | "); Destroyer(); }