本文整理汇总了C#中HUD.lifeLostMario方法的典型用法代码示例。如果您正苦于以下问题:C# HUD.lifeLostMario方法的具体用法?C# HUD.lifeLostMario怎么用?C# HUD.lifeLostMario使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类HUD
的用法示例。
在下文中一共展示了HUD.lifeLostMario方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: EnemyCollisionTest
public Tuple<int, bool> EnemyCollisionTest(Mario mario, HUD hud, IList<IEnemy> enemies, int x, SoundEffects sound)
{
Rectangle marioRectangle = myMario.GetRectangle();
Rectangle enemyRectangle;
bool enemyKilled = false;
bool invincible = myMario.Invincible();
int xpos = x;
Rectangle intersectionRectangle;
Queue<IEnemy> doomedEnemies = new Queue<IEnemy>();
foreach (IEnemy enemy in enemies)
{
enemyRectangle = enemy.GetRectangle();
intersectionRectangle = Rectangle.Intersect(marioRectangle, enemyRectangle);
if (!intersectionRectangle.IsEmpty)
{
if (intersectionRectangle.Width >= intersectionRectangle.Height)
{
sound.Bump();
doomedEnemies.Enqueue(enemy);
hud.marioEnemyKill(mario);
enemyKilled = true;
}
else if (invincible)
{
doomedEnemies.Enqueue(enemy);
}
else
{
myMario.Hit();
if (marioRectangle.X < enemyRectangle.X)
{
xpos = xpos - intersectionRectangle.Width;
}
else
{
xpos = xpos + intersectionRectangle.Width;
}
if (myMario.IsDead())
{
hud.lifeLostMario();
}
}
}
}
while (doomedEnemies.Count() > 0)
{
IEnemy enemie = doomedEnemies.Dequeue();
enemies.Remove(enemie);
}
return new Tuple<int,bool>(xpos, enemyKilled);
}