本文整理匯總了C#中Microsoft.Xna.Framework.Graphics.Sprite.GetColorData方法的典型用法代碼示例。如果您正苦於以下問題:C# Sprite.GetColorData方法的具體用法?C# Sprite.GetColorData怎麽用?C# Sprite.GetColorData使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類Microsoft.Xna.Framework.Graphics.Sprite
的用法示例。
在下文中一共展示了Sprite.GetColorData方法的1個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的C#代碼示例。
示例1: HandleCollision
/// <summary>
/// Collision handling for each sprite on the screen.
/// </summary>
/// <param name="sprite">Sprite to check collision with.</param>
private void HandleCollision(Sprite sprite)
{
Rectangle itemBounds = new Rectangle(sprite.GetX(), sprite.GetY(), sprite.GetWidth(), sprite.GetHeight());
String name = sprite.GetName();
if (IntersectPixels(playerBounds, playerData, itemBounds, sprite.GetColorData()))
{
if (!sprite.GetTransparent())
{
if (name.Equals("level1") || name.Equals("level2") || name.Equals("level3"))
{
if (IsAbove(playerBounds, itemBounds) && ((player.CheckJump() && sprite.GetY() == 399) || (jumping && sprite.GetY() == 499)))
sprite.KillVirus();
else
{
if (Constants.isSwappingHand && player.HasSword() && sprite.GetY() == 399)
{
swordUsed=true;
sprite.SlashVirus();
}
else
{
if (!Constants.isPunching)
sprite.HitVirus();
}
}
}
ApplyEffect(name, sprite);
PlaySoundEffects(name, sprite);
if (!name.Equals("gym") && !name.Contains("boss"))
sprite.Collide(name);
else
{
if (Constants.isSteppingRight)
{
screenPaused = true;
ScreenManager.AddScreen(new ExcercisesScreen(this));
this.FreezeScreen();
}
}
if (name.Contains("boss"))
{
if (playerBounds.Right >= sprite.GetX() + 150)
{
//Add Boss Screen
screenPaused = true;
spriteCounter = 0;
currentSprite.Clear();
globalCounter = 600;
this.FreezeScreen();
currentSprite.Remove(sprite);
ScreenManager.AddScreen(new BossFightScreen(this, Int32.Parse((name.Substring(4)))));
}
}
}
}
}