当前位置: 首页>>代码示例>>C#>>正文


C# Animation.AddFrame方法代码示例

本文整理汇总了C#中Animation.AddFrame方法的典型用法代码示例。如果您正苦于以下问题:C# Animation.AddFrame方法的具体用法?C# Animation.AddFrame怎么用?C# Animation.AddFrame使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在Animation的用法示例。


在下文中一共展示了Animation.AddFrame方法的5个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。

示例1: loadAnimations

        //Custom load for AttackDog
        protected override void loadAnimations()
        {
            Animation run1 = new Animation();
            run1.AddFrame(new Rectangle(0, 0, 47, 27), TimeSpan.FromSeconds(1.0));
            animations.Add(run1);

            Animation run2 = new Animation();
            run2.AddFrame(new Rectangle(47, 0, 47, 27), TimeSpan.FromSeconds(1.0));
            animations.Add(run2);

            Animation run3 = new Animation();
            run3.AddFrame(new Rectangle(94, 0, 47, 27), TimeSpan.FromSeconds(1.0));
            animations.Add(run3);
        }
开发者ID:nrkramer,项目名称:KeysToInsanity,代码行数:15,代码来源:AttackDog.cs

示例2: loadAnimations

 protected override void loadAnimations()
 {
     Animation idle = new Animation();
     idle.AddFrame(new Rectangle(0, 0, 72, 71), TimeSpan.FromSeconds(1.0));
     animations.Add(idle);
 }
开发者ID:nrkramer,项目名称:KeysToInsanity,代码行数:6,代码来源:Trucks.cs

示例3: GetPlayerAnimations

        private Dictionary<string, Animation> GetPlayerAnimations()
        {
            // Should read from some file or something

            var animations = new Dictionary<string, Animation>();
            var idle = new Animation();
            idle.AddFrame(float.MaxValue, new Rectangle(0, 0, 32, 32));
            animations.Add("idle", idle);

            var moveleft = new Animation();
            moveleft.AddFrame(100.8f, new Rectangle(352, 0, 32, 32));
            moveleft.AddFrame(100.2f, new Rectangle(384, 0, 32, 32));
            animations.Add("moveleft", moveleft);

            var moveright = new Animation();
            moveright.AddFrame(100.8f, new Rectangle(416, 0, 32, 32));
            moveright.AddFrame(100.2f, new Rectangle(448, 0, 32, 32));
            animations.Add("moveright", moveright);

            var moveup = new Animation();
            moveup.AddFrame(100.8f, new Rectangle(480, 0, 32, 32));
            moveup.AddFrame(100.2f, new Rectangle(512, 0, 32, 32));
            animations.Add("moveup", moveup);

            var movedown = new Animation();
            movedown.AddFrame(100.8f, new Rectangle(288, 0, 32, 32));
            movedown.AddFrame(100.2f, new Rectangle(320, 0, 32, 32));
            animations.Add("movedown", movedown);
            return animations;
        }
开发者ID:koniin,项目名称:Drakborgen,代码行数:30,代码来源:GameState.cs

示例4: ReadAnimationKeyframe

        private void ReadAnimationKeyframe(Animation animation)
        {
            var time = _reader.ReadSingle();

            var keyframe = animation.AddFrame(time);

            var modelPartAnimStateCount = _reader.ReadInt32();
            for (var i = 0; i < modelPartAnimStateCount; i++)
            {
                ReadModelPartAnimState(keyframe);
            }

            if (_modelFormat >= ModelFormat.Emf3)
            {
                var anchorAnimStateCount = _reader.ReadInt32();
                for (var i = 0; i < anchorAnimStateCount; i++)
                {
                    ReadAnchorAnimState(keyframe);
                }
            }
        }
开发者ID:HaKDMoDz,项目名称:Psy,代码行数:21,代码来源:EpicModelReader.cs

示例5: BufferFrames

        public override void BufferFrames()
        {
            var walkDown = new Animation("WalkDown");
            walkDown.AddFrame(new Rectangle(0, 0, 16, 16), TimeSpan.FromSeconds(.25));
            walkDown.AddFrame(new Rectangle(16, 0, 16, 16), TimeSpan.FromSeconds(.25));
            walkDown.AddFrame(new Rectangle(0, 0, 16, 16), TimeSpan.FromSeconds(.25));
            walkDown.AddFrame(new Rectangle(32, 0, 16, 16), TimeSpan.FromSeconds(.25));
            

            var walkUp = new Animation("WalkUp");
            walkUp.AddFrame(new Rectangle(144, 0, 16, 16), TimeSpan.FromSeconds(.25));
            walkUp.AddFrame(new Rectangle(160, 0, 16, 16), TimeSpan.FromSeconds(.25));
            walkUp.AddFrame(new Rectangle(144, 0, 16, 16), TimeSpan.FromSeconds(.25));
            walkUp.AddFrame(new Rectangle(176, 0, 16, 16), TimeSpan.FromSeconds(.25));

            var walkLeft = new Animation("WalkLeft");
            walkLeft.AddFrame(new Rectangle(48, 0, 16, 16), TimeSpan.FromSeconds(.25));
            walkLeft.AddFrame(new Rectangle(64, 0, 16, 16), TimeSpan.FromSeconds(.25));
            walkLeft.AddFrame(new Rectangle(48, 0, 16, 16), TimeSpan.FromSeconds(.25));
            walkLeft.AddFrame(new Rectangle(80, 0, 16, 16), TimeSpan.FromSeconds(.25));

            var walkRight = new Animation("WalkRight");
            walkRight.AddFrame(new Rectangle(96, 0, 16, 16), TimeSpan.FromSeconds(.25));
            walkRight.AddFrame(new Rectangle(112, 0, 16, 16), TimeSpan.FromSeconds(.25));
            walkRight.AddFrame(new Rectangle(96, 0, 16, 16), TimeSpan.FromSeconds(.25));
            walkRight.AddFrame(new Rectangle(128, 0, 16, 16), TimeSpan.FromSeconds(.25));

            this.animations.Add(walkDown);
            this.animations.Add(walkUp);
            this.animations.Add(walkLeft);
            this.animations.Add(walkRight);

            // Standing animations only have a single frame of animation:
            var standDown = new Animation("StandDown");
            standDown.AddFrame(new Rectangle(0, 0, 16, 16), TimeSpan.FromSeconds(.25));

            var standUp = new Animation("StandUp");
            standUp.AddFrame(new Rectangle(144, 0, 16, 16), TimeSpan.FromSeconds(.25));

            var standLeft = new Animation("StandLeft");
            standLeft.AddFrame(new Rectangle(48, 0, 16, 16), TimeSpan.FromSeconds(.25));

            var standRight = new Animation("StandRight");
            standRight.AddFrame(new Rectangle(96, 0, 16, 16), TimeSpan.FromSeconds(.25));
        
            this.animations.Add(standDown);
            this.animations.Add(standUp);
            this.animations.Add(standLeft);
            this.animations.Add(standRight);
        }
开发者ID:asenAce,项目名称:Software_University_Bulgaria,代码行数:50,代码来源:CharacterAnimator.cs


注:本文中的Animation.AddFrame方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。