Beispiel #1
0
 public void Configure(SPLegacyAnimController controller)
 {
     if (_initialized)
     {
         throw new System.InvalidOperationException("Can not change the Controller of an SPAnimator once it's been initialized.");
     }
     _controller = controller;
 }
 public IEnumerable <Transform> GetTransforms(SPLegacyAnimController controller)
 {
     foreach (var entry in _masks)
     {
         var t = controller.transform.Find(entry.Path);
         if (t != null)
         {
             yield return(t);
         }
     }
 }
 public void Redact(SPLegacyAnimController controller, AnimationState state)
 {
     foreach (var entry in _masks)
     {
         var t = controller.transform.Find(entry.Path);
         if (t != null)
         {
             state.RemoveMixingTransform(t);
         }
     }
 }
 public void Apply(SPLegacyAnimController controller, AnimationState state)
 {
     foreach (var entry in _masks)
     {
         var t = controller.transform.Find(entry.Path);
         if (t != null)
         {
             state.AddMixingTransform(t, entry.Recurse);
         }
     }
 }
        public void Dispose()
        {
            var nm = _id; // _state.name;

            if (_controller != null && _state != null && _controller.animation[nm] == _state)
            {
                _controller.animation.RemoveClip(nm);
            }
            _controller = null;
            _state      = null;
            _mask.Value = null;
        }
        public static SPAnim Create(SPLegacyAnimController anim, string clipId)
        {
            if (anim == null)
            {
                throw new System.ArgumentNullException("anim");
            }
            var a = _pool.GetInstance();

            a._controller   = anim;
            a._clipId       = clipId;
            a._timeSupplier = anim.TimeSupplier as ITimeSupplier;
            return(a);
        }
Beispiel #7
0
 /// <summary>
 /// Associate the collection as a master collection for an SPAnimationController
 /// </summary>
 /// <param name="controller"></param>
 internal void InitMasterCollection(SPLegacyAnimController controller)
 {
     if (controller == null)
     {
         throw new System.ArgumentNullException("container");
     }
     if (this.Initialized)
     {
         throw new System.InvalidOperationException("SPAnimClipCollection already has been initilized.");
     }
     _controller = controller;
     _uniqueHash = null;
 }
Beispiel #8
0
        public void Dispose()
        {
            if (object.ReferenceEquals(_controller, null))
            {
                return;
            }

            var e = _dict.GetEnumerator();

            while (e.MoveNext())
            {
                e.Current.Value.Dispose();
            }
            _controller = null;
        }
 /// <summary>
 /// This is only called from the Master List after the AnimationClip has been added and initialized.
 /// Do not call for any other reason.
 /// </summary>
 /// <param name="controller"></param>
 /// <param name="id"></param>
 /// <param name="state"></param>
 internal void SetAnimState(SPLegacyAnimController controller, string id, AnimationState state)
 {
     //we reset the controller and id to what the SPAnimationController decided it should be
     _controller = controller;
     _id         = id;
     _state      = state;
     if (_state != null)
     {
         _state.weight    = _weight;
         _state.speed     = _speed;
         _state.layer     = _layer;
         _state.wrapMode  = _wrapMode;
         _state.blendMode = _blendMode;
         _masks.SetState(_state);
     }
 }
        public void Init(SPLegacyAnimController controller, string uniqueHash = null)
        {
            if (_controller != null)
            {
                throw new System.InvalidOperationException("Cannot initialize a clip that has already been initialized.");
            }
            if (controller == null)
            {
                throw new System.ArgumentNullException("controller");
            }
            //if (_clip == null) return;
            //if (_clip == null) _clip = SPAnimClip.EmptyClip;

            _controller = controller;
            _id         = (string.IsNullOrEmpty(uniqueHash)) ? _name : _name + uniqueHash;
            _controller.States.AddToMasterList(_id, this);
        }
Beispiel #11
0
        /// <summary>
        /// Initialize a SPAnimClipCollection with a SPAnimationController.
        ///
        /// (internal: this is only used for non-master collections)
        /// </summary>
        /// <param name="controller"></param>
        /// <param name="uniqueHash"></param>
        public void Init(SPLegacyAnimController controller, string uniqueHash = null)
        {
            if (controller == null)
            {
                throw new System.ArgumentNullException("controller");
            }
            if (this.Initialized)
            {
                throw new System.InvalidOperationException("SPAnimClipCollection already has been initilized.");
            }
            _controller = controller;
            _uniqueHash = uniqueHash;

            var e = _dict.GetEnumerator();

            while (e.MoveNext())
            {
                e.Current.Value.Init(_controller, _uniqueHash);
            }
        }
        public void Dispose()
        {
            _controller = null;
            _clipId     = null;
            _weight     = 1f;
            _speed      = 1f;
            _layer      = 0;
            _wrapMode   = UnityEngine.WrapMode.Default;
            _blendMode  = AnimationBlendMode.Blend;
            _mask       = null;
            this.UnregisterTimeScaleChangedEvent();
            _timeSupplier = null;

            _state = null;
            if (_scheduler != null)
            {
                _scheduler.Clear();
            }

            _pool.Release(this);
        }
Beispiel #13
0
 protected abstract void Init(SPEntity entity, SPLegacyAnimController controller);
 public ScriptableAnimCollection(SPLegacyAnimController controller)
 {
     _controller = controller;
 }