Beispiel #1
0
        public static ModelNodeData[] load(string[] vals)
        {
            int len = vals.Length;

            ModelNodeData[] data = new ModelNodeData[len];
            for (int i = 0; i < len; i++)
            {
                data[i] = new ModelNodeData(vals[i]);
            }
            return(data);
        }
 public void enableNode(ModelNodeData data, GameObject root)
 {
     if (node == null)
     {
         node = new GameObject("ModelNode-" + name);
     }
     else
     {
         MonoBehaviour.print("ERROR: Attempt to enable an already enabled node, name: " + name + " parent: " + parent);
     }
     currentData = data;
     node.transform.NestToParent(root.transform);
     node.transform.localPosition = data.position;
     node.transform.localRotation = Quaternion.Euler(data.rotation);
     int len = children.Count;
     for (int i = 0; i < len; i++)
     {
         children[i].enableGroup();
     }
 }
Beispiel #3
0
 public ModelSwitchData(ConfigNode node, Part owner, ModelSwitchGroup group)
 {
     name            = node.GetStringValue("name");
     modelName       = node.GetStringValue("modelName", name);
     groupName       = node.GetStringValue("group", groupName);
     containerIndex  = node.GetIntValue("containerIndex", 0);
     localPosition   = node.GetVector3("localPosition", Vector3.zero);
     localRotation   = node.GetVector3("localRotation", Vector3.zero);
     scale           = node.GetFloatValue("scale", scale);
     nodes           = ModelNodeData.load(node.GetStringValues("node"));
     suppressNode    = nodes.Length > 0;
     modelDefinition = SSTUModelData.getModelDefinition(modelName);
     if (modelDefinition == null)
     {
         throw new NullReferenceException("Could not locate model data for name: " + modelName + " :: " + name);
     }
     this.part  = owner;
     this.group = group;
     this.group.add(this);
 }
Beispiel #4
0
        public void enableNode(ModelNodeData data, GameObject root)
        {
            if (node == null)
            {
                node = new GameObject("ModelNode-" + name);
            }
            else
            {
                MonoBehaviour.print("ERROR: Attempt to enable an already enabled node, name: " + name + " parent: " + parent);
            }
            currentData = data;
            node.transform.NestToParent(root.transform);
            node.transform.localPosition = data.position;
            node.transform.localRotation = Quaternion.Euler(data.rotation);
            int len = children.Count;

            for (int i = 0; i < len; i++)
            {
                children[i].enableGroup();
            }
        }
 public static ModelNodeData[] load(string[] vals)
 {
     int len = vals.Length;
     ModelNodeData[] data = new ModelNodeData[len];
     for (int i = 0; i < len; i++)
     {
         data[i] = new ModelNodeData(vals[i]);
     }
     return data;
 }