當前位置: 首頁>>代碼示例>>C#>>正文


C# Graphics.Animation類代碼示例

本文整理匯總了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 } );
 }
開發者ID:djohe,項目名稱:OpenRA,代碼行數:7,代碼來源:WithRoof.cs

示例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;
 }
開發者ID:TiriliPiitPiit,項目名稱:OpenRA,代碼行數:7,代碼來源:AnimationWithOffset.cs

示例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 } );
 }
開發者ID:patthoyts,項目名稱:OpenRA,代碼行數:7,代碼來源:WithFire.cs

示例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)));
		}
開發者ID:JackKucan,項目名稱:OpenRA,代碼行數:7,代碼來源:SpriteEffect.cs

示例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);
            }
        }
開發者ID:RobotCaleb,項目名稱:OpenRA,代碼行數:33,代碼來源:Missile.cs

示例6: AnimationWithOffset

 public AnimationWithOffset(Animation a, Func<WVec> offset, Func<bool> disable, Func<WPos, int> zOffset)
 {
     Animation = a;
     OffsetFunc = offset;
     DisableFunc = disable;
     ZOffset = zOffset;
 }
開發者ID:Flamewh33l,項目名稱:OpenRA,代碼行數:7,代碼來源:AnimationWithOffset.cs

示例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)));
 }
開發者ID:mgatland,項目名稱:OpenRA,代碼行數:7,代碼來源:Explosion.cs

示例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);
            }
        }
開發者ID:Tsher,項目名稱:OpenRA,代碼行數:25,代碼來源:Bullet.cs

示例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);
            }
        }
開發者ID:TiriliPiitPiit,項目名稱:OpenRA,代碼行數:30,代碼來源:Missile.cs

示例10: Initialize

		public override void Initialize(WidgetArgs args)
		{
			base.Initialize(args);

			icon = new Animation(world, "icon");
			clock = new Animation(world, "clock");
		}
開發者ID:JackKucan,項目名稱:OpenRA,代碼行數:7,代碼來源:SupportPowerBinWidget.cs

示例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));
 }
開發者ID:JamesDunne,項目名稱:OpenRA,代碼行數:7,代碼來源:IonCannon.cs

示例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;
        }
開發者ID:ushardul,項目名稱:OpenRA,代碼行數:26,代碼來源:RenderSprites.cs

示例13: PowerdownIndicator

        public PowerdownIndicator(Actor a)
        {
            this.a = a;

            anim = new Animation(a.World, "poweroff");
            anim.PlayRepeating("offline");
        }
開發者ID:RobotCaleb,項目名稱:OpenRA,代碼行數:7,代碼來源:PowerdownIndicator.cs

示例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;
        }
開發者ID:rhamilton1415,項目名稱:OpenRA,代碼行數:25,代碼來源:NukeLaunch.cs

示例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));
                }
            }
        }
開發者ID:patthoyts,項目名稱:OpenRA,代碼行數:31,代碼來源:RenderUnitTurreted.cs


注:本文中的OpenRA.Graphics.Animation類示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。