protected override void UpdateFrameInternal() { FrameTick trueTime = ActionTime * SpeedMult; int curSegment = Math.Min(trueTime.ToFrames() / FINISH_TIME, MidLocs.Count - 1); Dir8 midDir = MidDirs[curSegment]; Loc fromLoc = MidLocs[curSegment]; Loc toLoc = curSegment + 1 < MidLocs.Count ? MidLocs[curSegment + 1] : ToLoc; dirOffset = (Dir8)(((int)midDir - (int)CharDir + DirExt.DIR8_COUNT) % DirExt.DIR8_COUNT); FrameTick segmentTime = trueTime - FINISH_TIME * curSegment; double intb = Math.Min(1.0, (double)segmentTime.FractionOf(FINISH_TIME)); MapLoc = new Loc(AnimMath.Lerp(fromLoc.X * GraphicsManager.TileSize, toLoc.X * GraphicsManager.TileSize, intb), AnimMath.Lerp(fromLoc.Y * GraphicsManager.TileSize, toLoc.Y * GraphicsManager.TileSize, intb)); }
public void GetCurrentSprite(CharSheet sheet, out int currentAnim, out int currentTime, out int currentFrame) { currentAnim = charFrameType; currentTime = ActionTime.ToFrames(); currentFrame = sheet.GetCurrentFrame(charFrameType, DirExt.AddAngles(CharDir, dirOffset), FrameMethod); }