//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 ROLFairingContainer(root, cylinderSides, numOfSections, wallThickness); uvMapName = node.ROLGetStringValue("uvMap", uvMapName); UVMap uvMap = UVMap.GetUVMapGlobal(uvMapName); fairingBase.outsideUV = uvMap.getArea("outside"); fairingBase.insideUV = uvMap.getArea("inside"); fairingBase.edgesUV = uvMap.getArea("edges"); rotationOffset = node.ROLGetVector3("rotationOffset", Vector3.zero); topY = node.ROLGetFloatValue("topY", topY); bottomY = node.ROLGetFloatValue("bottomY", bottomY); capSize = node.ROLGetFloatValue("capSize", capSize); wallThickness = node.ROLGetFloatValue("wallThickness", wallThickness); maxPanelHeight = node.ROLGetFloatValue("maxPanelHeight", maxPanelHeight); cylinderSides = node.ROLGetIntValue("cylinderSides", cylinderSides); numOfSections = node.ROLGetIntValue("numOfSections", numOfSections); topRadius = node.ROLGetFloatValue("topRadius", topRadius); bottomRadius = node.ROLGetFloatValue("bottomRadius", bottomRadius); canAdjustTop = node.ROLGetBoolValue("canAdjustTop", canAdjustTop); canAdjustBottom = node.ROLGetBoolValue("canAdjustBottom", canAdjustBottom); removeMass = node.ROLGetBoolValue("removeMass", removeMass); fairingJettisonMass = node.ROLGetFloatValue("fairingJettisonMass", fairingJettisonMass); jettisonForce = node.ROLGetFloatValue("jettisonForce", jettisonForce); jettisonDirection = node.ROLGetVector3("jettisonDirection", jettisonDirection); fairingName = node.ROLGetStringValue("name", fairingName); enabled = false; }
public static UVMap GetUVMapGlobal(string name) { if (String.IsNullOrEmpty(name)) { return(null); } ConfigNode[] uvMapNodes = GameDatabase.Instance.GetConfigNodes("ROL_UVMAP"); ConfigNode uvMapNode = Array.Find(uvMapNodes, m => m.ROLGetStringValue("name") == name); UVMap map = null; if (uvMapNode != null) { map = new UVMap(uvMapNode); } return(map); }