Esempio n. 1
0
        public void AddSingle(IRaderOwner raderOwner)
        {
            ObjMemoryKeeper memory = new ObjMemoryKeeper();

            groups.Add(new Group(new IRaderOwner[] { raderOwner }, memory));
            raderOwner.Rader.ObjMemoryKeeper = memory;
        }
Esempio n. 2
0
        //[Obsolete]
        //private static void CheckVisible ( BinGroup group, IRaderOwner raderOwner )
        //{
        //    List<IEyeableInfo> inRaderObjInfos = new List<IEyeableInfo>();

        //    //List<IHasBorderObj> inRaderHasBorderNonShelterObjs = new List<IHasBorderObj>();

        //    List<EyeableBorderObjInfo> EyeableBorderObjs = new List<EyeableBorderObjInfo>();

        //    foreach (KeyValuePair<IEyeableObj, GetEyeableInfoHandler> set in group.eyeableSets)
        //    {
        //        if (raderOwner == set.Key)
        //            continue;

        //        // 检查是否为当前雷达的遮挡物体

        //        bool isShelter = false;
        //        foreach (ObjVisiBorder objBorder in raderOwner.Rader.ShelterVisiBorders)
        //        {
        //            if (objBorder.Obj == set.Key)
        //            {
        //                IEyeableInfo eyeableInfo = set.Value( raderOwner, set.Key );
        //                inRaderObjInfos.Add( eyeableInfo );

        //                EyeableBorderObjs.Add( new EyeableBorderObjInfo( eyeableInfo, objBorder ) );

        //                isShelter = true;
        //                break;
        //            }
        //        }

        //        // 检查非遮挡物体是否可见
        //        if (!isShelter)
        //        {
        //            foreach (Vector2 keyPoint in set.Key.KeyPoints)
        //            {
        //                if (raderOwner.Rader.PointInRader( Vector2.Transform( keyPoint, set.Key.TransMatrix ) ))
        //                {
        //                    IEyeableInfo eyeableInfo = set.Value( raderOwner, set.Key );
        //                    inRaderObjInfos.Add( eyeableInfo );

        //                    if (set.Key is IHasBorderObj)
        //                    {
        //                        ObjVisiBorder border = CalNonShelterVisiBorder( (IHasBorderObj)set.Key, raderOwner.Rader );
        //                        if (border != null)
        //                            EyeableBorderObjs.Add( new EyeableBorderObjInfo( eyeableInfo, border ) );
        //                    }
        //                    break;
        //                }
        //            }
        //        }
        //    }

        //    raderOwner.Rader.CurEyeableObjs = inRaderObjInfos;
        //    raderOwner.Rader.EyeableBorderObjInfos = EyeableBorderObjs.ToArray();
        //}

        /*
         * 将作为CheckVisible的替代,尚未测试。
         * */
        private static void CheckVisible(BinGroup group, IRaderOwner raderOwner)
        {
            List <IEyeableInfo> inRaderObjInfos = new List <IEyeableInfo>();

            List <EyeableBorderObjInfo> EyeableBorderObjs = new List <EyeableBorderObjInfo>();

            foreach (IEnumerable <IEyeableObj> eyeGroup in group.eyeableObjs)
            {
                foreach (IEyeableObj obj in eyeGroup)
                {
                    if (raderOwner == obj)
                    {
                        continue;
                    }

                    // 检查是否为当前雷达的遮挡物体

                    bool isShelter = false;
                    foreach (ObjVisiBorder objBorder in raderOwner.Rader.ShelterVisiBorders)
                    {
                        if (objBorder.Obj == obj)
                        {
                            IEyeableInfo eyeableInfo = obj.GetEyeableInfoHandler(raderOwner, obj);
                            inRaderObjInfos.Add(eyeableInfo);

                            EyeableBorderObjs.Add(new EyeableBorderObjInfo(eyeableInfo, objBorder));

                            isShelter = true;
                            break;
                        }
                    }

                    // 检查非遮挡物体是否可见
                    if (!isShelter)
                    {
                        foreach (Vector2 keyPoint in obj.KeyPoints)
                        {
                            if (raderOwner.Rader.PointInRader(Vector2.Transform(keyPoint, obj.TransMatrix)))
                            {
                                IEyeableInfo eyeableInfo = obj.GetEyeableInfoHandler(raderOwner, obj);
                                inRaderObjInfos.Add(eyeableInfo);

                                if (obj is IHasBorderObj)
                                {
                                    ObjVisiBorder border = CalNonShelterVisiBorder((IHasBorderObj)obj, raderOwner.Rader);
                                    if (border != null)
                                    {
                                        EyeableBorderObjs.Add(new EyeableBorderObjInfo(eyeableInfo, border));
                                    }
                                }
                                break;
                            }
                        }
                    }
                }
            }

            raderOwner.Rader.CurEyeableObjs        = inRaderObjInfos;
            raderOwner.Rader.EyeableBorderObjInfos = EyeableBorderObjs.ToArray();
        }
Esempio n. 3
0
 public void AddGroup ( IRaderOwner[] raderOwners )
 {
     ObjMemoryKeeper memory = new ObjMemoryKeeper();
     groups.Add( new Group( raderOwners, memory ) );
     foreach (IRaderOwner raderOwner in raderOwners)
     {
         raderOwner.Rader.ObjMemoryKeeper = memory;
     }
 }
Esempio n. 4
0
 static public IEyeableInfo GetCommonEyeInfoFun(IRaderOwner raderOwner, IEyeableObj tank)
 {
     return(new TankCommonEyeableInfo((TankSinTur)tank));
 }
Esempio n. 5
0
        //[Obsolete]
        //private static void CheckVisible ( BinGroup group, IRaderOwner raderOwner )
        //{
        //    List<IEyeableInfo> inRaderObjInfos = new List<IEyeableInfo>();

        //    //List<IHasBorderObj> inRaderHasBorderNonShelterObjs = new List<IHasBorderObj>();

        //    List<EyeableBorderObjInfo> EyeableBorderObjs = new List<EyeableBorderObjInfo>();

        //    foreach (KeyValuePair<IEyeableObj, GetEyeableInfoHandler> set in group.eyeableSets)
        //    {
        //        if (raderOwner == set.Key)
        //            continue;

        //        // 检查是否为当前雷达的遮挡物体

        //        bool isShelter = false;
        //        foreach (ObjVisiBorder objBorder in raderOwner.Rader.ShelterVisiBorders)
        //        {
        //            if (objBorder.Obj == set.Key)
        //            {
        //                IEyeableInfo eyeableInfo = set.Value( raderOwner, set.Key );
        //                inRaderObjInfos.Add( eyeableInfo );

        //                EyeableBorderObjs.Add( new EyeableBorderObjInfo( eyeableInfo, objBorder ) );

        //                isShelter = true;
        //                break;
        //            }
        //        }

        //        // 检查非遮挡物体是否可见
        //        if (!isShelter)
        //        {
        //            foreach (Vector2 keyPoint in set.Key.KeyPoints)
        //            {
        //                if (raderOwner.Rader.PointInRader( Vector2.Transform( keyPoint, set.Key.TransMatrix ) ))
        //                {
        //                    IEyeableInfo eyeableInfo = set.Value( raderOwner, set.Key );
        //                    inRaderObjInfos.Add( eyeableInfo );

        //                    if (set.Key is IHasBorderObj)
        //                    {
        //                        ObjVisiBorder border = CalNonShelterVisiBorder( (IHasBorderObj)set.Key, raderOwner.Rader );
        //                        if (border != null)
        //                            EyeableBorderObjs.Add( new EyeableBorderObjInfo( eyeableInfo, border ) );
        //                    }
        //                    break;
        //                }
        //            }
        //        }
        //    }

        //    raderOwner.Rader.CurEyeableObjs = inRaderObjInfos;
        //    raderOwner.Rader.EyeableBorderObjInfos = EyeableBorderObjs.ToArray();
        //}

        /*
         * 将作为CheckVisible的替代,尚未测试。
         * */
        private static void CheckVisible( BinGroup group, IRaderOwner raderOwner )
        {
            List<IEyeableInfo> inRaderObjInfos = new List<IEyeableInfo>();

            List<EyeableBorderObjInfo> EyeableBorderObjs = new List<EyeableBorderObjInfo>();

            foreach (IEnumerable<IEyeableObj> eyeGroup in group.eyeableObjs)
            {
                foreach (IEyeableObj obj in eyeGroup)
                {
                    if (raderOwner == obj)
                        continue;

                    // 检查是否为当前雷达的遮挡物体

                    bool isShelter = false;
                    foreach (ObjVisiBorder objBorder in raderOwner.Rader.ShelterVisiBorders)
                    {
                        if (objBorder.Obj == obj)
                        {
                            IEyeableInfo eyeableInfo = obj.GetEyeableInfoHandler( raderOwner, obj );
                            inRaderObjInfos.Add( eyeableInfo );

                            EyeableBorderObjs.Add( new EyeableBorderObjInfo( eyeableInfo, objBorder ) );

                            isShelter = true;
                            break;
                        }
                    }

                    // 检查非遮挡物体是否可见
                    if (!isShelter)
                    {
                        foreach (Vector2 keyPoint in obj.KeyPoints)
                        {
                            if (raderOwner.Rader.PointInRader( Vector2.Transform( keyPoint, obj.TransMatrix ) ))
                            {
                                IEyeableInfo eyeableInfo = obj.GetEyeableInfoHandler( raderOwner, obj );
                                inRaderObjInfos.Add( eyeableInfo );

                                if (obj is IHasBorderObj)
                                {
                                    ObjVisiBorder border = CalNonShelterVisiBorder( (IHasBorderObj)obj, raderOwner.Rader );
                                    if (border != null)
                                        EyeableBorderObjs.Add( new EyeableBorderObjInfo( eyeableInfo, border ) );
                                }
                                break;
                            }
                        }
                    }
                }
            }

            raderOwner.Rader.CurEyeableObjs = inRaderObjInfos;
            raderOwner.Rader.EyeableBorderObjInfos = EyeableBorderObjs.ToArray();
        }
Esempio n. 6
0
 public void AddSingle ( IRaderOwner raderOwner )
 {
     ObjMemoryKeeper memory = new ObjMemoryKeeper();
     groups.Add( new Group( new IRaderOwner[] { raderOwner }, memory ) );
     raderOwner.Rader.ObjMemoryKeeper = memory;
 }
Esempio n. 7
0
 public Group ( IRaderOwner[] raderOwners, ObjMemoryKeeper memory )
 {
     this.raderOwners = raderOwners;
     this.memory = memory;
 }
Esempio n. 8
0
 static public IEyeableInfo GetCommonEyeInfoFun(IRaderOwner raderOwner, IEyeableObj tank)
 {
     return new TankCommonEyeableInfo((TankSinTur)tank);
 }
Esempio n. 9
0
 static public IEyeableInfo GetEyeableInfoHandler ( IRaderOwner raderOwner, IEyeableObj obj )
 {
     return new EyeableInfo( obj );
 }
Esempio n. 10
0
 static public IEyeableInfo GetEyeableInfoHandler(IRaderOwner raderOwner, IEyeableObj obj)
 {
     return(new EyeableInfo(obj));
 }
Esempio n. 11
0
 IEyeableInfo GetItemInfo(IRaderOwner raderOwner, IEyeableObj item)
 {
     return((IEyeableInfo)(new ItemEyeableInfo((ItemCommon)item)));
 }
Esempio n. 12
0
 IEyeableInfo GetItemInfo( IRaderOwner raderOwner, IEyeableObj item )
 {
     return (IEyeableInfo)(new ItemEyeableInfo( (ItemCommon)item ));
 }