restorePreviousAnimationState() public method

public restorePreviousAnimationState ( AnimState state ) : void
state AnimState
return void
Exemplo n.º 1
0
        public void initializeExternal(SSTUAnimData[] animData)
        {
            AnimState prevState = (AnimState)Enum.Parse(typeof(AnimState), persistentState);
            float     time      = prevState == AnimState.STOPPED_START || prevState == AnimState.PLAYING_BACKWARD ? 0 : 1;

            if (controller != null)
            {
                controller.clearAnimationData();
                controller = null;
            }
            controller = new AnimationController(time, animationMaxDeploy);
            controller.addAnimationData(animData);
            controller.restorePreviousAnimationState(prevState, animationMaxDeploy);
            controller.setStateChangeCallback(onAnimationStateChange);
        }
Exemplo n.º 2
0
        private void initialize()
        {
            ConfigNode node = SSTUConfigNodeUtils.parseConfigNode(configNodeData);

            ConfigNode[] animNodes = node.GetNodes("ANIMATION");
            int          len       = animNodes.Length;

            ConfigNode[] allNodes = null;
            if (!String.IsNullOrEmpty(animationName))
            {
                allNodes = new ConfigNode[len + 1];
                for (int i = 0; i < len; i++)
                {
                    allNodes[i] = animNodes[i];
                }
                ConfigNode legacyNode = new ConfigNode("ANIMATION");
                legacyNode.AddValue("name", animationName);
                legacyNode.AddValue("speed", animationSpeed);
                legacyNode.AddValue("layer", animationLayer);
                allNodes[len] = legacyNode;
            }
            else
            {
                allNodes = animNodes;
            }
            if (allNodes == null)
            {
                allNodes = new ConfigNode[0];
            }                                                      //should be impossible, but ensures clean init with no animations defined, without throwing un-necessary errors

            AnimState prevState = (AnimState)Enum.Parse(typeof(AnimState), persistentState);
            float     time      = prevState == AnimState.STOPPED_START || prevState == AnimState.PLAYING_BACKWARD ? 0 : 1;

            controller = new AnimationController(time, animationMaxDeploy);
            SSTUAnimData animationData;

            len = allNodes.Length;
            for (int i = 0; i < len; i++)
            {
                animationData = new SSTUAnimData(allNodes[i], part.gameObject.transform.FindRecursive("model"));
                controller.addAnimationData(animationData);
            }
            controller.restorePreviousAnimationState(prevState, 1f);
            controller.setStateChangeCallback(onAnimationStateChange);
        }
Exemplo n.º 3
0
        private void initialize()
        {
            ConfigNode node = SSTUStockInterop.getPartModuleConfig(part, this);

            ConfigNode[] animNodes = node.GetNodes("ANIMATION");
            int          len       = animNodes.Length;

            ConfigNode[] allNodes = null;
            if (!String.IsNullOrEmpty(animationName))
            {
                allNodes = new ConfigNode[len + 1];
                for (int i = 0; i < len; i++)
                {
                    allNodes[i] = animNodes[i];
                }
                ConfigNode legacyNode = new ConfigNode("ANIMATION");
                legacyNode.AddValue("name", animationName);
                legacyNode.AddValue("speed", animationSpeed);
                legacyNode.AddValue("layer", animationLayer);
                allNodes[len] = legacyNode;
            }
            else
            {
                allNodes = animNodes;
            }

            controller = new AnimationController();
            SSTUAnimData animationData;

            len = allNodes.Length;
            for (int i = 0; i < len; i++)
            {
                animationData = new SSTUAnimData(allNodes[i], part.gameObject.transform);
                controller.addAnimationData(animationData);
            }
            AnimState prevState = (AnimState)Enum.Parse(typeof(AnimState), persistentState);

            controller.restorePreviousAnimationState(prevState);
            controller.setStateChangeCallback(onAnimationStateChange);
        }
        private void initialize()
        {
            ConfigNode node = SSTUConfigNodeUtils.parseConfigNode(configNodeData);// SSTUStockInterop.getPartModuleConfig(part, this);
            ConfigNode[] animNodes = node.GetNodes("ANIMATION");
            int len = animNodes.Length;
            ConfigNode[] allNodes=null;
            if (!String.IsNullOrEmpty(animationName))
            {
                allNodes = new ConfigNode[len + 1];
                for (int i = 0; i < len; i++) { allNodes[i] = animNodes[i]; }
                ConfigNode legacyNode = new ConfigNode("ANIMATION");
                legacyNode.AddValue("name", animationName);
                legacyNode.AddValue("speed", animationSpeed);
                legacyNode.AddValue("layer", animationLayer);
                allNodes[len] = legacyNode;
            }
            else
            {
                allNodes = animNodes;
            }

            controller = new AnimationController();
            SSTUAnimData animationData;
            len = allNodes.Length;
            for (int i = 0; i < len; i++)
            {
                animationData = new SSTUAnimData(allNodes[i], part.gameObject.transform.FindRecursive("model"));
                controller.addAnimationData(animationData);
            }
            AnimState prevState = (AnimState)Enum.Parse(typeof(AnimState), persistentState);
            controller.restorePreviousAnimationState(prevState);
            controller.setStateChangeCallback(onAnimationStateChange);
        }