Beispiel #1
0
        private void OnPlayerAlreadyInScene(ClientPlayerAlreadyInScene alreadyInScene)
        {
            Logger.Get().Info(this, "Received AlreadyInScene packet");

            foreach (var playerEnterScene in alreadyInScene.PlayerEnterSceneList)
            {
                Logger.Get().Info(this, $"Updating already in scene player with ID: {playerEnterScene.Id}");
                OnPlayerEnterScene(playerEnterScene);
            }

            if (alreadyInScene.SceneHost)
            {
                // Notify the entity manager that we are scene host
                _entityManager.OnBecomeSceneHost();
            }
            else
            {
                // Notify the entity manager that we are scene client (non-host)
                _entityManager.OnBecomeSceneClient();
            }

            // Whether there were players in the scene or not, we have now determined whether
            // we are the scene host
            _sceneHostDetermined = true;
        }
Beispiel #2
0
        public ClientUpdatePacket(Packet packet) : base(packet)
        {
            DataPacketIds = new HashSet <ClientPacketId>();

            PlayerConnect        = new PacketDataCollection <PlayerConnect>();
            PlayerDisconnect     = new PacketDataCollection <ClientPlayerDisconnect>();
            PlayerEnterScene     = new PacketDataCollection <ClientPlayerEnterScene>();
            PlayerAlreadyInScene = new ClientPlayerAlreadyInScene();
            PlayerLeaveScene     = new PacketDataCollection <GenericClientData>();

            PlayerUpdates = new PacketDataCollection <PlayerUpdate>();
            EntityUpdates = new PacketDataCollection <EntityUpdate>();

            PlayerDeath       = new PacketDataCollection <GenericClientData>();
            PlayerTeamUpdate  = new PacketDataCollection <ClientPlayerTeamUpdate>();
            PlayerSkinUpdate  = new PacketDataCollection <ClientPlayerSkinUpdate>();
            PlayerEmoteUpdate = new PacketDataCollection <ClientPlayerEmoteUpdate>();

            GameSettingsUpdate = new GameSettingsUpdate();
        }