/// <summary> /// The same as SpriteAligned(Corner, float, float) but offset by a constant amount. /// </summary> /// <param name="spriteCorner"></param> /// <param name="proportionX"></param> /// <param name="proportionY"></param> /// <param name="offset"></param> /// <returns></returns> public static IPointLocator SpriteAligned(Corner spriteCorner, float proportionX, float proportionY, Point offset) { return(new AlignedSpriteLocator( Locators.AnimationBoundsPoint(proportionX, proportionY), Locators.SpriteBoundsPoint(spriteCorner), offset)); }
/// <summary> /// The same as SpriteAligned(Corner, Corner) but offset by a constant amount. /// </summary> /// <param name="spriteCorner"></param> /// <param name="animationCorner"></param> /// <param name="offset"></param> /// <returns></returns> public static IPointLocator SpriteAligned(Corner spriteCorner, Corner animationCorner, Point offset) { return(new AlignedSpriteLocator( Locators.AnimationBoundsPoint(animationCorner), Locators.SpriteBoundsPoint(spriteCorner), offset)); }
public override void Start() { base.Start(); if (this.AlignmentPointLocator == null) { this.AlignmentPointLocator = Locators.SpriteBoundsPoint(Corner.MiddleCenter); } this.InitializeLocator(this.PointWalker); this.InitializeLocator(this.AlignmentPointLocator); this.spriteLocator = new AlignedSpriteLocator(this.PointWalker, this.AlignmentPointLocator); this.spriteLocator.Sprite = this.Sprite; }
public override void Start() { base.Start(); if (this.AlignmentPointLocator == null) { this.AlignmentPointLocator = Locators.SpriteBoundsPoint(Corner.MiddleCenter); } this.InitializeLocator(this.RectangleLocator); this.InitializeLocator(this.AlignmentPointLocator); this.InitializeLocator(this.StartPointLocator); IPointLocator startLocator = this.StartPointLocator ?? Locators.At(this.RectangleLocator.GetRectangle().Location); this.walker = new RectangleWalker(this.RectangleLocator, this.WalkDirection, startLocator); this.walker.Sprite = this.Sprite; this.spriteLocator = new AlignedSpriteLocator(this.walker, this.AlignmentPointLocator); this.spriteLocator.Sprite = this.Sprite; }
/// <summary> /// Create a Mover that will move a sprite so that the given corner moves from the given /// proportional location of the animation bounds to the other given proportional location. /// </summary> public static MoveEffect Move(Corner spriteCorner, float fromProportionX, float fromProportionY, float toProportionX, float toProportionY) { return(new MoveEffect( Locators.SpriteAligned(spriteCorner, fromProportionX, fromProportionY), Locators.SpriteAligned(spriteCorner, toProportionX, toProportionY))); }
public static MoveEffect Move(Corner fromCorner, Point fromOffset, Corner toCorner, Point toOffset) { return(new MoveEffect( Locators.SpriteAligned(fromCorner, fromOffset), Locators.SpriteAligned(toCorner, toOffset))); }
public static MoveEffect Move(Corner fromCorner, Corner toCorner) { return(new MoveEffect( Locators.SpriteAligned(fromCorner), Locators.SpriteAligned(toCorner))); }
/// <summary> /// Creates an animation that keeps the given corner in the centre of the animation /// </summary> /// <param name="cornerToCenter"></param> /// <returns></returns> public static MoveEffect Centre(Corner cornerToCenter) { return(new GotoEffect(Locators.SpriteAligned(Corner.MiddleCenter, cornerToCenter))); }
public static GotoEffect Goto(Corner toCorner, Point toOffset) { return(new GotoEffect(Locators.SpriteAligned(toCorner, toOffset))); }
public static GotoEffect Goto(Corner toCorner) { return(new GotoEffect(Locators.SpriteAligned(toCorner))); }
public static GotoEffect Goto(int x, int y) { return(new GotoEffect(Locators.At(x, y))); }
/// <summary> /// Create a PointLocator that will align the given corner of a sprite /// at the given corner of the animation. /// </summary> /// <remarks>For example, /// Locators.SpriteAligned(Corners.MiddleCenter, Corner.BottomRight) means the center /// of the sprite will be placed at the bottom right corner of the animation. /// </remarks> /// <param name="spriteCorner">The corner of the sprite to be aligned</param> /// <param name="corner">The corner at which it will be aligned</param> /// <returns>A point locator</returns> public static IPointLocator SpriteAligned(Corner spriteCorner, Corner animationCorner) { return(Locators.SpriteAligned(spriteCorner, animationCorner, Point.Empty)); }
/// <summary> /// The same as SpriteAligned(Corner) but offset by a constant amount. /// </summary> /// <param name="corner"></param> /// <param name="offset"></param> /// <returns></returns> public static IPointLocator SpriteAligned(Corner corner, Point offset) { return(Locators.SpriteAligned(corner, corner, offset)); }
/// <summary> /// Create a PointLocator that will align the given corner of a sprite /// at the corresponding corner of the animation. /// </summary> /// <remarks>For example, /// Locators.SpriteAligned(Corners.BottomRight) means the bottom right corner /// of the sprite will be placed at the bottom right corner of the animation. /// </remarks> /// <param name="corner">The corner to be aligned AND the corner at which it will be aligned</param> /// <returns>A point locator</returns> public static IPointLocator SpriteAligned(Corner corner) { return(Locators.SpriteAligned(corner, corner, Point.Empty)); }
/// <summary> /// Create a PointLocator that will align the given corner of a sprite /// at the proportional location of bounds of the animation. /// </summary> /// <remarks>For example, /// Locators.SpriteAligned(Corners.MiddleCenter, 0.6f, 0.7f) means the center /// of the sprite will be placed 60% across and 70% down the animation. /// </remarks> /// <param name="spriteCorner">The corner of the sprite to be aligned</param> /// <param name="proportionX">The x axis proportion</param> /// <param name="proportionY">The y axis proportion</param> /// <returns>A point locator</returns> public static IPointLocator SpriteAligned(Corner spriteCorner, float proportionX, float proportionY) { return(Locators.SpriteAligned(spriteCorner, proportionX, proportionY, Point.Empty)); }