void OnCollisionEnter2D(Collision2D col) { ColorOrb co = (ColorOrb)col.gameObject.GetComponent <ColorOrb>(); if (co) { mainGame.EatColorOrb(co); } }
public void EatColorOrb(ColorOrb co) { for (int i = 0; i < backgrounds.Length; i++) { if (i == selectedBG) { backgrounds[i].sortingOrder = -99; } else { backgrounds[i].sortingOrder = -50; } } answerSet[selectedBG].GetComponent <SpriteRenderer>().color = ColorOrb.colors[co.nColor]; co.StartCoroutine(co.ColorAnimation()); //spawnOneColorOrb(co.nColor); }