Exemplo n.º 1
0
        public NetworkLevelHandler(Controller root, NetworkHandler network, LevelInitialization data, int playerIndex) : base(root, data)
        {
            this.network     = network;
            this.playerIndex = playerIndex;

            rootObject.AddComponent(new LocalController(this));

            network.RegisterCallback <CreateRemotePlayer>(OnCreateRemotePlayer);
            network.RegisterCallback <UpdateRemotePlayer>(OnUpdateRemotePlayer);
            network.RegisterCallback <DestroyRemotePlayer>(OnDestroyRemotePlayer);
        }
Exemplo n.º 2
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;
        }