Example #1
0
        //metodo che inizializza il livello
        public void nextLevel()
        {
            Vector3[] vertices;
            int[]     indices;

            //pista
            //Ricevo i vertici e gli indici del modello 3d
            TriangleMesh.GetVerticesAndIndicesFromModel(stage[currLevel], out vertices, out indices);
            //creo il modello fisico
            //per la vecchia pista
            //stageMesh = new StaticMesh(vertices, indices, new AffineTransform(Matrix3X3.CreateScale(6f), Vector3.Zero));
            //per la nuova pista
            stageMesh = new StaticMesh(vertices, indices, new AffineTransform(Matrix3X3.CreateScale(6f), Vector3.Zero));
            //lo aggiungo allo spazio fisico
            space.Add(stageMesh);
            //creo il modello 3d collegato al modello fisico
            stageMod = new StaticModel(stage[currLevel], stageMesh.WorldTransform.Matrix, Game, this);
            //calcolo i punti per la costruzione del piano che determina la fine del livello
            EndPoint = stageMod.getBonePosition("Finish");

            Game.Components.Add(stageMod);
            stageMod.Visible = true;
            stageMod.Enabled = true;

            //stessa cosa per il bg e per il bob

            //background
            TriangleMesh.GetVerticesAndIndicesFromModel(BackGroundMod, out vertices, out indices);
            var bgMesh = new StaticMesh(vertices, indices, new AffineTransform(new Vector3(0, -100, 0)));

            space.Add(bgMesh);
            bgMod = new StaticModel(BackGroundMod, bgMesh.WorldTransform.Matrix, Game, this);
            Game.Components.Add(bgMod);
            bgMod.Enabled = true;
            bgMod.Visible = true;

            //Bob
            bobBox = new Box(Vector3.Zero, 0.20f, 0.13f, 0.5f, 15);
            bobBox.WorldTransform = Camera.WorldMatrix;
            //per la vecchia pista
            //bobBox.Position = new Vector3(0, 0.1f, 0);
            //per la nuova pista
            bobBox.Position = new Vector3(0, -0.3f, 0);
            //per la pista09.2
            //bobBox.Position = new Vector3(0, 4f, 0);
            Matrix scaling = Matrix.CreateScale(0.03f, 0.03f, 0.03f);

            //scaling = scaling * Matrix.CreateRotationZ(MathHelper.Pi);
            //Matrix rotation = Matrix.CreateFromYawPitchRoll(MathHelper.PiOver2,0,0);
            bobEntity = new EntityModel(bobBox, bobMod, scaling, Game, this);
            Game.Components.Add(bobEntity);
            bobBox.Tag = bobEntity;
            space.Add(bobBox);
            bobEntity.Visible = true;
            bobEntity.Enabled = true;

            //space.Add(finalBox);

            //sposto la telecamera per avere effetto introduzione
            Camera.Position = new Vector3(400, 400, 400);

            songInstance      = song.CreateInstance();
            hyperspaceInsance = hyperspace.CreateInstance();
            engineInstance    = engine.CreateInstance();

            gamemenu = new gameMenu(Game, timeFont);
            Game.Components.Add(gamemenu);
        }
Example #2
0
        //metodo che inizializza il livello
        public void nextLevel()
        {
            Vector3[] vertices;
            int[] indices;

            //pista
            //Ricevo i vertici e gli indici del modello 3d
            TriangleMesh.GetVerticesAndIndicesFromModel(stage[currLevel], out vertices, out indices);
            //creo il modello fisico
            //per la vecchia pista
            //stageMesh = new StaticMesh(vertices, indices, new AffineTransform(Matrix3X3.CreateScale(6f), Vector3.Zero));
            //per la nuova pista
            stageMesh = new StaticMesh(vertices, indices, new AffineTransform(Matrix3X3.CreateScale(6f),Vector3.Zero));
            //lo aggiungo allo spazio fisico
            space.Add(stageMesh);
            //creo il modello 3d collegato al modello fisico
            stageMod = new StaticModel(stage[currLevel], stageMesh.WorldTransform.Matrix, Game, this);
            //calcolo i punti per la costruzione del piano che determina la fine del livello
            EndPoint = stageMod.getBonePosition("Finish");

            Game.Components.Add(stageMod);
            stageMod.Visible = true;
            stageMod.Enabled = true;

            //stessa cosa per il bg e per il bob

            //background
            TriangleMesh.GetVerticesAndIndicesFromModel(BackGroundMod, out vertices, out indices);
            var bgMesh = new StaticMesh(vertices, indices, new AffineTransform(new Vector3(0, -100, 0)));
            space.Add(bgMesh);
            bgMod = new StaticModel(BackGroundMod, bgMesh.WorldTransform.Matrix, Game, this);
            Game.Components.Add(bgMod);
            bgMod.Enabled = true;
            bgMod.Visible = true;

            //Bob
            bobBox = new Box(Vector3.Zero, 0.20f, 0.13f, 0.5f, 15);
            bobBox.WorldTransform = Camera.WorldMatrix;
            //per la vecchia pista
            //bobBox.Position = new Vector3(0, 0.1f, 0);
            //per la nuova pista
            bobBox.Position = new Vector3(0, -0.3f, 0);
            //per la pista09.2
            //bobBox.Position = new Vector3(0, 4f, 0);
            Matrix scaling = Matrix.CreateScale(0.03f, 0.03f, 0.03f);
            //scaling = scaling * Matrix.CreateRotationZ(MathHelper.Pi);
            //Matrix rotation = Matrix.CreateFromYawPitchRoll(MathHelper.PiOver2,0,0);
            bobEntity = new EntityModel(bobBox, bobMod, scaling, Game, this);
            Game.Components.Add(bobEntity);
            bobBox.Tag = bobEntity;
            space.Add(bobBox);
            bobEntity.Visible = true;
            bobEntity.Enabled = true;

            //space.Add(finalBox);

            //sposto la telecamera per avere effetto introduzione
            Camera.Position = new Vector3(400, 400, 400);

            songInstance = song.CreateInstance();
            hyperspaceInsance = hyperspace.CreateInstance();
            engineInstance = engine.CreateInstance();

            gamemenu = new gameMenu(Game, timeFont);
            Game.Components.Add(gamemenu);
        }