Example #1
0
        public NetworkLevelHandler(App root, NetworkHandler net, LevelInitialization data, byte playerIndex) : base(root, data)
        {
            this.net = net;
            this.localPlayerIndex = playerIndex;

            net.OnUpdateAllPlayers += OnUpdateAllPlayers;
            net.RegisterCallback <CreateControllablePlayer>(OnCreateControllablePlayer);
            net.RegisterCallback <CreateRemotePlayer>(OnCreateRemotePlayer);
            net.RegisterCallback <DestroyRemotePlayer>(OnDestroyRemotePlayer);
            net.RegisterCallback <CreateRemoteObject>(OnCreateRemoteObject);
            net.RegisterCallback <DestroyRemoteObject>(OnDestroyRemoteObject);
            net.RegisterCallback <DecreasePlayerHealth>(OnDecreasePlayerHealth);
            net.RegisterCallback <RemotePlayerDied>(OnRemotePlayerDied);

            // Wait 3 frames and then inform server that loading is complete
            isStillLoading = 3;
        }