예제 #1
0
        // Adds an animation to the list, stored in the struct format AnimationData. You need to assign all variables
        // in this struct except DefaultAnimationSpeed. If you assign DefaultAnimationSpeed it will be ignored.
        // To make this clear, DefaultAnimationSpeed can only be directly set through a function or reflection.
        public void AddAnimationData(AnimationData inputData)
        {
            if (inputData.cachedClip == null)
            {
                if (inputData.CustomGameObject == null)
                {
                    inputData.CustomGameObject = gameObject;
                }

                inputData.cachedClip = _getOrCacheAnimClip(inputData.AnimationName, inputData.CustomGameObject);
            }

            if (inputData.cachedClip == null)
            {
                throw new System.NullReferenceException("No Animation found on the cachedAnimator on gameobject " +
                                                        inputData.CustomGameObject.name + " of name " +
                                                        inputData.AnimationName);
            }

            inputData.SetDefaultAnimationSpeed(inputData.cachedClip.fps);
            speedModifyAnimations.Add(inputData);
            if (active && speedModActive)
            {
                _UpdateSingleAnimation(inputData);
            }
        }