本文整理汇总了C#中Rect.CheckIntersect方法的典型用法代码示例。如果您正苦于以下问题:C# Rect.CheckIntersect方法的具体用法?C# Rect.CheckIntersect怎么用?C# Rect.CheckIntersect使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Rect
的用法示例。
在下文中一共展示了Rect.CheckIntersect方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: Update
// 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);
//.........这里部分代码省略.........