コード例 #1
0
ファイル: StaticScene.cs プロジェクト: zzm0101/UnityLockstep
        protected override void OnUpdate(float timeStep)
        {
            base.OnUpdate(timeStep);

            network.Update();

            SimpleMoveCamera3D(timeStep);

            const int qualShift = 1;

            if (Input.GetKeyPress(Key.P))
            {
                simulation.DumpGameLog(new FileStream(@"C:\Log\" + Math.Abs(Contexts.sharedInstance.gameState.hashCode.value) + ".bin", FileMode.Create, FileAccess.Write));
            }

            // Set destination or spawn a new jack with left mouse button
            if (Input.GetMouseButtonPress(MouseButton.Left))
            {
                SetPathPoint(Input.GetQualifierDown(qualShift));
            }

            simulation.Update(timeStep * 1000);

            if (simulation.Running)
            {
                worldInfoText.Value = "ActorId: " + simulation.LocalActorId + Environment.NewLine +
                                      "Tick: " + Contexts.sharedInstance.gameState.tick.value + Environment.NewLine +
                                      "HashCode: " + Contexts.sharedInstance.gameState.hashCode.value;
            }
        }
コード例 #2
0
        public void TickFixed(float dt)
        {
            network.Update();

            if (!Running)
            {
                return;
            }
            gameState.tick++;

            ExecuteCommand();
        }