public KethaneProtoDetector(ConfigNode node, KethaneVesselScanner scanner) { vesselScanner = scanner; string s; if (node.HasValue("DetectingPeriod")) { s = node.GetValue("DetectingPeriod"); float.TryParse(s, out DetectingPeriod); } if (node.HasValue("DetectingHeight")) { s = node.GetValue("DetectingHeight"); float.TryParse(s, out DetectingHeight); } if (node.HasValue("PowerConsumption")) { s = node.GetValue("PowerConsumption"); float.TryParse(s, out PowerConsumption); } if (node.HasValue("IsDetecting")) { s = node.GetValue("IsDetecting"); bool val; bool.TryParse(s, out val); IsDetecting = val; } if (node.HasValue("TimerEcho")) { s = node.GetValue("TimerEcho"); double.TryParse(s, out TimerEcho); } resources = node.GetNodes("Resource").Select(n => n.GetValue("Name")).ToList(); }
public KethaneProtoDetector(KethaneDetector det, KethaneVesselScanner scanner) { vesselScanner = scanner; DetectingPeriod = det.DetectingPeriod; DetectingHeight = det.DetectingHeight; PowerConsumption = det.PowerConsumption; resources = det.resources; IsDetecting = det.IsDetecting; TimerEcho = 0; }