コード例 #1
0
        /// <summary>
        /// The on item subscribed.
        /// </summary>
        /// <param name="snapshot">
        /// The item snapshot.
        /// </param>
        protected override void OnItemSubscribed(ItemSnapshot snapshot)
        {
            base.OnItemSubscribed(snapshot);

            Item item = snapshot.Source;
            log.InfoFormat("Npc {2}: I see item {0}({1})", item.Id, (ItemType)item.Type, this.npcId);
        }
コード例 #2
0
        /// <summary>
        /// Notifies peer about Item entered area.
        /// </summary>
        public override void OnItemEnter(ItemSnapshot snapshot)
        {
            base.OnItemEnter(snapshot);
            var item = snapshot.Source;

            GlobalVars.log.InfoFormat("OnItemEnter: " + item.Id + "disposed" + item.Disposed);

            // temp fix for projectiles that get destroyed but are still tied to on RequestItemEnterChannel
            // of certain regions
            // an alternative to this hack would be to never subsribe projectiles to RequestItemEnterChannel, which
            // would be faster but would mean a projectile created in a foreign interest area could not hit you...

            if (item.Disposed)
            {
                return;
            }
            var subscribeEvent = new ItemSubscribed
            {
                ItemId             = item.Id,
                ItemType           = item.Type,
                Position           = snapshot.Position,
                PropertiesRevision = snapshot.PropertiesRevision,
                InterestAreaId     = this.Id,
                Rotation           = snapshot.Rotation
            };

            var eventData = new EventData((byte)EventCode.ItemSubscribed, subscribeEvent);

            this.peer.SendEvent(eventData, new SendParameters {
                ChannelId = Settings.ItemEventChannel
            });
        }
コード例 #3
0
        /// <summary>
        /// The on item subscribed.
        /// </summary>
        /// <param name="snapshot">
        /// The item snapshot.
        /// </param>
        protected override void OnItemSubscribed(ItemSnapshot snapshot)
        {
            base.OnItemSubscribed(snapshot);

            Item item = snapshot.Source;

            log.InfoFormat("Npc {2}: I see item {0}({1})", item.Id, (ItemType)item.Type, this.npcId);
        }
コード例 #4
0
        /// <summary>
        /// Notifies peer about Item entered area.
        /// </summary>
        public override void OnItemEnter(ItemSnapshot snapshot)
        {
            base.OnItemEnter(snapshot);
            var item = snapshot.Source;
            var subscribeEvent = new ItemSubscribed
            {
                ItemId = item.Id,
                ItemType = item.Type,
                Position = snapshot.Position,
                PropertiesRevision = snapshot.PropertiesRevision,
                InterestAreaId = this.Id,
                Rotation = snapshot.Rotation
            };

            var eventData = new EventData((byte)EventCode.ItemSubscribed, subscribeEvent);
            this.peer.SendEvent(eventData, new SendParameters { ChannelId = Settings.ItemEventChannel });
        }
コード例 #5
0
        /// <summary>
        /// Notifies peer about Item entered area.
        /// </summary>
        public override void OnItemEnter(ItemSnapshot snapshot)
        {
            base.OnItemEnter(snapshot);
            var item           = snapshot.Source;
            var subscribeEvent = new ItemSubscribed
            {
                ItemId             = item.Id,
                ItemType           = item.Type,
                Position           = snapshot.Position,
                PropertiesRevision = snapshot.PropertiesRevision,
                InterestAreaId     = this.Id,
                Rotation           = snapshot.Rotation
            };

            var eventData = new EventData((byte)EventCode.ItemSubscribed, subscribeEvent);

            this.peer.SendEvent(eventData, new SendParameters {
                ChannelId = Settings.ItemEventChannel
            });
        }
コード例 #6
0
ファイル: InterestArea.cs プロジェクト: geosohal/Mmo
 /// <summary>
 /// Item enters area
 /// </summary>
 public virtual void OnItemEnter(ItemSnapshot snapshot)
 {
 }
コード例 #7
0
ファイル: Region.cs プロジェクト: JerryBian/PhotonSample
 public ItemRegionChangedMessage(Region r0, Region r1, ItemSnapshot snaphot)
 {
     this.Region0 = r0;
     this.Region1 = r1;
     this.ItemSnapshot = snaphot;
 }
コード例 #8
0
 public ItemRegionChangedMessage(Region r0, Region r1, ItemSnapshot snaphot)
 {
     this.Region0      = r0;
     this.Region1      = r1;
     this.ItemSnapshot = snaphot;
 }