Ejemplo n.º 1
0
        public static void LoadLevelData()
        {
            XEngineComponentTest testGame = new XEngineComponentTest();

            testGame.InitDelegate = delegate {
                LevelData levelData = ServiceLocator.Content.Load<LevelData>( "Data/Level_Test" );
                System.Diagnostics.Debugger.Break();
            };
            testGame.Run();
        }
Ejemplo n.º 2
0
        public static void LoadEntityListTest()
        {
            XEngineComponentTest testGame = new XEngineComponentTest();

            testGame.InitDelegate = delegate {
                EntityDictionary entityDictionary = ServiceLocator.Content.Load<EntityDictionary>( "Data/EntityTemplates" );
                System.Diagnostics.Debugger.Break();
            };
            testGame.Run();
        }
Ejemplo n.º 3
0
        public static void ComponentTest()
        {
            XEngineComponentTest testGame = new XEngineComponentTest(false);

            // Init Camera
            Camera camera = new Camera( testGame );
            testGame.Components.Add( camera );
            ServiceLocator.Camera = camera;

            testGame.Components.Add( new DebugHUD( testGame ) );

            testGame.Run();
        }
Ejemplo n.º 4
0
        public static void LoadLevelData()
        {
            XEngineComponentTest testGame = new XEngineComponentTest();
            testGame.CameraType = CameraType.CAMERA_TYPE_TOP_DOWN;

            LevelManager levelManager;
            testGame.InitDelegate = delegate {
                levelManager = new LevelManager();
                levelManager.EntityFactory.LoadEntityTemplates( "Data/EntityTemplates" );
                levelManager.LoadLevel( "Data/Level_Test" );
            };
            testGame.Run();
        }
Ejemplo n.º 5
0
        public static void ComponentTest()
        {
            XEngineComponentTest testGame = new XEngineComponentTest();

            Origin origin = null;
            testGame.InitDelegate = delegate {
                origin = new Origin();
                origin.Initialize();
            };
            testGame.DrawDelegate = delegate( GameTime gameTime ) {
                origin.Draw( Matrix.Identity );
            };
            testGame.Run();
        }
Ejemplo n.º 6
0
        public static new void ComponentTest()
        {
            XEngineComponentTest testGame = new XEngineComponentTest();
            testGame.CameraType = CameraType.CAMERA_TYPE_FIRST_PERSON;

            Origin origin = null;
            testGame.InitDelegate = delegate {
                origin = new Origin();
                origin.Initialize();
            };
            testGame.DrawDelegate = delegate( GameTime gameTime ) {
                origin.Draw();
            };
            testGame.Run();
        }
Ejemplo n.º 7
0
        public static void TestTerrain()
        {
            XEngineComponentTest testGame = new XEngineComponentTest();

            Terrain terrain = null;
            testGame.InitDelegate = delegate {
                    terrain = testGame.Content.Load<Terrain>( "HeightMaps\\testheightmap" );
                    terrain.ScaleTerrain(5.0f, -2.0f, 0.5f);
                    terrain.LoadTexture("grass", 10);
               };
            testGame.DrawDelegate = delegate( GameTime gameTime ) {
                terrain.Draw();
            };
            testGame.Run();
        }
Ejemplo n.º 8
0
        public static void ComponentTest()
        {
            XEngineComponentTest testGame = new XEngineComponentTest();

            ScenegraphManager scenegraph = new ScenegraphManager( testGame ); ;
            Entity entity1 = null;
            Entity entity2 = null;
            Entity entity3 = null;
            testGame.InitDelegate = delegate {
                scenegraph.Initialize();

                entity1 = new Entity();
                PrimitiveRenderComponent.AddTestComponent( entity1, GeometricPrimitiveType.Sphere, 1.0f);
                MoveComponent.AddTestComponent( entity1 );
                entity1.Initialize();
                scenegraph.AddEntity( entity1, null );

                entity2 = new Entity();
                PrimitiveRenderComponent.AddTestComponent( entity2, GeometricPrimitiveType.Cube, 1.0f );
                entity2.Initialize();
                Transform transform2 = entity2.GetAttribute<Transform>( Attributes.TRANSFORM );
                transform2.Position = new Vector3( 0, 1.0f, 0 );
                transform2.Rotation = Matrix.CreateRotationY( MathHelper.PiOver4 );
                transform2.Scale = new Vector3( 0.5f );
                scenegraph.AddEntity( entity2, entity1 );

                entity3 = new Entity();
                PrimitiveRenderComponent.AddTestComponent( entity3, GeometricPrimitiveType.Cube, 1.0f );
                entity3.Initialize();
                Transform transform3 = entity3.GetAttribute<Transform>( Attributes.TRANSFORM );
                transform3.Position = new Vector3( 1.5f, 0, 0 );
                scenegraph.AddEntity( entity3, entity2 );

            };
            testGame.UpdateDelegate = delegate( GameTime gameTime ) {
                entity1.Update( gameTime );
                entity2.Update( gameTime );
                entity3.Update( gameTime );
                scenegraph.Update( gameTime );
            };
            testGame.DrawDelegate = delegate( GameTime gameTime ) {
                entity1.Draw( gameTime );
                entity2.Draw( gameTime );
                entity3.Draw( gameTime );
            };
            testGame.Run();
        }
Ejemplo n.º 9
0
        public static void ComponentTest()
        {
            XEngineComponentTest testGame = new XEngineComponentTest();

            Entity entity = null;
            testGame.InitDelegate = delegate {
                entity = new Entity();
                ModelRenderComponent.AddShipTestComponent( entity );
                AddTestComponent( entity );
                entity.Initialize();
            };
            testGame.UpdateDelegate = delegate( GameTime gameTime ) {
                entity.Update( gameTime );
            };
            testGame.DrawDelegate = delegate( GameTime gameTime ) {
                entity.Draw( gameTime );
            };
            testGame.Run();
        }
Ejemplo n.º 10
0
        public static void ComponentTest()
        {
            XEngineComponentTest testGame = new XEngineComponentTest( false );

            // Initialize Camera
            Camera camera = new Camera( testGame );
            testGame.Components.Add( camera );
            ServiceLocator.Camera = camera;

            // Initialize InputManager
            InputManager inputManager = new InputManager( testGame );
            testGame.Components.Add( inputManager );
            ServiceLocator.InputManager = inputManager;

            // Initialize DebugHUD
            testGame.Components.Add( new DebugHUD( testGame ) );

            testGame.Components.Add( new CameraController( testGame ) );

            testGame.Run();
        }
Ejemplo n.º 11
0
        public static void EntityTest(string entityName)
        {
            XEngineComponentTest testGame = new XEngineComponentTest();

            EntityFactory entityFactory = new EntityFactory();
            Entity entity = null;
            testGame.InitDelegate = delegate {
                entityFactory.LoadEntityTemplates( "Data/EntityTemplates" );
                entity = entityFactory.CreateEntity( entityName );
                entity.Initialize();
            };
            testGame.UpdateDelegate = delegate( GameTime gameTime ) {
                entity.Update( gameTime );
                Transform transform = entity.GetAttribute<Transform>( Attributes.TRANSFORM );
                if ( transform != null ) {
                    transform.UpdateWorld( null );
                }
            };
            testGame.DrawDelegate = delegate( GameTime gameTime ) {
                entity.Draw( gameTime );
            };
            testGame.Run();
        }
Ejemplo n.º 12
0
        public static void ComponentTest()
        {
            XEngineComponentTest testGame = new XEngineComponentTest( false );

            // Initialize Camera
            Camera camera = new Camera( testGame );
            testGame.Components.Add( camera );
            ServiceLocator.Camera = camera;

            // Initialize InputManager
            InputManager inputManager = new InputManager( testGame );
            inputManager.traceEnabled = true;
            testGame.Components.Add( inputManager );

            testGame.UpdateDelegate =
                delegate( GameTime gameTime ) {
                    inputManager.isKeyPressed( Keys.A );
                    inputManager.isMouseLeftPressed();
                    inputManager.isMouseRightDown();
                    inputManager.isKeyDown( Keys.Space );
                };

            testGame.Run();
        }
Ejemplo n.º 13
0
        public static void ComponentTest()
        {
            XEngineComponentTest testGame = new XEngineComponentTest();

            Entity entity1 = null;
            Entity entity2 = null;
            testGame.InitDelegate = delegate {
                entity1 = new Entity();
                AddTestComponent( entity1, GeometricPrimitiveType.Sphere, 2.0f );
                entity1.Initialize();

                entity2 = new Entity();
                AddTestComponent( entity2, GeometricPrimitiveType.Cube, 1.0f );
                Transform transform = entity2.GetAttribute<Transform>( Attributes.TRANSFORM );
                transform.Position = new Vector3( 5.0f, 0, 0 );
                transform.UpdateWorld(null);
                entity2.Initialize();
            };
            testGame.DrawDelegate = delegate( GameTime gameTime ) {
                entity1.Draw( gameTime );
                entity2.Draw( gameTime );
            };
            testGame.Run();
        }
Ejemplo n.º 14
0
        public static void ComponentTest()
        {
            XEngineComponentTest testGame = new XEngineComponentTest(false);

            Camera camera = new Camera( testGame );
            testGame.Components.Add( camera );

            testGame.Run();
        }
Ejemplo n.º 15
0
        public static void ComponentTest()
        {
            XEngineComponentTest testGame = new XEngineComponentTest();

            Entity entity1 = null;
            Entity entity2 = null;
            testGame.InitDelegate = delegate {
                entity1 = new Entity();
                AddShipTestComponent( entity1 );
                entity1.AddAttribute( Attributes.TRANSFORM, new Transform( new Vector3( 0, 1.0f, 0 ) ) );
                entity1.Initialize();

                entity2 = new Entity();
                AddGridTestComponent( entity2 );
                entity2.Initialize();
            };
            testGame.DrawDelegate = delegate( GameTime gameTime ) {
                entity1.Draw( gameTime );
                entity2.Draw( gameTime );
            };
            testGame.Run();
        }