コード例 #1
0
ファイル: Item.cs プロジェクト: azanium/PopBloop-GameServer
        /// <summary>
        ///   Requests an <see cref = "ItemSnapshot" />.
        /// </summary>
        /// <param name = "snapShotRequest">
        ///   The snap shot request.
        /// </param>
        internal void EnqueueItemSnapshotRequest(ItemSnapshotRequest snapShotRequest)
        {
            this.fiber.Enqueue(
                () =>
                    {
                        if (this.disposed)
                        {
                            return;
                        }

                        snapShotRequest.OnItemReceive(this);
                    });
        }
コード例 #2
0
        /// <summary>
        ///   Initializes a new instance of the <see cref = "InterestArea" /> class.
        /// </summary>
        /// <param name = "id">
        ///   The id for this interest area. 
        ///   Unique per <see cref = "Actor" />.
        /// </param>
        /// <param name = "world">
        ///   The <see cref = "IWorld" /> this interest area is watching.
        /// </param>
        protected InterestArea(byte id, IWorld world)
        {
            this.id = id;
            this.world = world;
            this.snapShotRequest = new ItemSnapshotRequest(this);
            this.subscribedWorldRegions = new Dictionary<Region, IDisposable>();
            this.autoManagedItemSubscriptions = new Dictionary<Item, ItemAutoSubscription>();
            this.manualManagedItemSubscriptions = new Dictionary<Item, IDisposable>();
            this.subscriptionManagementFiber = new PoolFiber();
            this.subscriptionManagementFiber.Start();

            this.worldArea = world.Area;

            // make invalid
            this.currentRegionInnerFocus = new BoundingBox { Max = this.worldArea.Min, Min = this.worldArea.Max };
            this.currentRegionOuterFocus = this.currentRegionInnerFocus;
        }