Пример #1
0
 public void Stop(int stopOnIndex)
 {
     if (_currentAnimation != null)
     {
         _frame = stopOnIndex;
         UpdateWithFrameData();
         _currentAnimation = null;
     }
 }
        public void Play(string name, SpriteFrameAnimationResetOption resetOption)
        {
            SpriteFrameAnimation newAnimation = null;

            foreach (var anim in _animations)
            {
                if (anim.name == name)
                {
                    newAnimation = anim;
                    break;
                }
            }

            if (newAnimation == null)
            {
                _currentAnimation = null;
                return;
            }

            switch (resetOption)
            {
            case SpriteFrameAnimationResetOption.ResetIfNew:
            {
                if (newAnimation != _currentAnimation)
                {
                    _frame = 0;
                    _timer = 0;
                }
                break;
            }

            case SpriteFrameAnimationResetOption.ResetAlways:
            {
                _frame = 0;
                _timer = 0;
                break;
            }

            default:
            {
                break;
            }
            }

            _currentAnimation = newAnimation;
            if (_currentAnimation != null)
            {
                UpdateWithFrameData();
            }
        }
Пример #3
0
        public void Play(string name, SpriteFrameAnimationResetOption resetOption)
        {
            SpriteFrameAnimation newAnimation = null;

            foreach (var anim in _animations){
                if (anim.name == name) {
                    newAnimation = anim;
                    break;
                }
            }

            if (newAnimation == null) {
                _currentAnimation = null;
                return;
            }

            switch (resetOption) {
                case SpriteFrameAnimationResetOption.ResetIfNew: {
                    if (newAnimation != _currentAnimation) {
                        _frame = 0;
                        _timer = 0;
                    }
                    break;
                }
                case SpriteFrameAnimationResetOption.ResetAlways: {
                    _frame = 0;
                    _timer = 0;
                    break;
                }
                default: {
                    break;
                }
            }

            _currentAnimation = newAnimation;
            if (_currentAnimation != null) {
                UpdateWithFrameData();
            }
        }
Пример #4
0
 public void Stop()
 {
     _currentAnimation = null;
 }
 public void Stop(int stopOnIndex)
 {
     if (_currentAnimation != null) {
         _frame = stopOnIndex;
         UpdateWithFrameData();
         _currentAnimation = null;
     }
 }
 public void Stop()
 {
     _currentAnimation = null;
 }