public RedUnitInfo(Belief_Actor ba, List <GameObject> redUnits, List <GameObject> redBases, List <GameObject> protectedSites) { // Get ID id = ba.getUnique_id(); // Extract 6 state (in Unity space) pos = new Vector3( ba.getPos_x() * SimControl.KmToUnity, ba.getPos_y() * SimControl.KmToUnity, ba.getPos_z() * SimControl.KmToUnity); vel = new Vector3( ba.getVelocity_x() * SimControl.KmToUnity, ba.getVelocity_y() * SimControl.KmToUnity, ba.getVelocity_z() * SimControl.KmToUnity); velIsValid = ba.getVelocity_x_valid() && ba.getVelocity_y_valid() && ba.getVelocity_z_valid(); // Not a pursue candidate by default isCatchable = false; // Compute distances computeProximityToProtectedSites(protectedSites); computeProximityToRedBases(redBases); // Look up Unity specific properties foreach (GameObject g in redUnits) { // Find the corresponding game object if (g.GetComponent <SoaActor>().unique_id == id) { // Save hasCivilian switch (g.tag) { case "RedDismount": case "RedTruck": hasCivilian = g.GetComponent <SoaActor>().numCiviliansStored > 0; break; default: // Unrecognized Debug.LogError("RedUnitInfo(): Unrecognized g.tag " + g.tag); break; } // Save max speed (in Unity coordinates) maxSpeed = g.GetComponent <NavMeshAgent>().speed; } } }