Exemplo n.º 1
0
        private void loadConfigData(ConfigNode node)
        {
            ConfigNode[] emissiveNodes = node.GetNodes("EMISSIVE");
            ConfigNode[] lightNodes    = node.GetNodes("LIGHT");
            emissiveRenderers.Clear();
            Renderer render;

            foreach (ConfigNode enode in emissiveNodes)
            {
                Transform[] trs1 = part.transform.FindChildren(enode.GetStringValue("name"));
                foreach (Transform tr in trs1)
                {
                    render = tr.GetComponent <Renderer>();
                    if (render != null)
                    {
                        emissiveRenderers.Add(render);
                    }
                }
            }
            lightTransforms = new LightData[lightNodes.Length];
            for (int i = 0; i < lightNodes.Length; i++)
            {
                lightTransforms[i] = new LightData(lightNodes[i], part);
            }
            state = (LightAnimationState)Enum.Parse(typeof(LightAnimationState), statePersistence);
        }
Exemplo n.º 2
0
        private void loadConfigData(ConfigNode node)
        {
            //should only run the first time the part-module is initialized,
            // which had better be on the prefab part (or bad things will happen)
            // only tracked so as to not add duplicate animations/clips
            if (!prefabSetup)
            {
                prefabSetup = true;
                Transform root = part.transform.FindRecursive("model");

                ConfigNode[]   emissiveNodes = node.GetNodes("EMISSIVE");
                int            len           = emissiveNodes.Length;
                EmissiveData[] emissiveDatas = new EmissiveData[len];
                for (int i = 0; i < len; i++)
                {
                    emissiveDatas[i] = new EmissiveData(emissiveNodes[i]);
                    emissiveDatas[i].createAnimationClips(root);
                }

                ConfigNode[] lightNodes = node.GetNodes("LIGHT");
                len = lightNodes.Length;
                LightData[] lightDatas = new LightData[lightNodes.Length];
                for (int i = 0; i < len; i++)
                {
                    lightDatas[i] = new LightData(lightNodes[i]);
                    lightDatas[i].createAnimationClips(root);
                }
            }

            //will not function without animation data being loaded/present
            // the EMISSIVE and LIGHT blocks -build- new animations that can be
            // referenced inside of the ANIMATION data blocks
            AnimationData animData = new AnimationData(node.GetNode("ANIMATIONDATA"));

            //setup animation control module.  limit/deploy/retract events passed as null, as UI visibility/updating handled externally to ensure syncing to light animation state
            animationController = new AnimationModule(part, this, nameof(animationPersistentData), null, nameof(enableLightsEvent), nameof(disableLightsEvent));
            animationController.getSymmetryModule = m => ((SSTUAnimateLight)m).animationController;
            animationController.setupAnimations(animData, part.transform.FindRecursive("model"), animationLayer);
        }
Exemplo n.º 3
0
 private void loadConfigData(ConfigNode node)
 {
     ConfigNode[] emissiveNodes = node.GetNodes("EMISSIVE");
     ConfigNode[] lightNodes = node.GetNodes("LIGHT");
     emissiveRenderers.Clear();
     Renderer render;
     foreach(ConfigNode enode in emissiveNodes)
     {
         Transform[] trs1 = part.transform.FindChildren(enode.GetStringValue("name"));
         foreach (Transform tr in trs1)
         {
             render = tr.GetComponent<Renderer>();
             if (render != null)
             {
                 emissiveRenderers.Add(render);
             }
         }
     }
     lightTransforms = new LightData[lightNodes.Length];
     for (int i = 0; i < lightNodes.Length; i++)
     {
         lightTransforms[i] = new LightData(lightNodes[i], part);
     }
     state = (LightAnimationState)Enum.Parse(typeof(LightAnimationState), statePersistence);
 }
Exemplo n.º 4
0
 protected override void loadConfigData(ConfigNode node)
 {
     ConfigNode[] emissiveNodes = node.GetNodes("EMISSIVE");
     ConfigNode[] lightNodes = node.GetNodes("LIGHT");
     List<Transform> trs = new List<Transform>();
     foreach(ConfigNode enode in emissiveNodes)
     {
         Transform[] trs1 = part.transform.FindChildren(enode.GetStringValue("name"));
         foreach (Transform tr in trs1) { trs.Add(tr); }
     }
     emissiveMeshes = trs.ToArray();
     trs.Clear();
     lightTransforms = new LightData[lightNodes.Length];
     for (int i = 0; i < lightNodes.Length; i++)
     {
         lightTransforms[i] = new LightData(lightNodes[i], part);
     }            
     state = (LightAnimationState)Enum.Parse(typeof(LightAnimationState), statePersistence);
 }