Exemple #1
0
 /// <summary>
 /// Play animation clip.
 /// </summary>
 /// <param name="clip">Animation clip to play.</param>
 /// <param name="speed">Animation playing speed.</param>
 /// <param name="startingStep">Animation starting step.</param>
 public void PlayAnimation(SpriteAnimationClip clip, float speed = 1f, int?startingStep = null)
 {
     _currAnimation = new SpriteAnimationClipPlay(clip, speed, startingStep);
     _currAnimation.OnAnimationEnd = () =>
     {
         this.OnAnimationEnd?.Invoke();
     };
 }
Exemple #2
0
 /// <summary>
 /// Set spritesheet step from index.
 /// </summary>
 /// <param name="index">Step index to set.</param>
 public void SetStep(int index)
 {
     _spritesheetStep = Spritesheet.GetStep(index);
     _currAnimation   = null;
 }
Exemple #3
0
 /// <summary>
 /// Set spritesheet step from string identifier.
 /// </summary>
 /// <param name="identifier">Step identifier (must be set in spriteshet).</param>
 public void SetStep(string identifier)
 {
     _spritesheetStep = Spritesheet.GetStep(identifier);
     _currAnimation   = null;
 }
Exemple #4
0
 /// <summary>
 /// Change the spritesheet and current step of this sprite.
 /// </summary>
 /// <param name="newSpritesheet">New spritesheet data to use.</param>
 /// <param name="startingStep">Step to set from new spritesheet.</param>
 public void ChangeSpritesheet(SpriteSheet newSpritesheet, int startingStep = 0)
 {
     Spritesheet      = newSpritesheet;
     _spritesheetStep = Spritesheet.GetStep(startingStep);
     _currAnimation   = null;
 }