AddVisibleObject() public method

public AddVisibleObject ( BaseObject obj, bool bRefreshTag = true ) : void
obj BaseObject
bRefreshTag bool
return void
Esempio n. 1
0
        public void SendMonsterInfo(BaseObject obj)
        {
            if (this.GetGameSession() == null) return;

            NetMsg.MsgMonsterInfo info = new NetMsg.MsgMonsterInfo();
            info.Create(null, GetGamePackKeyEx());
            MonsterObject o = obj as MonsterObject;
            info.id = o.GetTypeId();
            info.typeid = o.GetBasicAttribute().id;
            info.lookface = o.GetBasicAttribute().lookface;
            info.x = o.GetCurrentX();
            info.y = o.GetCurrentY();
            info.level = o.GetBasicAttribute().level;
            info.maxhp = o.GetAttribute().life_max;
            info.hp = o.GetAttribute().life;
            info.dir = o.GetDir();

            if (obj.GetType().FullName == "MapServer.AnShaXieLongObject")
            {
                info.param = (int)(obj as AnShaXieLongObject).mPlay.GetTypeId();
            }
            this.SendData(info.GetBuffer());

            //加到怪物可视列表
            if (!obj.GetVisibleList().ContainsKey(this.GetGameID()))
            {
                //RefreshObject refobj = new RefreshObject();
                //refobj.obj = this;
                //obj.GetVisibleList()[this.GetGameID()] = refobj;
                obj.AddVisibleObject(this, false);
            }
            //自己的可视列表 //人物不走动的情况下,怪物进入了视野范围
            if (!this.GetVisibleList().ContainsKey(obj.GetGameID()))
            {
                //RefreshObject refobj = new RefreshObject();
                //refobj.bRefreshTag = true;
                //refobj.obj = obj;
                //this.GetVisibleList()[this.GetGameID()] = refobj;
                this.AddVisibleObject(obj, true);
            }
        }