I have a scriptable object, which is my list of questions, when I write in my list that each question has two more duplicates, for example (1.what is c#? 2.what is c#? 3.what is c#?) , I need it to skip those two duplicates when it is answered correctly the first time i.e. the second and third questions, and if the answer is correct the first time, but from the second duplicate, i.e. the second question, then the third, i.e. one duplicate, is skipped and the fourth question goes, which also has two more duplicates, the thing is that I need that skipping, because every question has a new addition, the text goes first, then the text and image, and the text and video third, if the answer is incorrect, it will be read in order, but if the answer is correct, there is no need to go through the second and third attempts, but go to a new question, what I have in the code is that it skips based on the correct answers, but that doesn't work because then it doesn't go in the order I need, but it will always skip 2 then 1, 2 then 1enter image description here
void IzaberiPitanje()
{
if (pitanja.Count > 0)
{
if (preskociDuplikate > 0)
{
// Skip the specified number of questions
for (int i = 0; i < preskociDuplikate; i++)
{
pitanja.RemoveAt(0);
}
preskociDuplikate = 0; // Reset the skip counter
}
izabranoPitanje = pitanja[0];
kvizUI.PostaviPitanje(izabranoPitanje);
pitanja.RemoveAt(0);
}
else
{
statusIgre = StatusIgre.Sledece;
kvizUI.KrajIgre.SetActive(true);
}
}
private void Update()
{
if (statusIgre == StatusIgre.IgraSe)
{
trenutnoVreme -= Time.deltaTime;
PodesiVreme(trenutnoVreme);
}
}
private void PodesiVreme(float vrednost)
{
TimeSpan vreme = TimeSpan.FromSeconds(vrednost);
kvizUI.VremeTekst.text = "Vreme:" + vreme.ToString("mm':'ss");
if (trenutnoVreme <= 0)
{
statusIgre = StatusIgre.Sledece;
kvizUI.KrajIgre.SetActive(true);
}
}
public bool Odgovor(string odgovoreno)
{
bool tacanOdgovor = false;
if (odgovoreno == izabranoPitanje.tacanOdgovor)
{
tacanOdgovor = true;
brojacBodova += 50;
kvizUI.BodoviTekst.text = "Bodovi:" + brojacBodova;
// Brojac tacnih odgovora za trenutno pitanje
izabranoPitanje.tacniOdgovori++;
if (izabranoPitanje.tacniOdgovori == 1)
{
// Preskace sledeca dva pitanja ako je odgovor tacan iz prvog pokusaja
preskociDuplikate = 2;
}
else if (izabranoPitanje.tacniOdgovori == 2)
{
// Preskace sledeci pitanje ako je odgovor tacan iz drugog pokusaja
preskociDuplikate = 1;
}
else
{
// Resetuje brojac tacnih odgovora i preskace duplikate
izabranoPitanje.tacniOdgovori = 0;
preskociDuplikate = 0;
}
}
else
{
ostatakZivota--;
kvizUI.OduzmiZivot(ostatakZivota);
if (ostatakZivota <= 0)
{
statusIgre = StatusIgre.Sledece;
kvizUI.KrajIgre.SetActive(true);
}
izabranoPitanje.tacniOdgovori = 0;
preskociDuplikate = 0;
}
if (preskociDuplikate > 0)
{
for (int i = 0; i < preskociDuplikate; i++)
{
IzaberiPitanje();
}
}
else
{
IzaberiPitanje();
}
return tacanOdgovor;
}
}