public void AddSingle(IRaderOwner raderOwner) { ObjMemoryKeeper memory = new ObjMemoryKeeper(); groups.Add(new Group(new IRaderOwner[] { raderOwner }, memory)); raderOwner.Rader.ObjMemoryKeeper = memory; }
//[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(); }
public void AddGroup ( IRaderOwner[] raderOwners ) { ObjMemoryKeeper memory = new ObjMemoryKeeper(); groups.Add( new Group( raderOwners, memory ) ); foreach (IRaderOwner raderOwner in raderOwners) { raderOwner.Rader.ObjMemoryKeeper = memory; } }
static public IEyeableInfo GetCommonEyeInfoFun(IRaderOwner raderOwner, IEyeableObj tank) { return(new TankCommonEyeableInfo((TankSinTur)tank)); }
//[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(); }
public void AddSingle ( IRaderOwner raderOwner ) { ObjMemoryKeeper memory = new ObjMemoryKeeper(); groups.Add( new Group( new IRaderOwner[] { raderOwner }, memory ) ); raderOwner.Rader.ObjMemoryKeeper = memory; }
public Group ( IRaderOwner[] raderOwners, ObjMemoryKeeper memory ) { this.raderOwners = raderOwners; this.memory = memory; }
static public IEyeableInfo GetCommonEyeInfoFun(IRaderOwner raderOwner, IEyeableObj tank) { return new TankCommonEyeableInfo((TankSinTur)tank); }
static public IEyeableInfo GetEyeableInfoHandler ( IRaderOwner raderOwner, IEyeableObj obj ) { return new EyeableInfo( obj ); }
static public IEyeableInfo GetEyeableInfoHandler(IRaderOwner raderOwner, IEyeableObj obj) { return(new EyeableInfo(obj)); }
IEyeableInfo GetItemInfo(IRaderOwner raderOwner, IEyeableObj item) { return((IEyeableInfo)(new ItemEyeableInfo((ItemCommon)item))); }
IEyeableInfo GetItemInfo( IRaderOwner raderOwner, IEyeableObj item ) { return (IEyeableInfo)(new ItemEyeableInfo( (ItemCommon)item )); }