Ejemplo n.º 1
0
 public MmoPlayerCamera(WorldSession player, MmoZone zone)
     : base(zone, player.Fiber)
 {
     this.receiver = player;
     this.fiber    = player.Fiber;
     this.eventChannelSubscriptions = new Dictionary <MmoObject, IDisposable>();
 }
Ejemplo n.º 2
0
        /// <summary>
        /// Removes a(n) <see cref="MmoZone"/>.
        /// </summary>
        public bool RemoveZone(MmoZone zone)
        {
            MmoZone theZone;

            if (zones.TryGetValue(zone.Id, out theZone))
            {
                // TODO: Recalculate bounds
                // TODO: Disconnect every player from that zone
                if (theZone == zone)
                {
                    zones.Remove(zone.Id);
                    theZone.Dispose();
                    return(true);
                }
            }
            return(false);
        }
Ejemplo n.º 3
0
        /// <summary>
        ///   Initializes a new instance of the <see cref = "InterestArea" /> class.
        /// </summary>
        protected InterestArea(MmoZone world, IFiber fiber)
        {
            this.world                        = world;
            this.snapShotRequest              = new MmoObjectSnapshotRequest(this);
            this.subscribedWorldRegions       = new Dictionary <Region, IDisposable>();
            this.autoManagedItemSubscriptions = new Dictionary <MmoObject, MmoObjectAutoSubscription>();
            this.subscriptionManagementFiber  = fiber;
            //this.subscriptionManagementFiber.Start();

            this.worldArea = world.Bounds;

            // make invalid
            this.currentRegionInnerFocus = new Bounds {
                Max = this.worldArea.Min, Min = this.worldArea.Max
            };
            this.currentRegionOuterFocus = this.currentRegionInnerFocus;
        }
Ejemplo n.º 4
0
        /// <summary>
        /// Creates a new <see cref="MmoZone"/>.
        /// </summary>
        public MmoZone CreateZone(short id, string name, Bounds zoneBounds, Vector3 tileDimentions, ZoneDescription zoneDescription)
        {
            MmoZone existingZone;

            if (zones.TryGetValue(id, out existingZone))
            {
                return(existingZone);
            }

            // locking to update the bounds
            lock (zones)
            {
                this.bounds = this.bounds.Size != Vector3.Zero ? this.bounds.UnionWith(zoneBounds) : zoneBounds;
                var newZone = new MmoZone(this, id, name, zoneBounds, tileDimentions, zoneDescription, configuration);
                zones.Add(id, newZone);
                return(newZone);
            }
        }