Beispiel #1
0
    private void OnConnect(int cnnId, int channelId, int hostId, int error)
    {
        SceneManager.LoadScene("Battle");

        Debug.Log("Connected to Server");
        PlayerInfoNetMsg msg = new PlayerInfoNetMsg();

        msg.PlayerInfo = PlayerManager.PlayerInfo;

        SendToServer(msg);
    }
Beispiel #2
0
    private void OnPlayerInfo(int cnnId, int channelId, int hostId, PlayerInfoNetMsg netMsg)
    {
        var player = GetPlayer(cnnId);

        if (player == null)
        {
            Debug.LogError("Can't set player info, because no player is associated with this connection");
            return;
        }

        // Save player's information
        player.PlayerInfo = netMsg.PlayerInfo;
        Debug.Log(string.Format("{0} equipped dragon {1}", player.PlayerNumber, player.PlayerInfo.EquippedDragonId));

        if (Player1.IsReadyToBattle() && Player2.IsReadyToBattle())
        {
            StartGame();
        }
    }