Пример #1
0
        public override void OnInitialise()
        {
            //lighting
            fpsLabel.Visible = true;
            SystemCore.ActiveScene.SetUpBasicAmbientAndKey();
            SystemCore.ActiveScene.SetDiffuseLightDir(0, new Vector3(0.01f, 1, 0.01f));
            SystemCore.ActiveScene.FogEnabled = false;



            //input
            input = SystemCore.GetSubsystem <InputManager>();
            input.AddKeyDownBinding("CameraForward", Keys.Up);
            input.AddKeyDownBinding("CameraBackward", Keys.Down);
            input.AddKeyDownBinding("CameraLeft", Keys.Left);
            input.AddKeyDownBinding("CameraRight", Keys.Right);
            input.AddKeyPressBinding("MainMenu", Keys.Escape);
            var binding = input.AddKeyPressBinding("WireframeToggle", Keys.Space);

            binding.InputEventActivated += (x, y) => { SystemCore.Wireframe = !SystemCore.Wireframe; };


            //camera
            cameraObject = new GameObject();
            camComponent = new ComponentCamera();
            cameraObject.AddComponent(camComponent);
            SystemCore.GameObjectManager.AddAndInitialiseGameObject(cameraObject);
            cameraObject.Transform.SetPosition(new Vector3(0, 100, 0));
            cameraObject.Transform.Rotate(Vector3.Right, MathHelper.ToRadians(-45));
            cameraObject.Transform.Rotate(Vector3.Up, -MathHelper.PiOver4);
            SystemCore.SetActiveCamera(camComponent);


            simulation = new GameSimulation();
            simulation.InitaliseSimulation();

            base.OnInitialise();
        }