public int CalculateOffsetY(INPC npc) { var multiplier = npc.IsFacing(EODirection.Left, EODirection.Up) ? -1 : 1; var walkAdjust = npc.IsActing(NPCActionState.Walking) ? WalkHeightFactor * npc.GetWalkFrame() : 0; //walkAdjust * multiplier is the old ViewAdjustY return(npc.X * HeightFactor + npc.Y * HeightFactor + walkAdjust * multiplier); }
public int CalculateOffsetX(INPC npc) { var multiplier = npc.IsFacing(EODirection.Left, EODirection.Down) ? -1 : 1; var walkAdjust = npc.IsActing(NPCActionState.Walking) ? WalkWidthFactor * npc.GetWalkFrame() : 0; //walkAdjust * multiplier is the old ViewAdjustX return(npc.X * WidthFactor - npc.Y * WidthFactor + walkAdjust * multiplier); }
public static int GetAttackFrame(this INPC npc) { if (!npc.IsActing(NPCActionState.Attacking)) { return(0); } return(npc.Frame - NPCFrame.Attack1 + 1); }
private static bool NPCAtCoordinates(INPC npc, int x, int y) { return(npc.IsActing(NPCActionState.Walking) ? npc.GetDestinationX() == x && npc.GetDestinationY() == y : npc.X == x && npc.Y == y); }
private static Optional <DateTime> GetUpdatedActionStartTime(DateTime now, INPC nextFrameNPC) { return(nextFrameNPC.IsActing(NPCActionState.Standing) ? Optional <DateTime> .Empty : new Optional <DateTime>(now)); }