Exemple #1
0
        /// <summary>
        /// Gets a <see cref="Rectangle"/> that represents the sprite in the <see cref="AnimationSource"/>.
        /// </summary>
        /// <param name="source">The <see cref="AnimationSource"/>.</param>
        /// <returns></returns>
        public Rectangle ToRectangle(AnimationSource source)
        {
            PointByte size = source.spriteSize;

            return(new Rectangle(tile.x * size.x, tile.y * size.y, size.x, size.y));
        }
 /// <summary>
 /// Creates a <see cref="SwitchTextureFrame"/> with the given X and Y position, frame duration, and spritesheet.
 /// </summary>
 /// <param name="x">X position of the tile.</param>
 /// <param name="y">Y position of the tile.</param>
 /// <param name="duration">Duration of the frame.</param>
 /// <param name="texturePath">
 /// Spritesheet that this track will switch to upon reaching this frame, -or- <see langword="null"/> to use the
 /// <see cref="AnimationSource"/>'s texture.
 /// </param>
 /// <exception cref="ArgumentException"><paramref name="texturePath"/> is <see langword="null"/> or white space.</exception>
 public SwitchTextureFrame(byte x, byte y, ushort duration, [CanBeNull] string texturePath)
 {
     tile             = new PointByte(x, y);
     this.duration    = duration;
     this.texturePath = texturePath;
 }
Exemple #3
0
 /// <summary>
 /// Creates a <see cref="Frame"/> with the given X and Y position, and frame duration to play.
 /// </summary>
 /// <param name="x">X position of the tile.</param>
 /// <param name="y">Y position of the tile.</param>
 /// <param name="duration">Duration of the frame.</param>
 public Frame(byte x, byte y, ushort duration = 0)
 {
     tile          = new PointByte(x, y);
     this.duration = duration;
 }