Пример #1
0
        public override void LoadData(string stringData)
        {
            AnimatorData data = Serializer.LoadScriptData <AnimatorData> (stringData);

            if (data == null)
            {
                loadedData = false;
                return;
            }
            SavePrevented = data.savePrevented; if (savePrevented)
            {
                return;
            }

            if (!string.IsNullOrEmpty(data.controllerID))
            {
                RuntimeAnimatorController runtimeAnimatorController = AssetLoader.RetrieveAsset(_animator.runtimeAnimatorController, data.controllerID);
                if (runtimeAnimatorController != null)
                {
                    _animator.runtimeAnimatorController = runtimeAnimatorController;
                }
            }

            StringToParameterValues(Animator.parameters, data.parameterData);
            StringToLayerWeights(data.layerWeightData);
            StringToStates(data.stateData);

            loadedData = true;
        }
        public override string SaveData()
        {
            AnimatorData animatorData = new AnimatorData();

            animatorData.objectID = constantID;

            animatorData.parameterData   = ParameterValuesToString(_animator.parameters);
            animatorData.layerWeightData = LayerWeightsToString();
            animatorData.stateData       = StatesToString();

            return(Serializer.SaveScriptData <AnimatorData> (animatorData));
        }
        public override void LoadData(string stringData)
        {
            AnimatorData data = Serializer.LoadScriptData <AnimatorData> (stringData);

            if (data == null)
            {
                return;
            }

            StringToParameterValues(_animator.parameters, data.parameterData);
            StringToLayerWeights(data.layerWeightData);
            StringToStates(data.stateData);
        }
Пример #4
0
        public override string SaveData()
        {
            AnimatorData animatorData = new AnimatorData();

            animatorData.objectID      = constantID;
            animatorData.savePrevented = savePrevented;

            if (saveController && _animator.runtimeAnimatorController != null)
            {
                animatorData.controllerID = AssetLoader.GetAssetInstanceID(_animator.runtimeAnimatorController);
            }

            animatorData.parameterData   = ParameterValuesToString(Animator.parameters);
            animatorData.layerWeightData = LayerWeightsToString();
            animatorData.stateData       = StatesToString();

            return(Serializer.SaveScriptData <AnimatorData> (animatorData));
        }