本文整理汇总了C#中OpenRA.Graphics.Animation类的典型用法代码示例。如果您正苦于以下问题:C# Animation类的具体用法?C# Animation怎么用?C# Animation使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
Animation类属于OpenRA.Graphics命名空间,在下文中一共展示了Animation类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: WithRoof
public WithRoof(Actor self)
{
var rs = self.Trait<RenderSimple>();
var roof = new Animation(rs.GetImage(self), () => self.Trait<IFacing>().Facing);
roof.Play("roof");
rs.anims.Add( "roof", new RenderSimple.AnimationWithOffset( roof ) { ZOffset = 24 } );
}
示例2: AnimationWithOffset
public AnimationWithOffset(Animation a, Func<WVec> offset, Func<bool> disable, Func<WPos, int> zOffset)
{
this.Animation = a;
this.OffsetFunc = offset;
this.DisableFunc = disable;
this.ZOffset = zOffset;
}
示例3: WithFire
public WithFire(Actor self)
{
var rs = self.Trait<RenderSimple>();
var roof = new Animation(rs.GetImage(self));
roof.PlayThen("fire-start", () => roof.PlayRepeating("fire-loop"));
rs.anims.Add( "fire", new RenderSimple.AnimationWithOffset( roof, () => new float2(7,-15), null ) { ZOffset = 24 } );
}
示例4: SpriteEffect
public SpriteEffect(WPos pos, World world, string sprite, string palette)
{
this.pos = pos;
this.palette = palette;
anim = new Animation(world, sprite);
anim.PlayThen("idle", () => world.AddFrameEndTask(w => w.Remove(this)));
}
示例5: Missile
public Missile(MissileInfo info, ProjectileArgs args)
{
this.info = info;
this.args = args;
pos = args.Source;
facing = args.Facing;
targetPosition = args.PassiveTarget;
var world = args.SourceActor.World;
if (world.SharedRandom.Next(100) <= info.LockOnProbability)
lockOn = true;
if (info.Inaccuracy.Range > 0)
{
var inaccuracy = OpenRA.Traits.Util.ApplyPercentageModifiers(info.Inaccuracy.Range, args.InaccuracyModifiers);
offset = WVec.FromPDF(world.SharedRandom, 2) * inaccuracy / 1024;
}
if (info.Image != null)
{
anim = new Animation(world, info.Image, () => facing);
anim.PlayRepeating("idle");
}
if (info.ContrailLength > 0)
{
var color = info.ContrailUsePlayerColor ? ContrailRenderable.ChooseColor(args.SourceActor) : info.ContrailColor;
trail = new ContrailRenderable(world, color, info.ContrailLength, info.ContrailDelay, 0);
}
}
示例6: AnimationWithOffset
public AnimationWithOffset(Animation a, Func<WVec> offset, Func<bool> disable, Func<WPos, int> zOffset)
{
Animation = a;
OffsetFunc = offset;
DisableFunc = disable;
ZOffset = zOffset;
}
示例7: Explosion
public Explosion(World world, int2 pixelPos, string style, bool isWater)
{
this.pos = pixelPos;
anim = new Animation("explosion");
anim.PlayThen(style,
() => world.AddFrameEndTask(w => w.Remove(this)));
}
示例8: Bullet
public Bullet(BulletInfo info, ProjectileArgs args)
{
Info = info;
Args = args;
if (info.Inaccuracy > 0)
{
var factor = ((Args.dest - Args.src).ToCVec().Length) / args.weapon.Range;
Args.dest += (PVecInt) (info.Inaccuracy * factor * args.firedBy.World.SharedRandom.Gauss2D(2)).ToInt2();
Log.Write("debug", "Bullet with Inaccuracy; factor: #{0}; Projectile dest: {1}", factor, Args.dest);
}
if (Info.Image != null)
{
anim = new Animation(Info.Image, GetEffectiveFacing);
anim.PlayRepeating("idle");
}
if (Info.ContrailLength > 0)
{
Trail = new ContrailHistory(Info.ContrailLength,
Info.ContrailUsePlayerColor ? ContrailHistory.ChooseColor(args.firedBy) : Info.ContrailColor,
Info.ContrailDelay);
}
}
示例9: Missile
public Missile(MissileInfo info, ProjectileArgs args)
{
this.info = info;
this.args = args;
pos = args.Source;
facing = args.Facing;
targetPosition = args.PassiveTarget;
// Convert ProjectileArg definitions to world coordinates
// TODO: Change the yaml definitions so we don't need this
var inaccuracy = (int)(info.Inaccuracy * 1024 / Game.CellSize);
speed = info.Speed * 1024 / (5 * Game.CellSize);
if (info.Inaccuracy > 0)
offset = WVec.FromPDF(args.SourceActor.World.SharedRandom, 2) * inaccuracy / 1024;
if (info.Image != null)
{
anim = new Animation(info.Image, () => facing);
anim.PlayRepeating("idle");
}
if (info.ContrailLength > 0)
{
var color = info.ContrailUsePlayerColor ? ContrailRenderable.ChooseColor(args.SourceActor) : info.ContrailColor;
trail = new ContrailRenderable(args.SourceActor.World, color, info.ContrailLength, info.ContrailDelay, 0);
}
}
示例10: Initialize
public override void Initialize(WidgetArgs args)
{
base.Initialize(args);
icon = new Animation(world, "icon");
clock = new Animation(world, "clock");
}
示例11: IonCannon
public IonCannon(Actor firedBy, World world, CPos location)
{
this.firedBy = firedBy;
target = Target.FromCell(location);
anim = new Animation("ionsfx");
anim.PlayThen("idle", () => Finish(world));
}
示例12: NormalizeSequence
public static string NormalizeSequence(Animation anim, DamageState state, string sequence)
{
var states = new Pair<DamageState, string>[]
{
Pair.New(DamageState.Critical, "critical-"),
Pair.New(DamageState.Heavy, "damaged-"),
Pair.New(DamageState.Medium, "scratched-"),
Pair.New(DamageState.Light, "scuffed-")
};
// Remove existing damage prefix
foreach (var s in states)
{
if (sequence.StartsWith(s.Second))
{
sequence = sequence.Substring(s.Second.Length);
break;
}
}
foreach (var s in states)
if (state >= s.First && anim.HasSequence(s.Second + sequence))
return s.Second + sequence;
return sequence;
}
示例13: PowerdownIndicator
public PowerdownIndicator(Actor a)
{
this.a = a;
anim = new Animation(a.World, "poweroff");
anim.PlayRepeating("offline");
}
示例14: NukeLaunch
public NukeLaunch(Player firedBy, string weapon, WPos launchPos, WPos targetPos, WDist velocity, int delay, bool skipAscent, string flashType)
{
this.firedBy = firedBy;
this.weapon = weapon;
this.delay = delay;
this.turn = delay / 2;
this.flashType = flashType;
var offset = new WVec(WDist.Zero, WDist.Zero, velocity * turn);
ascendSource = launchPos;
ascendTarget = launchPos + offset;
descendSource = targetPos + offset;
descendTarget = targetPos;
anim = new Animation(firedBy.World, weapon);
anim.PlayRepeating("up");
pos = launchPos;
var weaponRules = firedBy.World.Map.Rules.Weapons[weapon.ToLowerInvariant()];
if (weaponRules.Report != null && weaponRules.Report.Any())
Sound.Play(weaponRules.Report.Random(firedBy.World.SharedRandom), pos);
if (skipAscent)
ticks = turn;
}
示例15: RenderUnitTurreted
public RenderUnitTurreted(Actor self)
: base(self)
{
var facing = self.Trait<IFacing>();
var turreted = self.Trait<Turreted>();
var attack = self.TraitOrDefault<AttackBase>();
var attackInfo = self.Info.Traits.Get<AttackBaseInfo>();
var turretAnim = new Animation(GetImage(self), () => turreted.turretFacing );
turretAnim.Play( "turret" );
for( var i = 0; i < attack.Turrets.Count; i++ )
{
var turret = attack.Turrets[i];
anims.Add( "turret_{0}".F(i),
new AnimationWithOffset( turretAnim,
() => Combat.GetTurretPosition( self, facing, turret ),
null));
if (attackInfo.MuzzleFlash)
{
var muzzleFlash = new Animation(GetImage(self), () => turreted.turretFacing);
muzzleFlash.PlayFetchIndex("muzzle",
() => (int)(turret.Recoil * 5.9f)); /* hack: dumb crap */
anims.Add("muzzle_flash_{0}".F(i),
new AnimationWithOffset(muzzleFlash,
() => Combat.GetTurretPosition(self, facing, turret),
() => turret.Recoil <= 0));
}
}
}