Example #1
0
        /// <summary>
        /// LoadContent will be called once per game and is the place to load
        /// all of your content.
        /// </summary>
        protected override void LoadContent()
        {
            // Create a new SpriteBatch, which can be used to draw textures.
            spriteBatch = new SpriteBatch(GraphicsDevice);

            //testImage = Content.Load<Texture2D>("Stupid");

            testScene = new Scene(GraphicsDevice, spriteBatch);
            layer1    = new SpriteLayer();
            layer2    = new SpriteLayer();

            Line     = Content.Load <Texture2D>("Line");
            testMap  = new TileMap("TileMaps/Tramtunnel1.tmx", 1, Content);
            testMap1 = new TileMap("TileMaps/Tramtunnel1.tmx", 3, Content);

            testMap1.Parent = layer2;
            testMap.Parent  = layer1;
            testMap.Scale   = new Vector2(1, 1);
            testMap1.Scale  = new Vector2(1, 1);

            testScene.Layers.AddLast(layer1);
            testScene.Layers.AddLast(layer2);

            Polygon testPolygon = new Polygon();

            testPolygon.addPoint(new Vector2(0, 100));
            testPolygon.addPoint(new Vector2(-50, -2));
            testPolygon.addPoint(new Vector2(50, -2));

            Polygon testPolygon2 = new Polygon();

            testPolygon2.addPoint(new Vector2(-40, -20));
            testPolygon2.addPoint(new Vector2(30, -10));
            testPolygon2.addPoint(new Vector2(30, 50));
            testPolygon2.addPoint(new Vector2(-40, 35));

            testPolygon.updateBounds();
            testPolygon2.updateBounds();

            testPoly  = new PolygonCollider(testPolygon);
            testPoly2 = new PolygonCollider(testPolygon2);

            container1 = new GameObject();
            container2 = new GameObject();

            obj1 = new StaticObject(testPoly, container1);
            b1   = obj1.BoundingShape;

            obj2 = new StaticObject(testPoly2, container2);
            b2   = obj2.BoundingShape;

            physicsTree = new Quadtree(Vector2.Zero, 1000, 7);

            physicsTree.InsertBound(b2);
            physicsTree.InsertBound(b1);

            container1.Collider = obj1;
            container2.Collider = obj2;

            TestCollider          = new TileCollider();
            TestCollider.Map      = testMap;
            TestCollider.TileSize = testMap.TileSets[0].TileHeight;

            audioManager.LoadContent(Content);
            SoundEffect         windHowl     = audioManager.LoadSoundEffect("wind_howl_1", Content);
            SoundEffectInstance windInstance = audioManager.MakeEmitter(windHowl, new Vector3(699f, 312f, 0f));

            windInstance.IsLooped = true;
            windInstance.Play();
            //test spatial audio emmiters
        }