public bool[] rightWordsActive;
public GameObject[] rightWords;
private void Start()
{
for (int i = 0; i < rightWordsActive.Length; i++)
{
if (rightWordsActive[i] == true)
{
rightWordsActive[i] = false;
}
}
}
private void OnTriggerEnter2D(Collider2D col)
{
if (col.gameObject == rightWords[0])
{
if (rightWordsActive[1] == false & rightWordsActive[1] == false)
{
rightWords[0].GetComponent<Renderer>().material.color = new Color32(41, 166, 29, 255);
rightWordsActive[0] = true;
}
}
if (col.gameObject == rightWords[1])
{
if (rightWordsActive[0] == true & rightWordsActive[2] == false)
{
rightWords[1].GetComponent<Renderer>().material.color = new Color32(41, 166, 29, 255);
rightWordsActive[1] = true;
}
}
if (col.gameObject == rightWords[2])
{
if (rightWordsActive[0] == true & rightWordsActive[1] == true)
{
rightWords[2].GetComponent<Renderer>().material.color = new Color32(41, 166, 29, 255);
rightWordsActive[2] = true;
}
}
}
private void Update()
{
if (rightWordsActive[0] == true & rightWordsActive[1] == true & rightWordsActive[2] == true)
{
Destroy(rightWords[0]);
Destroy(rightWords[1]);
Destroy(rightWords[2]);
}
}