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); }
public void reInitialize() { if (controller != null) { controller.clearAnimationData(); controller = null; initialize(); } }