/// <summary> /// Subscrives entered region. /// </summary> protected override void OnRegionEnter(Region region) { base.OnRegionEnter(region); // subscribibg to events relayed by region from it's items IDisposable messageReceiver = region.ItemEventChannel.Subscribe(this.peer.RequestFiber, this.Region_OnItemEvent); this.eventChannelSubscriptions[region] = messageReceiver; }
/// <summary> /// Override to include the <see cref = "Coordinate" /> for the <see cref = "MmoRadar" />. /// </summary> /// <param name = "position"> /// The position. /// </param> /// <param name = "region"> /// The region. /// </param> /// <returns> /// An instance of <see cref = "MmoItemPositionUpdate" />. /// </returns> protected override ItemPositionMessage GetPositionUpdateMessage(Vector position, Region region) { return new MmoItemPositionUpdate(this, position, region, this.Coordinate); }
/// <summary> /// Override to include the float[] coordinate for the <see cref="MmoRadar"/>. /// </summary> /// <param name="position"> /// The position. /// </param> /// <param name="region"> /// The region. /// </param> /// <returns> /// An instance of <see cref="MmoItemPositionUpdate"/>. /// </returns> protected override ItemPositionMessage GetPositionUpdateMessage(Vector position, Region region) { return new MmoItemPositionUpdate(this, position, region, this.Position.ToFloatArray()); }
/// <summary> /// Override to include the rotation and float[] coordinate on item subscribe. /// </summary> /// <param name="position"> /// The position. /// </param> /// <param name="region"> /// The region. /// </param> /// <returns> /// An instance of <see cref="MmoItemSnapshot"/>. /// </returns> protected override ItemSnapshot GetItemSnapshot(Vector position, Region region) { return new MmoItemSnapshot(this, position, region, this.PropertiesRevision, null, this.Position.ToFloatArray()); }
public ItemRegionChangedMessage(Region r0, Region r1, ItemSnapshot snaphot) { this.Region0 = r0; this.Region1 = r1; this.ItemSnapshot = snaphot; }
public ItemSnapshot(Item source, Vector position, Vector rotation, Region worldRegion, int propertiesRevision) { this.Source = source; this.Position = position; this.Rotation = rotation; this.PropertiesRevision = propertiesRevision; }
/// <summary> /// Unsubscribe exited region. /// </summary> protected override void OnRegionExit(Region region) { base.OnRegionExit(region); IDisposable messageReceiver = this.eventChannelSubscriptions[region]; this.eventChannelSubscriptions.Remove(region); messageReceiver.Dispose(); }