Ejemplo n.º 1
0
        public DetectedUnitInfo GetDetectedUnitInfo()
        {
            DetectedUnitInfo   info   = new DetectedUnitInfo();
            DetectedUnitSensor sensor = null;

            //Debug.Assert(_DetectionSensors != null && _DetectionSensors.Count > 0,
            //    "DetectionSensors should contain at least one entry.");
            if (this._DetectionSensors != null && this._DetectionSensors.Count > 0)
            {
                sensor = this._DetectionSensors[0];                 //provide information from first sensor
                foreach (var DetSensor in _DetectionSensors)
                {
                    info.DetectionSensors.Add(DetSensor.GetDetectedUnitSensorInfo());
                }
            }
            info.Id = Id;
            //info.DetectedUnitDescription = ToLongString();
            info.DetectionClassification = DetectionClassification;
            info.DomainType = DomainType;
            info.FriendOrFoeClassification = FriendOrFoeClassification;
            info.ThreatClassification      = ThreatClassification;
            if (sensor != null)
            {
                info.IsBearingOnly = sensor.IsBearingOnly;
            }
            info.HasLightingOn      = HasLightingOn;
            info.KnownDamagePercent = KnownDamagePercent;
            info.KnownFireLevel     = KnownFireLevel;

            info.IsFixed                 = IsFixed;
            info.IsIdentified            = IsIdentified;
            info.IsKnownToUseActiveRadar = IsKnownToUseActiveRadar;
            info.IsKnownToUseActiveSonar = IsKnownToUseActiveSonar;
            info.IsKnownToBeCivilianUnit = IsKnownToBeCivilianUnit;
            info.Position                = GetPositionInfo();
            info.DetectedGroupId         = DetectedGroupId;
            info.IsFiredUpon             = this.IsFiredUpon;
            info.IsTargetted             = this.IsTargetted;
            if (this.PositionRegion != null)
            {
                info.PositionRegion = this.PositionRegion.GetRegionInfo();
            }
            if (RefersToUnit != null)
            {
                WeatherSystem weather = RefersToUnit.GetWeatherSystem();
                if (weather != null)
                {
                    info.WeatherSystemInfo = weather.GetWeatherSystemInfo();
                }
            }
            if (IsIdentified && RefersToUnit != null)
            {
                info.RefersToUnitName    = RefersToUnit.Name;
                info.RefersToUnitClassId = RefersToUnit.UnitClass.Id;
                if (OwnerPlayer != null)
                {
                    info.OwnerPlayerId   = OwnerPlayer.Id;
                    info.OwnerPlayerName = OwnerPlayer.Name;
                }
            }
            //info.UncertaintyRangeM = UncertaintyRangeM;
            return(info);
        }
Ejemplo n.º 2
0
        public PositionInfo GetPositionInfo()
        {
            PositionInfo pos = this.Position.GetPositionInfo();

            pos.UnitId = this.Id;
            if (RefersToUnit != null)
            {
                if (IsFixed)
                {
                    pos.ActualSpeedKph = (float)this.RefersToUnit.ActualSpeedKph;
                }

                pos.IsAtFormationPosition = RefersToUnit.IsAtFormationPositionFlag || RefersToUnit.IsGroupMainUnit();
            }
            pos.IsDetection = true;
            return(pos);
        }