i want my button to appear and disapear after a short delay in a specific random order.
All i try doesn’t work.
Other problem i tried to animate the alpha but it doesn’t work either.
Can you help me ?
I want something like that :
void OnTriggerEnter()
{
patternActivate = true;
next = true;
if (Difficulty.difficulty == 1)
{
pattern.Add(Random.Range(1,5));
showPattern();
}
else if (Difficulty.difficulty == 2)
{
for (int i = 0; i < 2; i++)
{
pattern.Add(Random.Range(1,5));
}
showPattern();
}
else if (Difficulty.difficulty == 3)
{
for (int i = 0; i < 3; i++)
{
pattern.Add(Random.Range(1,5));
}
showPattern();
}
}
void showPattern()
{
for (int i = 0; i < pattern.Count; i++)
{
if (pattern *== 1)*
{
button1.color = new Color(1, 1, 1, 1);
StartCoroutine(delay(2f));
button1.color = new Color(1, 1, 1, 0);
}
else if (pattern == 2)
{
button2.color = new Color(1, 1, 1, 1);
StartCoroutine(delay(2f));
button2.color = new Color(1, 1, 1, 0);
}
else if (pattern == 3)
{
button3.color = new Color(1, 1, 1, 1);
StartCoroutine(delay(2f));
button3.color = new Color(1, 1, 1, 0);
}
else if (pattern == 4)
{
button4.color = new Color(1, 1, 1, 1);
StartCoroutine(delay(2f));
button4.color = new Color(1, 1, 1, 0);
}
}
}