本文整理汇总了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
}
示例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);
}
}
示例3: NextAnimation
public void NextAnimation()
{
lock(animLock)
if(animQueue.Count > 0)
{
current = animQueue.Dequeue();
current.Start();
Monitor.PulseAll(animLock);
}
}
示例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 ();
}