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; }
public void PlayState(string stateName) { currentState = GetState(stateName); }