本文整理汇总了C#中Microsoft.Xna.Framework.Graphics.Sprite.IsSlashed方法的典型用法代码示例。如果您正苦于以下问题:C# Sprite.IsSlashed方法的具体用法?C# Sprite.IsSlashed怎么用?C# Sprite.IsSlashed使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Microsoft.Xna.Framework.Graphics.Sprite
的用法示例。
在下文中一共展示了Sprite.IsSlashed方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: PlaySoundEffects
/// <summary>
/// Plays the sound effect when colliding with a sprite.
/// </summary>
/// <param name="name">Sprite's name</param>
/// <param name="sprite">Instance of the sprite</param>
private void PlaySoundEffects(String name, Sprite sprite)
{
if (!sprite.GetCollided())
{
switch (name)
{
case "tomato":
case "carrot":
case "strawberry":
case "orange":
case "pineapple":
case "broccoli":
case "fries":
case "hamburger":
case "pizza":
case "donut":
case "muffin":
case "hotdog": sprite.PlaySoundEffect(soundEffects[1]); break;
case "level1":
case "level2":
case "level3":
if (sprite.IsSlashed())
sprite.PlaySoundEffect(soundEffects[6]);
else
{
if (sprite.GetKilled())
sprite.PlaySoundEffect(soundEffects[8]);
else
{
if (sprite.IsHit())
sprite.PlaySoundEffect(soundEffects[5]);
else
{
if (Constants.isPunching && sprite.GetY() == 399)
sprite.PlaySoundEffect(soundEffects[7]);
else
sprite.PlaySoundEffect(soundEffects[5]);
}
}
}
break;
case "sheild": sprite.PlaySoundEffect(soundEffects[2]); break;
case "sword": sprite.PlaySoundEffect(soundEffects[3]); break;
}
}
}