/// <summary> /// Fills ReadyToPop with all touching orbs of type colo. all orbs already marked popping will be ignored. /// XXX consider refactoring to remove ReadyToPop and replace it with a private var at class level. /// </summary> /// <param name="ReadyToPop">Where all touching orbs that are the same type as color will be stored</param> /// <param name="curOrb">The current orb to evaluate</param> /// <param name="color">the color of orbs we are looking for</param> /// <returns></returns> public bool EvaluateOrb(Queue <GameObject> ReadyToPop, Orb curOrb, OrbType color) { Debug.Log("orb " + curOrb.gameObject.name + " is attempting a pop check"); if (color == curOrb.orbScript.orbType && curOrb.curState != Orb.OrbState.Evaluating && curOrb.curState != Orb.OrbState.Falling) { Debug.Log("orb " + curOrb.gameObject.name + "has passed the pop check "); ReadyToPop.Enqueue(curOrb.gameObject); curOrb.curState = Orb.OrbState.Evaluating; Vector2 temp = curOrb.GetRelPos(); LinkedListNode <GameObject> node = Cols[(int)temp.x].First; for (int i = 0; i < (int)temp.y; i++) { node = node.Next; } if ((int)temp.y < (Cols[(int)temp.x].Count - 1)) { Debug.Log("orb " + curOrb.gameObject.name + " is pop checking down"); EvaluateOrb(ReadyToPop, node.Next.Value.GetComponent <Orb>(), color); } if ((int)temp.y > 0) { Debug.Log("orb " + curOrb.gameObject.name + " is pop checking up"); EvaluateOrb(ReadyToPop, node.Previous.Value.GetComponent <Orb>(), color); } if ((int)temp.x < 6 && Cols[(int)temp.x + 1].Count > (int)temp.y) { Debug.Log("orb " + curOrb.gameObject.name + " is pop checking right"); node = Cols[(int)temp.x + 1].First; for (int i = 0; i < (int)temp.y; i++) { node = node.Next; } EvaluateOrb(ReadyToPop, node.Value.GetComponent <Orb>(), color); } if ((int)temp.x >= 1 && Cols[(int)temp.x - 1].Count > (int)temp.y) { Debug.Log("orb " + curOrb.gameObject.name + " is pop checking left"); node = Cols[(int)temp.x - 1].First; for (int i = 0; i < (int)temp.y; i++) { node = node.Next; } EvaluateOrb(ReadyToPop, node.Value.GetComponent <Orb>(), color); } } return(false); }