예제 #1
0
        private void SpawnLobbyBall(MatchPlayer player)
        {
            // for multiplayer...

            LobbyBallSpawner spawner = LobbyReferences.Active.BallSpawner;

            if (player.ConnectionSelf != null)
            {
                replace = true;

                Debug.Log("We delete the gameobject and then proceed to make a replacement.");
                NetworkServer.Destroy(player.ConnectionSelf.playerControllers[0].gameObject);
            }

            if (isServer && !replace)
            {
                player.ConnectionSelf = NetworkServer.connections[0];
            }

            if (!replace)
            {
                Debug.Log("I create a new connection using singleton.client.connection");
                player.BallObject = spawner.SpawnBall(Data.PlayerType.Normal, player.CtrlType, player.CharacterId, player.Name, NetworkManager.singleton.client.connection);               // en cliente esto da nulo,, creo.
            }
            else
            {
                Debug.Log("The ball will be replaced using existing connection stored in ball.connectionSelf");

                player.BallObject = spawner.SpawnBall(Data.PlayerType.Normal, player.CtrlType, player.CharacterId, player.Name, player.ConnectionSelf);               // en cliente esto da nulo,, creo.
            }
        }
예제 #2
0
        // aparece el lobbyBall
        private void SpawnLobbyBallFromRace(MatchPlayer player)
        {
            LobbyBallSpawner spawner = LobbyReferences.Active.BallSpawner;

            if (player.ConnectionSelf != null)
            {
                replace = true;

                Debug.Log("We delete the gameobject and then proceed to make a replacement.");
            }
            if (isServer && !replace)
            {
                player.ConnectionSelf = NetworkServer.connections[0];
            }

            if (!replace)
            {
                player.BallObject = spawner.SpawnBall(Data.PlayerType.Normal, player.CtrlType, player.CharacterId, "Player", NetworkManager.singleton.client.connection);               // en cliente esto da nulo,, creo.
            }
            else
            {
                player.BallObject = spawner.SpawnBall(Data.PlayerType.Normal, player.CtrlType, player.CharacterId, "Player", player.ConnectionSelf);               // en cliente esto da nulo,, creo.
            }
        }