Exemple #1
0
        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
        }
Exemple #2
0
        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>();
        }
Exemple #3
0
        public GetNetworkTime(UnbiasedTime timeManager, float abordTime = 3)
        {
            this.abordTime = abordTime;
            ThreadStart threadStart = new ThreadStart(delegate
            {
                time = timeManager.TryToGetTime(out isSuccess);
            });

            thread = new Thread(threadStart);
        }
Exemple #4
0
        public static void Init()
        {
            GameObject newObject = new GameObject("UnbiasedTimeManager", typeof(UnbiasedTime));

            m_Instance = newObject.GetComponent <UnbiasedTime>();
        }