當前位置: 首頁>>代碼示例>>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;未經允許,請勿轉載。