本文整理汇总了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);
}
示例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);
}
示例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;
}
示例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);
}
}
}
示例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);
}