Wrapper class for the data to manage a single animation, including animation speed and layers, and min/max time handling (default to 0-1 normalized time)
예제 #1
0
        public SSTUAnimData[] getAnimationData(Transform transform, int startLayer)
        {
            ModelAnimationData[] mData = modelDefinition.animationData;
            int len = mData.Length;

            SSTUAnimData[] data = new SSTUAnimData[len];
            for (int i = 0; i < len; i++, startLayer++)
            {
                data[0] = new SSTUAnimData(mData[i].animationName, mData[i].speed, startLayer, transform);
            }
            return(data);
        }
예제 #2
0
        public SSTUAnimData[] getAnimationData(Transform transform)
        {
            SSTUAnimData[] data  = null;
            ConfigNode[]   nodes = modelDefinition.configNode.GetNodes("ANIMATION");
            int            len   = nodes.Length;

            data = new SSTUAnimData[len];
            for (int i = 0; i < len; i++)
            {
                data[i] = new SSTUAnimData(nodes[i], transform);
            }
            return(data);
        }
예제 #3
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);
        }
예제 #4
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);
        }
예제 #5
0
 public void addAnimationData(SSTUAnimData data)
 {
     animationData.Add(data);
 }
예제 #6
0
 public void addAnimationData(SSTUAnimData data)
 {
     animationData.Add(data);
 }
        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);
        }