Example #1
0
        public virtual void Broadcast(Packet p)
        {
            if (p == null || CurrentMap == null)
            {
                return;
            }

            for (int i = CurrentMap.Players.Count - 1; i >= 0; i--)
            {
                PlayerObject player = CurrentMap.Players[i];
                if (player == this || player.Observer)
                {
                    continue;
                }

                if (Functions.InRange(CurrentLocation, player.CurrentLocation, Globals.DataRange))
                {
                    player.Enqueue(p);
                }
            }

            for (int i = CurrentMap.Observers.Count - 1; i >= 0; i--)
            {
                ObserverObject observer = CurrentMap.Observers[i];
                if (observer == this)
                {
                    continue;
                }

                if (Functions.InRange(CurrentLocation, observer.CurrentLocation, Globals.DataRange))
                {
                    observer.Enqueue(p);
                }
            }
        }
Example #2
0
 public virtual void Add(ObserverObject observer)
 {
     observer.Enqueue(GetInfo());
 }
Example #3
0
 public virtual void Remove(ObserverObject observer)
 {
     observer.Enqueue(new S.ObjectRemove {
         ObjectID = ObjectID
     });
 }