public void SensorsUpdate(SubsystemReferences subsysRef, ShipSensors Data) { detectedFarObjects = new List <DetectedFarObject>(); detectedCloseObjects = new List <DetectedCloseObject>(); foreach (GWI_Detection detection in Data.GWInterferometer) { DetectedFarObject obj = new DetectedFarObject(); obj.type = detection.signature; obj.position = AngleToPosition(subsysRef.currentShipPositionWithinGalaxyMapNode, detection.angle, ShipSensors.GConstant / detection.waveAmplitude, true); obj.destinationName = detection.warpGateDestination; detectedFarObjects.Add(obj); } foreach (EMS_Detection detection in Data.EMSensor) { DetectedCloseObject obj = new DetectedCloseObject(); obj.velocity = detection.velocity; obj.radius = detection.radius; obj.position = AngleToPosition(subsysRef.currentShipPositionWithinGalaxyMapNode, detection.angle, ShipSensors.EMConstant / detection.signalStrength, false); obj.materialSignature = detection.materialSignature; foreach (SpaceMaterial material in Enum.GetValues(typeof(SpaceMaterial))) { if (Data.CheckSignatureForSpaceMaterial(detection.materialSignature, material)) { obj.materials.Add(material); } } detectedCloseObjects.Add(obj); } }
Vector2 getAimTo(DetectedCloseObject obj, Vector2 ship) { return(obj.position + obj.velocity * (obj.position - ship).magnitude / Ship.missileSpeed - ship); }
bool shouldShot(DetectedCloseObject obj) { return(obj.materials.Count != 0 && !obj.materials.Contains(SpaceMaterial.Fisable)); }