public int CalculateOffsetY(ICharacterRenderProperties properties) { var multiplier = properties.IsFacing(EODirection.Left, EODirection.Up) ? -1 : 1; var walkAdjust = properties.IsActing(CharacterActionState.Walking) ? WalkHeightFactor * properties.WalkFrame : 0; //walkAdjust * multiplier is the old ViewAdjustY return(properties.MapX * HeightFactor + properties.MapY * HeightFactor + walkAdjust * multiplier); }
private static bool CharacterIsAtPosition(ICharacterRenderProperties renderProperties, int row, int col) { if (renderProperties.IsActing(CharacterActionState.Walking)) { return(row == renderProperties.GetDestinationY() && col == renderProperties.GetDestinationX()); } return(row == renderProperties.MapY && col == renderProperties.MapX); }
public Vector2 CalculateDrawLocationOfCharacterSkin(Rectangle skinRectangle, Rectangle parentCharacterDrawArea) { var resX = -(float)Math.Floor(Math.Abs((float)skinRectangle.Width - parentCharacterDrawArea.Width) / 2); var resY = -(float)Math.Floor(Math.Abs((float)skinRectangle.Height - parentCharacterDrawArea.Height) / 2); if (_renderProperties.IsActing(CharacterActionState.SpellCast)) { resY -= 2; } // This specific frame is a bitch if (_renderProperties.Gender == 1 && _renderProperties.AttackFrame == 1) { resX += _renderProperties.IsFacing(EOLib.EODirection.Up, EOLib.EODirection.Right) ? 2 : -2; } return(new Vector2(parentCharacterDrawArea.X + resX, parentCharacterDrawArea.Y + resY)); }
private static Optional <DateTime> GetUpdatedActionTime(DateTime now, ICharacterRenderProperties nextFrameRenderProperties) { return(nextFrameRenderProperties.IsActing(CharacterActionState.Standing) ? Optional <DateTime> .Empty : new Optional <DateTime>(now)); }