public override void RefreshVisibleObject()
{
base.RefreshVisibleObject();
foreach (BaseObject o in mGameMap.GetAllObject().Values)
{
if (o.GetGameID() == this.GetGameID()) continue;
int dis = GameBase.Config.Define.MAX_VISIBLE_DISTANCE;
//已经不在视野范围..清除该对象
if (this.mVisibleList.ContainsKey(o.GetGameID()))
{
if (!GetPoint().CheckVisualDistance(o.GetCurrentX(), o.GetCurrentY(), dis))
{
mVisibleList.Remove(o.GetGameID());
o.GetVisibleList().Remove(this.GetGameID());
//只清除玩家,怪物与npc客户端会自动清除
if (o.type == OBJECTTYPE.PLAYER)
{
// (o as PlayerObject).ClearThis();
this.ClearThis(o as PlayerObject);
(o as PlayerObject).ClearThis(this);
}
}
continue;
}
//新加入的对象
if (this.GetPoint().CheckVisualDistance(o.GetCurrentX(), o.GetCurrentY(), dis))
{
//- 清除并且死亡的怪物对象不加到列表中
if (o.type == OBJECTTYPE.MONSTER)
{
if ((o as MonsterObject).IsClear()) continue;
}
//RefreshObject refobj = new RefreshObject();
//refobj.obj = o;
//refobj.bRefreshTag = false;
//mVisibleList[o.GetGameID()] = refobj;
this.AddVisibleObject(o, false);
}
}
}