示例#1
0
        /// <summary>
        /// Handles when an occupant moves around within a zone.
        /// </summary>
        /// <param name="sender">The sender.</param>
        /// <param name="e">The <see cref="OccupancyChangedEventArgs" /> instance containing the event data.</param>
        private void RoomOccupancyChanged(object sender, OccupancyChangedEventArgs e)
        {
            // If the departure room is not null, then the character is moving from a room.
            if (e.DepartureRoom != null)
            {
                // Check if the old room was within our zone and the new room is not.
                if (this.HasRoom(e.DepartureRoom) && !this.HasRoom(e.ArrivalRoom))
                {
                    this.OnLeftZone(e.Occupant);
                }
                else if (!this.HasRoom(e.DepartureRoom) && this.HasRoom(e.ArrivalRoom))
                {
                    // We have left one zone and entered this Zone.
                    this.OnEnteredZone(e.Occupant);
                }

                // If none of the aboe criteria was met, it indicates that the occupant is moving
                // around within the zone, which so we don't need to push events.
                return;
            }

            // If the departure room is null, then we know that they are entering this zone for the first time.
            if (this.HasRoom(e.ArrivalRoom))
            {
                this.OnEnteredZone(e.Occupant);
            }
        }
示例#2
0
        /// <summary>
        /// Handles when an occupant moves around within a zone.
        /// </summary>
        /// <param name="sender">The sender.</param>
        /// <param name="e">The <see cref="OccupancyChangedEventArgs" /> instance containing the event data.</param>
        private void RoomOccupancyChanged(object sender, OccupancyChangedEventArgs e)
        {
            // If the departure room is not null, then the character is moving from a room.
            if (e.DepartureRoom != null)
            {
                // Check if the old room was within our zone and the new room is not.
                if (this.HasRoom(e.DepartureRoom) && !this.HasRoom(e.ArrivalRoom))
                {
                    this.OnLeftZone(e.Occupant);
                }
                else if (!this.HasRoom(e.DepartureRoom) && this.HasRoom(e.ArrivalRoom))
                {
                    // We have left one zone and entered this Zone.
                    this.OnEnteredZone(e.Occupant);
                }

                // If none of the aboe criteria was met, it indicates that the occupant is moving
                // around within the zone, which so we don't need to push events.
                return;
            }

            // If the departure room is null, then we know that they are entering this zone for the first time.
            if (this.HasRoom(e.ArrivalRoom))
            {
                this.OnEnteredZone(e.Occupant);
            }
        }
示例#3
0
 private void OnCharacterLeftRoom(object sender, OccupancyChangedEventArgs e)
 {
     throw new NotImplementedException();
 }