public TimelineState GetTimelineState(GameObject sourceObject = null)
            {
                if (_timelineState == null)
                {
                    if (string.IsNullOrEmpty(_file._filePath))
                    {
                        if (_stateMachine != null)
                        {
                            foreach (TimelineState state in _stateMachine._states)
                            {
                                if (state._stateId == _stateId)
                                {
                                    _timelineState = state;
                                    break;
                                }
                            }
                        }
                        else
                        {
                            throw new Exception("TimelineStateRefProperty need to be fixed up by TimelineStateMachine");
                        }
                    }
                    else
                    {
                        TextAsset asset = _file.LoadAsset();
                        _stateMachine = TimelineStateMachine.FromTextAsset(asset, sourceObject);
                        _file.UnloadAsset();
                        _timelineState = _stateMachine.GetTimelineState(_stateId);
                    }
                }

                return(_timelineState);
            }
Beispiel #2
0
            public State GetState(GameObject sourceObject = null)
            {
                if (_state == null)
                {
                    //If file path is invalid then its an internal state.
                    if (IsInternal())
                    {
                        if (_parentStateMachine != null)
                        {
                            _state = _parentStateMachine.GetState(_stateId);
                        }
                        else
                        {
                            throw new Exception("StateRefProperty need to be fixed up by a StateMachine before allowing access to internal state.");
                        }
                    }
                    //Otherwise its pointing at an external asset.
                    else
                    {
                        TextAsset asset = _file.LoadAsset();
                        _parentStateMachine = StateMachine.FromTextAsset(asset, sourceObject);
                        _file.UnloadAsset();
                        _state = _parentStateMachine.GetState(_stateId);
                    }
                }

                return(_state);
            }