mirror of
https://github.com/DerTyp7/defrain-shooter-unity.git
synced 2025-10-29 20:52:10 +01:00
29 lines
622 B
C#
29 lines
622 B
C#
using Mirror;
|
|
using UnityEngine;
|
|
|
|
public class JoinLeaveManager : MonoBehaviour
|
|
{
|
|
private NetworkManager networkManager;
|
|
|
|
private void Start()
|
|
{
|
|
networkManager = GetComponent<NetworkManager>();
|
|
}
|
|
|
|
public void Join(string ip, string username)
|
|
{
|
|
|
|
|
|
Debug.Log("[JoinLeaveManager] Trying to join server: " + ip + " as " + username);
|
|
|
|
networkManager.StartClient();
|
|
networkManager.networkAddress = ip;
|
|
Debug.Log("[JoinLeaveManager] " + username + " joined the server: " + ip);
|
|
}
|
|
|
|
public void Host()
|
|
{
|
|
networkManager.StartHost();
|
|
}
|
|
}
|