Added test mode and manual positioning
This commit is contained in:
@@ -22,6 +22,7 @@ public class GameManager : MonoBehaviour
|
||||
protected GameManager_Network networkSubsystem;
|
||||
protected GameManager_UI uiSubsystem;
|
||||
protected GameManager_Map mapSubsystem;
|
||||
protected GameManager_Input inputSubsystem;
|
||||
|
||||
protected GameClient gameClient;
|
||||
|
||||
@@ -41,18 +42,39 @@ public class GameManager : MonoBehaviour
|
||||
public PathwaySettings pathwaySettings;
|
||||
public AreaSettings areaSettings;
|
||||
|
||||
[Header("GPS")]
|
||||
public GameObject Player;
|
||||
|
||||
[Header("Debug")]
|
||||
public bool testMode = false;
|
||||
private GameClient _secondClient;
|
||||
private GameClient _thirdClient;
|
||||
private GameManager_Network _secondNetwork;
|
||||
private GameManager_Network _thirdNetwork;
|
||||
|
||||
|
||||
void Start()
|
||||
{
|
||||
DontDestroyOnLoad(this);
|
||||
if (displayName == null || displayName == "")
|
||||
{
|
||||
displayName = "Player_" + UnityEngine.Random.Range(1000, 9999).ToString();
|
||||
displayName = GenerateUsername();
|
||||
}
|
||||
gameClient = new GameClient(GenerateUUID(), /*displayName*/ GenerateUsername());
|
||||
if (testMode)
|
||||
{
|
||||
_secondClient = new GameClient(GenerateUUID(), GenerateUsername());
|
||||
_secondNetwork = new GameManager_Network(_secondClient);
|
||||
_thirdClient = new GameClient(GenerateUUID(), GenerateUsername());
|
||||
_thirdNetwork = new GameManager_Network(_thirdClient);
|
||||
|
||||
_secondNetwork.OpenConection();
|
||||
_thirdNetwork.OpenConection();
|
||||
}
|
||||
gameClient = new GameClient(GenerateUUID(), displayName);
|
||||
uiSubsystem = new GameManager_UI(gameClient, JoinCreateLobby, InLobby, LoadingScreen, GameScreen);
|
||||
networkSubsystem = new GameManager_Network(gameClient);
|
||||
mapSubsystem = new GameManager_Map(gameClient, MapCenterPoint, buildingSettings, pathwaySettings, areaSettings);
|
||||
inputSubsystem = new GameManager_Input(gameClient, Player, testMode);
|
||||
networkSubsystem.OpenConection();
|
||||
}
|
||||
private void Update()
|
||||
@@ -70,7 +92,7 @@ public class GameManager : MonoBehaviour
|
||||
}
|
||||
}
|
||||
catch (NullReferenceException ex) { }
|
||||
|
||||
inputSubsystem.positionCheck();
|
||||
}
|
||||
|
||||
|
||||
@@ -89,6 +111,10 @@ public class GameManager : MonoBehaviour
|
||||
public void CreateLobbyButton()
|
||||
{
|
||||
networkSubsystem.CrateLobby(50.7727264, 15.0719876);
|
||||
if (testMode)
|
||||
{
|
||||
StartCoroutine(ConnectTestClients());
|
||||
}
|
||||
}
|
||||
public void JoinLobbyButton()
|
||||
{
|
||||
@@ -113,5 +139,13 @@ public class GameManager : MonoBehaviour
|
||||
void OnApplicationQuit()
|
||||
{
|
||||
gameClient.Disconnect();
|
||||
_secondClient?.Disconnect();
|
||||
_thirdClient?.Disconnect();
|
||||
}
|
||||
IEnumerator ConnectTestClients()
|
||||
{
|
||||
yield return new WaitForSeconds(2f);
|
||||
_secondNetwork.JoinLobby(gameClient.CurrentLobbyState.JoinCode);
|
||||
_thirdNetwork.JoinLobby(gameClient.CurrentLobbyState.JoinCode);
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user