Пример #1
0
 public Explosion(SpriteSheetAnimator animator, Vector2 position)
 {
     _animator = animator;
     _animator.Sprite.Position = position;
     _animator.IsLooping       = false;
     _animator.PlayAnimation("explode", Destroy);
 }
Пример #2
0
 public Explosion(SpriteSheetAnimationGroup animations, Vector2 position, float radius)
 {
     _animator = new SpriteSheetAnimator(animations)
     {
         Sprite    = { Position = position, Scale = Vector2.One * radius * 0.2f },
         IsLooping = false
     };
     _animator.PlayAnimation("explode", Destroy);
 }
Пример #3
0
 public Explosion(SpriteSheetAnimationGroup animations, Vector2 position, float radius)
 {
     _animator = new SpriteSheetAnimator(animations)
     {
         Sprite = { Position = position, Scale = Vector2.One * radius * 0.2f },
         IsLooping = false
     };
     _animator.PlayAnimation("explode", Destroy);
 }
Пример #4
0
        public Zombie(TextureAtlas textureAtlas)
        {
            _sprite = new Sprite(textureAtlas[0])
            {
                OriginNormalized = new Vector2(0.5f, 1.0f)
            };

            _animator = new SpriteSheetAnimator(_sprite, textureAtlas);
            _animator.AddAnimation("appear", framesPerSecond: 8, firstFrameIndex: 0, lastFrameIndex: 10);
            _animator.AddAnimation("idle", framesPerSecond: 8, firstFrameIndex: 36, lastFrameIndex: 41);
            _animator.AddAnimation("walk", framesPerSecond: 8, firstFrameIndex: 19, lastFrameIndex: 28);
            _animator.AddAnimation("attack", framesPerSecond: 8, firstFrameIndex: 29, lastFrameIndex: 35);
            _animator.AddAnimation("die", framesPerSecond: 8, firstFrameIndex: 11, lastFrameIndex: 18);

            _animator.PlayAnimation("appear", ResumeIdle);
        }