protected override void UpdateFrameInternal() { MapLoc = AnimLoc * GraphicsManager.TileSize; int farthest_distance = GraphicsManager.TileSize * (FallShort ? 1 : 2) / 3; Loc toOffset = CharDir.GetLoc() * farthest_distance; if (ActionTime < AnimRushTime) { //dont do anything; the animation itself will take care of pull-back } else if (ActionTime < AnimHitTime) { double intb = (double)(ActionTime - AnimRushTime).FractionOf(AnimHitTime - AnimRushTime); Loc newLoc = new Loc(AnimMath.Lerp(0, toOffset.X, intb), AnimMath.Lerp(0, toOffset.Y, intb)); drawOffset = newLoc; } else if (ActionTime < AnimReturnTime) { drawOffset = toOffset; } else { double intb = (double)(ActionTime - AnimReturnTime).FractionOf(AnimTotalTime - AnimReturnTime); Loc newLoc = new Loc(AnimMath.Lerp(toOffset.X, 0, intb), AnimMath.Lerp(toOffset.Y, 0, intb)); drawOffset = newLoc; } }
public override void Update(FrameTick elapsedTime) { //set the character's projected movement Move = CharDir.GetLoc() * (run ? 5 : 2); }