public GetNetworkTime(UnbiasedTime timeManager, float abordTime = 3) { this.abordTime = abordTime; #if UNITY_EDITOR ThreadStart threadStart = new ThreadStart(delegate { time = timeManager.TryToGetTime(out isSuccess); }); thread = new Thread(threadStart); #endif #if !UNITY_EDITOR task = new Task(() => { Debug.Log("TASK STARTED"); timeManager.TryToGetTime(); while (!timeManager.timeReceived) { Debug.Log("Waiting for time...." + isSuccess); } time = timeManager.milliseconds; isSuccess = timeManager.timeReceived; Debug.Log("TIME RECEIVED!"); timeManager.timeReceived = false; }); #endif }
public static void Init(string ntp_server = "time.google.com") { ntpServer = ntp_server; GameObject newObject = new GameObject("UnbiasedTimeManager", typeof(UnbiasedTime)); m_Instance = newObject.GetComponent <UnbiasedTime>(); }
public GetNetworkTime(UnbiasedTime timeManager, float abordTime = 3) { this.abordTime = abordTime; ThreadStart threadStart = new ThreadStart(delegate { time = timeManager.TryToGetTime(out isSuccess); }); thread = new Thread(threadStart); }
public static void Init() { GameObject newObject = new GameObject("UnbiasedTimeManager", typeof(UnbiasedTime)); m_Instance = newObject.GetComponent <UnbiasedTime>(); }