public BuildCost.CostReport getBuildCost(ConfigNode craft) { ShipConstruct ship = new ShipConstruct(); ship.LoadShip(craft); GameObject ro = ship.parts[0].localRoot.gameObject; Vessel dummy = ro.AddComponent <Vessel>(); dummy.Initialize(true); craftResources = new VesselResources(dummy); BuildCost resources = new BuildCost(); foreach (Part p in ship.parts) { resources.addPart(p); } dummy.Die(); return(resources.cost); }
void addPart(Part part) { //Debug.Log (String.Format ("[EL GUI] attach: {0}", part)); buildCost.addPart(part); parts_count++; }