// Update is called once per frame void Update() { frameCounter++; if (frameCounter % 45 == 0) { createBomba(); } for (int index = mBombaList.Count - 1; index >= 0; --index) { Bomba bomba = mBombaList[index]; bomba.update(); if (bomba.SetGetHasCandy == true) { bomba.SetGetCandy.update(); } if (bomba.y > Futile.halfHeight + bomba.height * 2) { if (bomba.SetGetHasCandy == true) { bomba.SetGetCandy.RemoveFromContainer(); bomba.SetGetCandy = null; } bomba.RemoveFromContainer(); mBombaList.Remove(bomba); } else if (mSeed.isVisible) { Rect bombaRec = new Rect(bomba.boundsRect); bombaRec.x = bomba.x - bomba.width / 2; bombaRec.y = bomba.y - bomba.height / 2; bombaRec.width = bomba.width; bombaRec.height = bomba.height; Rect seedRec = new Rect(mSeed.boundsRect); seedRec.x = mSeed.x; seedRec.y = mSeed.y; seedRec.width = mSeed.width; seedRec.height = mSeed.height; if (seedRec.CheckIntersect(bombaRec)) { if (bomba.SetGetHasCandy == true) { Candy candy = bomba.SetGetCandy; bomba.SetGetCandy.RemoveFromContainer(); bomba.SetGetCandy = null; candy.CandyFalling = true; Futile.stage.AddChild(candy); mCandyList.Add(candy); } FSoundManager.PlaySound("pop", 1.0f); mSeed.isVisible = false; addPoint(); bomba.RemoveFromContainer(); mBombaList.Remove(bomba); } } } for (int index = mCandyList.Count - 1; index >= 0; --index) { Candy candy = mCandyList[index]; if (candy.y < -(Futile.halfHeight + candy.mCandySprite.height)) { candy.RemoveFromContainer(); mCandyList.Remove(candy); } else { Rect candyRec = new Rect(candy.mCandySprite.boundsRect); candyRec.x = candy.x - candy.mCandySprite.width / 2; candyRec.y = candy.y - candy.mCandySprite.height / 2; candyRec.width = candy.mCandySprite.width; candyRec.height = candy.mCandySprite.height; Rect chiliRec = new Rect(mPepper.boundsRect); chiliRec.x = mPepperNode.x; chiliRec.y = mPepper.y; chiliRec.width = mPepper.width; chiliRec.height = mPepper.height / 2; if (chiliRec.CheckIntersect(candyRec)) { FSoundManager.PlaySound("candy", 1.0f); addPoint(candy.pointValue); candy.RemoveFromContainer(); mCandyList.Remove(candy); } else { candy.update(); } } } mSeed.update(); mPepper.update(); }