Ejemplo n.º 1
0
        public override void OnInitialise()
        {
            GameSimRules rules = new GameSimRules();

            rules.FragWinLimit  = 20;
            rules.RespawnTime   = 5;
            rules.GameTimeLimit = 300;

            var gameSim = new GameSimulation(rules);

            SystemCore.AddNewUpdateRenderSubsystem(gameSim);
            SystemCore.CursorVisible = true;
            SystemCore.ActiveScene.SetUpAmbientAndFullLightingRig();

            cameraObject = new GameObject();
            cameraObject.AddComponent(new ComponentCamera(MathHelper.PiOver4, SystemCore.GraphicsDevice.Viewport.AspectRatio, 1f, 200f, false));
            SystemCore.GameObjectManager.AddAndInitialiseGameObject(cameraObject);
            SystemCore.SetActiveCamera(cameraObject.GetComponent <ComponentCamera>());
            cameraObject.Transform.AbsoluteTransform = Matrix.CreateWorld(new Vector3(0, 200, 0), new Vector3(0, -1, 0), new Vector3(0, 0, 1));



            host = WebHostHelper.CreateWebHost(gameSim);


            base.OnInitialise();
        }
Ejemplo n.º 2
0
        public void Initalise()
        {
            currentVertices = new List <Vector3>();

            SystemCore.ActiveScene.SetUpAmbientAndFullLightingRig();

            SystemCore.ActiveScene.AddPointLight(new Vector3(0, 15, 0), Color.White, 20, 20, 1, PointLightNumber.One);
            SystemCore.ActiveScene.AddPointLight(new Vector3(0, -15, 0), Color.White, 20, 20, 1, PointLightNumber.Two);
            SystemCore.ActiveScene.AddPointLight(new Vector3(0, 0, 15), Color.White, 20, 20, 1, PointLightNumber.Three);
            SystemCore.ActiveScene.AddPointLight(new Vector3(0, 0, -15), Color.White, 20, 20, 1, PointLightNumber.Four);

            SystemCore.AddNewUpdateRenderSubsystem(new SkyDome(Color.LightGray, Color.Gray, Color.DarkBlue));

            shapeBuilder = new ProceduralShapeBuilder();
            CurrentMode  = EditMode.Voxel;
            shapesToBake = new Dictionary <GameObject.GameObject, ProceduralShape>();


            cameraGameObject = new GameObject.GameObject("camera");
            cameraGameObject.AddComponent(new ComponentCamera());
            cameraGameObject.Transform.SetPosition(new Vector3(0, 0, 20));
            cameraGameObject.Transform.SetLookAndUp(new Vector3(0, 0, -1), new Vector3(0, 1, 0));
            SystemCore.GameObjectManager.AddAndInitialiseGameObject(cameraGameObject);
            SystemCore.SetActiveCamera(cameraGameObject.GetComponent <ComponentCamera>());


            mouseCursor = GameObjectFactory.CreateRenderableGameObjectFromShape(new ProceduralCube(),
                                                                                EffectLoader.LoadSM5Effect("flatshaded"));
            SystemCore.GameObjectManager.AddAndInitialiseGameObject(mouseCursor);



            AddGUI();
        }
Ejemplo n.º 3
0
        public override void OnInitialise()
        {
            modelEditor = new SimpleModelEditor(10);
            SystemCore.ActiveScene.FogEnabled = false;

            SystemCore.AddNewUpdateRenderSubsystem(modelEditor);
            base.OnInitialise();
        }
Ejemplo n.º 4
0
        public override void OnInitialise()
        {
            startPos = new Vector3(0, planetSize * 1.25f, 0);

            CollisionRules.DefaultCollisionRule = CollisionRule.NoSolver;
            SystemCore.ActiveScene.SetUpBasicAmbientAndKey();


            SystemCore.AddNewUpdateRenderSubsystem(new SkyDome(Color.Black, Color.Black, Color.Black));


            cameraGameObject = new GameObject("camera");
            cameraGameObject.AddComponent(new ComponentCamera());
            cameraGameObject.Transform.SetPosition(startPos);
            cameraGameObject.Transform.SetLookAndUp(new Vector3(1, 0, 0), new Vector3(0, 1, 0));
            cameraGameObject.AddComponent(new MouseController());
            SystemCore.GameObjectManager.AddAndInitialiseGameObject(cameraGameObject);
            SystemCore.SetActiveCamera(cameraGameObject.GetComponent <ComponentCamera>());

            planets = new List <MiniPlanet>();

            var shape = SimpleModelEditor.LoadShape("voxrocket");

            if (shape != null)
            {
                testShip = GameObjectFactory.CreateRenderableGameObjectFromShape(shape,
                                                                                 EffectLoader.LoadSM5Effect("flatshaded"));

                testShip.Transform.Rotate(Vector3.Up, -MathHelper.PiOver2);
                testShip.Transform.AbsoluteTransform.Translation = new Vector3(100, 0, 0);
                //testShip.AddComponent(new RotatorComponent(Vector3.Right, 0.001f));

                SystemCore.GameObjectManager.AddAndInitialiseGameObject(testShip);
            }

            GenerateSystem();

            base.OnInitialise();
        }
Ejemplo n.º 5
0
        public MainGameScreen()
            : base()
        {
            SystemCore.ActiveScene.SetUpBasicAmbientAndKey();

            SystemCore.AddNewUpdateRenderSubsystem(new SkyDome(Color.Black, Color.Black, Color.Black));


            ship = new Ship("ship");
            SystemCore.SetActiveCamera(ship.shipCameraObject.GetComponent <ComponentCamera>());



            Model           geoDesicModel = SystemCore.ContentManager.Load <Model>("Models/geodesic2");
            ProceduralShape geodesicShape = ModelMeshParser.GetShapeFromModelWithUVs(geoDesicModel);

            geodesicShape.Scale(1f);
            geodesicShape.InsideOut();

            ship.AddComponent(new RenderGeometryComponent(geodesicShape));
            //var cockpitEffectComponent = new EffectRenderComponent(EffectLoader.LoadEffect("cockpitscreen"));
            //cockpitEffectComponent.DrawOrder = 100;
            //ship.AddComponent(cockpitEffectComponent);

            oldPos = ship.GetComponent <HighPrecisionPosition>().Position;
            SystemCore.GameObjectManager.AddAndInitialiseGameObject(ship);


            testPlanetSurfacePosition           = new PlanetSurfacePosition();
            testPlanetSurfacePosition.Latitude  = 40;
            testPlanetSurfacePosition.Longitude = -90;

            solarSystem            = new SolarSystem();
            solarSystem.PlayerShip = ship;
            ship.SolarSystem       = solarSystem;
            SystemCore.AddNewGameComponent(solarSystem);
            ship.Transform.Rotate(Vector3.Up, MathHelper.PiOver2);
        }
Ejemplo n.º 6
0
        public EditorTest()
        {
            modelEditor = new SimpleModelEditor(10);

            SystemCore.AddNewUpdateRenderSubsystem(modelEditor);
        }