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


C# Animation.Start方法代码示例

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


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

示例1: Soldier

        public Soldier(EntityState es, string name, XmlParser xp)
            : base(es, name)
        {
            Name = name + ID;

            Body = new Body(this, "Body");
            AddComponent(Body);

            Physics = new Physics(this, "Physics");
            AddComponent(Physics);

            Animation = new Animation(this, "Animation");
            Animation.Start();
            AddComponent(Animation);

            Collision = new Collision(this, "Collision");
            AddComponent(Collision);

            Health = new Health(this, "Health");
            Health.DiedEvent += OnDeath;
            AddComponent(Health);

            _attacktimer = new Timer(this, "AttackTimer");
            _attacktimer.LastEvent += OnAttackTimer;
            AddComponent(_attacktimer);

            _attacksound = new Sound(this, "AttackSound");
            AddComponent(_attacksound);

            _hitsound = new Sound(this, "HitSound");
            AddComponent(_hitsound);

            _ge = new GibEmitter(this, "GibEmitter");
            AddComponent(_ge);

            string path = es.Name + "->" + "Soldier";
            ParseXml(xp, path);

            Animation.Flip = (_rand.RandomBool()) ? SpriteEffects.None : SpriteEffects.FlipHorizontally;
            Physics.Velocity.X = (Animation.Flip == SpriteEffects.None) ? -_speed : _speed;
            Body.Position.X = (Animation.Flip == SpriteEffects.None) ? es.GameRef.Viewport.Right + 10 : -10;
            Body.Position.Y = 520 - _rand.Next(-10, 10);

            //TODO: Set origin
            //TODO: Set Health.DiedEvent to emit blood particles and Destroy
        }
开发者ID:redcodefinal,项目名称:SuperTownDefensev2,代码行数:46,代码来源:Soldier.cs

示例2: EnqueueAnimation

 private void EnqueueAnimation(Animation anim)
 {
     lock(animLock)
     {
         lastAnim = anim;
         if(current == null || current.Ended)
         {
             current = anim;
             current.Start();
             Monitor.PulseAll(animLock);
         }
         else
             animQueue.Enqueue(anim);
         //System.Console.Error.WriteLine("DEBUG: AnimQueue count: {0}", animQueue.Count);
     }
 }
开发者ID:sciaopin,项目名称:bang-sharp,代码行数:16,代码来源:AnimationLayer.cs

示例3: NextAnimation

 public void NextAnimation()
 {
     lock(animLock)
         if(animQueue.Count > 0)
         {
             current = animQueue.Dequeue();
             current.Start();
             Monitor.PulseAll(animLock);
         }
 }
开发者ID:sciaopin,项目名称:bang-sharp,代码行数:10,代码来源:AnimationLayer.cs

示例4: HitPointsChanged

        private void HitPointsChanged(object sender, HitPointsEventArgs args)
        {
            if (animation != null)
                RemoveAnimation ();

            int start = angle;
            int end = HPToDegrees (hit_points);
            Console.WriteLine (start);
            Console.WriteLine (end + "\n");

            animation = new Animation<int> (TimeSpan.FromSeconds (1));
            animation.Transform = delegate (Animation<int> anim, int frame) {
                double difference = Math.Abs (start - end);
                double value_per_frame = difference / animation.TotalFrames;
                int new_val;

                if (start < end)
                    new_val = (int) (start + (value_per_frame * frame + 1));
                else
                    new_val = (int) (start - (value_per_frame * frame + 1));

                return new_val;
            };
            animation.NewFrame += NewFrame;
            animation.Completed += delegate { RemoveAnimation (); };
            animation.Start ();
        }
开发者ID:manicolosi,项目名称:questar,代码行数:27,代码来源:HitPointsChart.cs


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