示例#1
0
        public void GetNewObjects()
        {
            List <MapObject> TempList = NearbyObjects;

            MapObject Temp;

            for (int I = 0; I < TempList.Count; I++)
            {
                Temp = TempList[I];
                if (OldObjects.Contains(Temp))
                {
                    continue;
                }
                Temp.AddObject(this);
                QueuePacket(Temp.GetMapData());
            }


            for (int I = 0; I < OldObjects.Count; I++)
            {
                Temp = OldObjects[I];
                if (TempList.Contains(Temp))
                {
                    continue;
                }
                Temp.RemoveObject(this);
                QueuePacket(new S.RemoveMapObject {
                    ObjectID = Temp.ObjectID
                });
            }

            OldObjects = TempList;
        }
示例#2
0
        public virtual bool Spawn()
        {
            if (MInfo != null && MInfo.MapIndex != MapIndex)
            {
                CurrentMap.DeSpawn(this);
                MInfo      = null;
                CurrentMap = null;
            }

            if (MInfo == null)
            {
                MInfo      = MirDB.MapInfoList.FirstOrDefault(M => M.MapIndex == MapIndex);
                CurrentMap = Envir.MapList.FirstOrDefault(M => M.MapInfo == MInfo);
            }

            if (CurrentMap == null)
            {
                return(false);
            }

            if (!CurrentMap.Spawn(this))
            {
                return(false);
            }


            List <MapObject> TempList = NearbyObjects;

            MapObject Temp;

            for (int I = 0; I < TempList.Count; I++)
            {
                Temp = TempList[I];
                if (Temp is PlayerObject)
                {
                    OldPlayers.Add((PlayerObject)Temp);
                }
                Temp.AddObject(this);
            }


            return(true);
        }
示例#3
0
        public virtual void MapChanged()
        {
            for (int I = 0; I < OldPlayers.Count; I++)
            {
                OldPlayers[I].RemoveObject(this);
            }

            List <MapObject> TempList = NearbyObjects;

            MapObject Temp;

            for (int I = 0; I < TempList.Count; I++)
            {
                Temp = TempList[I];
                if (Temp is PlayerObject)
                {
                    OldPlayers.Add((PlayerObject)Temp);
                }
                Temp.AddObject(this);
            }
        }