public void StartSimulation()
 {
     if (m_Lockstep != null)
     {
         m_Lockstep.RunSimulation(true);
     }
 }
Пример #2
0
        void Update()
        {
            if (lockstep != null && startState != StartState.STARTED)
            {
                if (startState == StartState.BEHAVIOR_INITIALIZED)
                {
                    startState = StartState.FIRST_UPDATE;
                }
                else if (startState == StartState.FIRST_UPDATE)
                {
                    lockstep.RunSimulation(true);
                    startState = StartState.STARTED;
                }
            }

            if (lockstep != null)
            {
                tsDeltaTime += UnityEngine.Time.deltaTime;

                if (tsDeltaTime >= lockedTimeStep)
                {
                    tsDeltaTime -= lockedTimeStep;

                    instance.scheduler.UpdateAllCoroutines();
                    lockstep.Update();
                }
            }
        }
 void Update()
 {
     if (lockstep != null && startState != StartState.STARTED) {
         if (startState == StartState.BEHAVIOR_INITIALIZED) {
             startState = StartState.FIRST_UPDATE;
         } else if (startState == StartState.FIRST_UPDATE) {
             lockstep.RunSimulation(true);
             startState = StartState.STARTED;
         }
     }
 }
Пример #4
0
 /// <summary>
 /// TrueSyncManager的Start函数执行后startState == StartState.BEHAVIOR_INITIALIZED
 /// </summary>
 //TrueSyncManager的状态:StartState.BEHAVIOR_INITIALIZED->StartState.FIRST_UPDATE->StartState.STARTED
 void Update()
 {
     if (lockstep != null && startState != StartState.STARTED)
     {
         if (startState == StartState.BEHAVIOR_INITIALIZED)
         {
             startState = StartState.FIRST_UPDATE;
         }
         else if (startState == StartState.FIRST_UPDATE)
         {
             //相当于执行了一次lockstep.Run()把lockstep的状态this.simulationState = AbstractLockstep.SimulationState.WAITING_PLAYERS
             //lockstep.Update检测到WAITING_PLAYERS状态就执行CheckGameStart
             lockstep.RunSimulation(true);
             startState = StartState.STARTED;
         }
     }
 }