Ejemplo n.º 1
0
        void HandleInputs(ref SimulationStep step)
        {
            m_Poller.OnInput(out step.input);

            SimulateTick(ref step);

            m_Input.SetInput(Time.time, m_ClientLastTick, m_ClientPredictedTick, m_Simulation);

            m_PacketProcessor.SendNetSerializable(ClientNetPeer, m_Input, DeliveryMethod.Unreliable);
        }
Ejemplo n.º 2
0
        void SimulateTick(ref SimulationStep step)
        {
            m_GetPlayer.HandlePlayer(step.input);
            m_ClientSimulation.Simulate(Constants.SNAPSHOT_INTERVAL);
            step.state.Set(m_GetPlayer.transform.position, m_GetPlayer.transform.rotation, m_GetPlayer.Yaw, m_GetPlayer.Pitch);

            _previous = _current;
            _current  = new PredictedState(m_GetPlayer.transform.position, m_GetPlayer.transform.rotation, m_GetPlayer.Yaw, m_GetPlayer.Pitch);

            //todo rebuild a simulation with a simple controller + camera to try the code
        }