コード例 #1
0
        private void Play()
        {
            if (_fps <= 0)
            {
                return;
            }

            if (Time.time - _lastTime < _requiredSeconds)
            {
                return;
            }

            var frameInfo = currentState.NextFrame();

            spriteRenderer.sprite = frameInfo.sprite;

            frameInfo.events.ForEach(OnEvent);

            if (!string.IsNullOrEmpty(frameInfo.nextStateName))
            {
                currentState = GetState(frameInfo.nextStateName);
            }

            _requiredSeconds = 1f / _fps;
            _lastTime        = Time.time;
        }
コード例 #2
0
 public void PlayState(string stateName)
 {
     currentState = GetState(stateName);
 }