/// <inheritdoc /> public override async Task HandleMessage(IPeerMessageContext <GameClientPacketPayload> context, NetworkObjectVisibilityChangeEventPayload payload) { foreach (var entity in payload.EntitiesToCreate) { if (Logger.IsDebugEnabled) { Logger.Debug($"Encountered new entity: {entity.EntityGuid}"); } } foreach (var entity in payload.OutOfRangeEntities) { if (Logger.IsErrorEnabled) { Logger.Debug($"Leaving entity: {entity}"); } } //Assume it's a player for now foreach (var creationData in payload.EntitiesToCreate) { NetworkEntityNowVisibleEventArgs visibilityEvent = VisibileEventFactory.Create(creationData); VisibilityEventPublisher.Publish(visibilityEvent); } foreach (var destroyData in payload.OutOfRangeEntities) { OnNetworkEntityVisibilityLost?.Invoke(this, new NetworkEntityVisibilityLostEventArgs(destroyData)); } }
public override async Task HandleMessage(IPeerMessageContext <GameClientPacketPayload> context, PlayerSelfSpawnEventPayload payload) { NetworkEntityNowVisibleEventArgs visibilityEvent = VisibileEventFactory.Create(payload.CreationData); VisibilityEventPublisher.Publish(visibilityEvent); //TODO: We need to make this the first packet, or couple of packets. We don't want to do this inbetween potentially slow operatons. await context.PayloadSendService.SendMessageImmediately(new ServerTimeSyncronizationRequestPayload(DateTime.UtcNow.Ticks)); }
public override async Task HandleMessage(IPeerMessageContext <GameClientPacketPayload> context, PlayerSelfSpawnEventPayload payload) { NetworkEntityNowVisibleEventArgs visibilityEvent = VisibileEventFactory.Create(payload.CreationData); VisibilityEventPublisher.Publish(visibilityEvent); }