示例#1
0
        protected void RequestMove(string name, bool waitLoopOrEnd = false)
        {
            // nullなら終了への遷移とする
            if (name == null)
            {
                _next        = null;
                _stopRequest = true;
            }
            else
            {
                // 多重初期化は中でチェックしている
                Initialize();

                // 見つからなければそもそも遷移を行わない
                if (_map.ContainsKey(name))
                {
                    _next = _map[name];
                }
            }

            if (!waitLoopOrEnd ||          // ループ/終了を待たないなら即座
                (waitLoopOrEnd && (_current == null)))                    // _currentがnullなら即座
            {
                Move(false, false);
            }
        }
示例#2
0
 public virtual void Dispose()
 {
     foreach (var item in _animations)
     {
         item.Dispose();
     }
     _animations      = null;
     _map             = null;
     _autoTransitions = null;
     _current         = null;
     _next            = null;
 }
示例#3
0
        private void Move(bool currentIsLooping, bool useAutoTransition)
        {
            AfterEffectsAnimation to = null;

            if (useAutoTransition && !currentIsLooping)             // ループでなければ自動遷移を参照
            {
                if (_current != null)
                {
                    // 自動遷移が設定されていれば、
                    if (_autoTransitions.ContainsKey(_current))
                    {
                        to = _autoTransitions[_current];
                    }
                }
            }

            if (to == null)             // 自動遷移が設定されてない場合_nextを使用
            {
                to = _next;
            }

            if (to == _current)             // 行き先が今と同じなら単に巻き戻し
            {
                _current.SetNormalizedTime(0f);
            }
            else
            {
                // 停止
                if (_current != null)
                {
                    if ((to != null) ||                  // 行き先が存在する場合
                        _stopRequest ||                         // 強制停止を要求された場合
                        !currentIsLooping)                            // アニメが終了している(=ループでない)
                    {
                        _current.gameObject.SetActive(false);
                        _current     = null;
                        _next        = null;
                        _stopRequest = false;
                    }
                }

                // 新規再生
                if (to != null)
                {
                    _current = to;
                    if (!_current.gameObject.activeSelf)
                    {
                        _current.gameObject.SetActive(true);
                    }
                    _current.Play(OnEnd, OnLoop);
                }
            }
        }