本文整理汇总了C#中Actor类的典型用法代码示例。如果您正苦于以下问题:C# Actor类的具体用法?C# Actor怎么用?C# Actor使用的例子? 这里精选的类代码示例或许可以为您提供帮助。
示例1: DoImpact
public override void DoImpact(Target target, Actor firedBy, IEnumerable
damageModifiers)
{
if (!target.IsValidFor(firedBy))
return;
var pos = target.CenterPosition;
var world = firedBy.World;
var targetTile = world.Map.CellContaining(pos);
var isValid = IsValidImpact(pos, firedBy);
if ((!world.Map.Contains(targetTile)) || (!isValid))
return;
var palette = ExplosionPalette;
if (UsePlayerPalette)
palette += firedBy.Owner.InternalName;
var explosion = Explosions.RandomOrDefault(Game.CosmeticRandom);
if (Image != null && explosion != null)
world.AddFrameEndTask(w => w.Add(new SpriteEffect(pos, w, Image, explosion, palette)));
var impactSound = ImpactSounds.RandomOrDefault(Game.CosmeticRandom);
if (impactSound != null)
Game.Sound.Play(impactSound, pos);
}
原文链接:http://www.jxszl.com/biancheng/C/556479.html