Select Git revision
EditLoader.cs
-
Marco Zimmer authoredMarco Zimmer authored
StartServer.cs 6.10 KiB
using System.Collections;
using System.Diagnostics;
using UnityEngine;
using UnityEngine.Networking;
using UnityEngine.SceneManagement;
using static UIconfig;
using static CommunicationEvents;
public class StartServer : MonoBehaviour
{
[SerializeField]
TMPro.TextMeshProUGUI WaitingText;
public static Process process;
public static ProcessStartInfo processInfo;
public int autostart = 0; //when 1 in Start() will be ServerRoutine() launched.
public int autoend = 0; //Update() also affected
public int autoprepareGame = 0;
public int autocheckIfServerIsRunning = 0;
// Start is called before the first frame update
void Start()
{
CommunicationEvents.ServerRunning = false;
if (ServerAutoStart==true && autostart == 1 )
{
StartCoroutine(ServerRoutine());
}
if (ServerAutoStart == true && autostart == 2 )
{
StartCoroutine(ServerRoutine1());
}
}
// Update is called once per frame
void Update()
{
if (autoend == 1)
{
if (CommunicationEvents.ServerRunning && Input.anyKey)
{
SceneManager.LoadScene(1);
}
//if(!ServerRunning) UnityEngine.Debug.Log("waiting " + ServerRunning);
}
}
void PrepareGame()
{
if (autoprepareGame !=0)
{
WaitingText.text = "Press any key to start the game";
CommunicationEvents.ServerRunning = true;
UnityEngine.Debug.Log("server fin");
}
}