public override void Update() { IAnimation2D currentAnimation2D = GetCurrentAnimation(); if (currentAnimation2D != null) { if (currentAnimation2D.State == AnimationState.Wait) { currentAnimation2D.Sprite = this; } if (currentAnimation2D.State != AnimationState.End) { currentAnimation2D.Run(); } if (currentAnimation2D.State == AnimationState.End) { if (currentAnimation2D is AnimationTo) { AnimationTo animationTo = (currentAnimation2D as AnimationTo); DrawedPoints.Add(animationTo.ToPosition); } Animations.Dequeue(); //isd = true; } } }
public override void Draw() { DrawRunedLines(); IAnimation2D currentAnimation2D = GetCurrentAnimation(); if (currentAnimation2D is AnimationTo) { AnimationTo animationTo = (currentAnimation2D as AnimationTo); Vector2 fromVector = DrawedPoints[DrawedPoints.Count - 1]; Graphics.DrawLine(fromVector, this.Positon, Pen.Size, Pen.Color); /* if (isd) * { * isd = false; * Console.WriteLine(string.Format("{0}->{1}", fromVector, this.Positon)); * }*/ } DrawTexture(); //base.Draw(); //Graphics.DrawLine(new Vector2(-100, 100), new Vector2(100, -100), 10, Color.Red); }
public void Backward(float distance) { AnimationTo animationTo = new AnimationTo(this.MoveSpeed, distance, true); Animations.Enqueue(animationTo); }
public void Forward(float distance) { AnimationTo animationTo = new AnimationTo(this.MoveSpeed, distance, false); Animations.Enqueue(animationTo); }