//to be called on initial prefab part load; populate the instance with the default values from the input node public virtual void load(ConfigNode node, GameObject root) { fairingBase = new ROTFairingContainer(root, cylinderSides, numOfSections, wallThickness); uvMapName = node.GetStringValue("uvMap", uvMapName); UVMap uvMap = UVMap.GetUVMapGlobal(uvMapName); fairingBase.outsideUV = uvMap.getArea("outside"); fairingBase.insideUV = uvMap.getArea("inside"); fairingBase.edgesUV = uvMap.getArea("edges"); rotationOffset = node.GetVector3("rotationOffset", Vector3.zero); topY = node.GetFloatValue("topY", topY); bottomY = node.GetFloatValue("bottomY", bottomY); capSize = node.GetFloatValue("capSize", capSize); wallThickness = node.GetFloatValue("wallThickness", wallThickness); maxPanelHeight = node.GetFloatValue("maxPanelHeight", maxPanelHeight); cylinderSides = node.GetIntValue("cylinderSides", cylinderSides); numOfSections = node.GetIntValue("numOfSections", numOfSections); topRadius = node.GetFloatValue("topRadius", topRadius); bottomRadius = node.GetFloatValue("bottomRadius", bottomRadius); canAdjustTop = node.GetBoolValue("canAdjustTop", canAdjustTop); canAdjustBottom = node.GetBoolValue("canAdjustBottom", canAdjustBottom); removeMass = node.GetBoolValue("removeMass", removeMass); fairingJettisonMass = node.GetFloatValue("fairingJettisonMass", fairingJettisonMass); jettisonForce = node.GetFloatValue("jettisonForce", jettisonForce); jettisonDirection = node.GetVector3("jettisonDirection", jettisonDirection); fairingName = node.GetStringValue("name", fairingName); enabled = false; }
public static UVMap GetUVMapGlobal(string name) { if (String.IsNullOrEmpty(name)) { return(null); } ConfigNode[] uvMapNodes = GameDatabase.Instance.GetConfigNodes("ROT_UVMAP"); ConfigNode uvMapNode = Array.Find(uvMapNodes, m => m.GetStringValue("name") == name); UVMap map = null; if (uvMapNode != null) { map = new UVMap(uvMapNode); } return(map); }