Example #1
0
        public TerrainManager(RPG jeu, ScèneDeJeu scèneJeu, int nbZones, Vector2 étendue, string[] nomstextures, FogData[] fogs, Texture2D heightMap, List<string> listNomMusic)
            : base(jeu)
        {
            Jeu = jeu;
            ScèneJeu = scèneJeu;
            NbZones = nbZones;
            Étendue = étendue;
            Fogs = fogs;
            ListNomMusic = listNomMusic;
            NomsTextures = nomstextures;
            Color[] couleursHeightMap = new Color[heightMap.Width * heightMap.Height];
            heightMap.GetData(couleursHeightMap);
            HeightMap = new float[heightMap.Width, heightMap.Height];
            HauteurMax = 0;
            HauteurMin = 256 * ÉCHELLE_HAUTEUR;

            for (int i = 0; i < heightMap.Width; ++i)
            {
                for (int j = 0; j < heightMap.Height; ++j)
                {
                    HeightMap[i, heightMap.Height - 1 - j] = couleursHeightMap[i + j * heightMap.Width].R * ÉCHELLE_HAUTEUR;
                    HauteurMax = Math.Max(HeightMap[i, heightMap.Height - 1 - j], HauteurMax);
                    HauteurMin = Math.Min(HeightMap[i, heightMap.Height - 1 - j], HauteurMin);
                }
            }
            ListeTerrains = new Terrain[NbZones];
            for (int i = 0; i < NbZones; ++i)
            {
                ListeTerrains[i] = new Terrain(Jeu, ScèneJeu, new Vector3(0, 0, (-1) * i * Étendue.Y), Étendue, new Vector2(heightMap.Width - 1, (heightMap.Height - 1) / NbZones), NomsTextures[i], Fogs[i], HeightMap, i * ((heightMap.Height) / NbZones), ListNomMusic[i]);
                ListeTerrains[i].Initialize();
            }
        }
Example #2
0
        public Terrain(RPG jeu, ScèneDeJeu scèneJeu, Vector3 position, Vector2 étendue, Vector2 dimensions, string nomtexture, FogData fog, float[,] heightMap, int indexDébut, string nomMusicSpécifique)
            : base(jeu, scèneJeu, position, ROTATION_TERRAIN, étendue, dimensions, nomtexture)
        {
            IndexDébut = indexDébut;
             HeightMap = heightMap;
             Fog = fog;
             NomMusicSpécifique = nomMusicSpécifique;

             Origine = new Vector3(0,0,0);
        }
Example #3
0
        public Terrain(RPG jeu, ScèneDeJeu scèneJeu, Vector3 position, Vector2 étendue, Vector2 dimensions, string nomtexture, FogData fog, float[,] heightMap, int indexDébut, string nomMusicSpécifique)
            : base(jeu, scèneJeu, position, ROTATION_TERRAIN, étendue, dimensions, nomtexture)
        {
            IndexDébut         = indexDébut;
            HeightMap          = heightMap;
            Fog                = fog;
            NomMusicSpécifique = nomMusicSpécifique;

            Origine = new Vector3(0, 0, 0);
        }
Example #4
0
        // Add() components
        public override void Initialize()
        {
            Scale = new Vector2((float)Jeu.Window.ClientBounds.Width / RÉSOLUTION_PAR_DÉFAUT_X, (float)Jeu.Window.ClientBounds.Height / RÉSOLUTION_PAR_DÉFAUT_Y);
            Vector3 positionCaméra = new Vector3(300, 70, -10);

            TexturesSkybox = new List <string[]>();
            string[] TexturesTerrain = new string[] { "Terrain\\Grass",
                                                      "Terrain\\Snow",
                                                      "Terrain\\Sand",
                                                      "Terrain\\Lava",
                                                      "Terrain\\Lava" };
            FogData[] fogData = new FogData[] { new FogData(new Vector3(0.7f, 1f, 0.8f), 30, 450),
                                                new FogData(new Vector3(0.3f, 0.3f, 0.35f), 30, 450),
                                                new FogData(new Vector3(1f, 0.8f, 0.1f), -200, 1500),
                                                new FogData(new Vector3(1f, 0.6f, 0.1f), 20, 450),
                                                new FogData(new Vector3(0.70f, 0.32f, 0.0f), 10, 420) };

            List <string> listNomMusic = new List <string>()
            {
                "m_act1", "m_act2", "m_act3", "m_act4", "m_act4"
            };


            TexturesSkybox.Add(new string[] { "DarkBox\\topdark",
                                              "DarkBox\\frontdark",
                                              "DarkBox\\backdark",
                                              "DarkBox\\leftdark",
                                              "DarkBox\\rightdark",
                                              "DarkBox\\botdark" });

            string[] SpellIcons = new string[] { "HUD\\Spells\\ChaosBoltButton",
                                                 "HUD\\Spells\\PlasmaFieldButton",
                                                 "HUD\\Spells\\SlowTimeButton",
                                                 "HUD\\Spells\\SpellstealButton" };

            string[] SpellIconsAlt = new string[] { null,
                                                    null,
                                                    "HUD\\Spells\\TimeLockButton",
                                                    null };

            string[] SpellTooltips = new string[] { "Content\\Text\\Firebolt.txt",
                                                    "Content\\Text\\Nova.txt",
                                                    "Content\\Text\\SlowMissiles.txt",
                                                    "Content\\Text\\MindControl.txt" };

            string[] SpellTooltipsAlt = new string[] { null,
                                                       null,
                                                       "Content\\Text\\SlowMissilesAlt.txt",
                                                       null };

            //Vector3 positionCaméra = new Vector3(0, 10, 0);

            GestionInput3D = new InputManager3D(Jeu, this);
            MapManager     = new TerrainManager(Jeu, this, NB_ZONES, new Vector2(ÉTENDUE_MAP, ÉTENDUE_MAP), TexturesTerrain, fogData, GestionnaireDeTextures.Find("Terrain\\heightmap3.0"), listNomMusic);
            BaldorLeBrave  = new Héros(Jeu, this, "dude", 0.2f, 1f,
                                       new Vector3(300, 0, -50), new Vector3(0, MathHelper.PiOver2, 0), new Vector3(0, -MathHelper.PiOver2, 0),
                                       "Baldor Le Brave",
                                       35f, MathHelper.Pi * 4, true,
                                       42, 18, 0, 5, 3, 0.8f,
                                       "nova");
            CaméraJeu = new CaméraThirdPerson(Jeu, GestionInput3D, positionCaméra, BaldorLeBrave, Vector3.Up);
            Box       = new Skybox(Jeu, this, "skybox2", TexturesSkybox[0], new Vector3(0, -1, 0));
            FinalBoss = new Boss(Jeu, this, BaldorLeBrave, "Cyclops\\terrorwurm", 0.2f, ÉCHELLE_BOX_WURM, new Vector3(ÉTENDUE_MAP / 2, 0, -ÉTENDUE_MAP * 4.6f), new Vector3(0, 0, 0), new Vector3(0, -MathHelper.PiOver2, 0), "Demon Grostesque", 30f, MathHelper.Pi * 4, false, 400, 3, 6, 4, 1f, false, 15, 70, 42, 0);

            HeadsUpDisplay   = new HUD(Jeu, this, BaldorLeBrave, "HUD\\HUD", "HUD\\Vie", "HUD\\Mana", "HUD\\Exp", 2.5f, SpellIcons, SpellIconsAlt, "HighTowerText", "HUD\\TextBackground", SpellTooltips, SpellTooltipsAlt);
            ProjManager      = new ProjectileManager(Jeu, this, "OrangeBall", 0.01f);
            MonstManager     = new MonsterManager(Jeu, this);
            CollisionManager = new CollisionManager(Jeu, this);
            BarresManager    = new HealthBarManager(Jeu, this, "HUD\\healthbar", "HUD\\healthbarbg", "Stroke");
            NovManager       = new NovaManager(Jeu, this);
            DoodManager      = new DoodadManager(Jeu, this);


            ListeDesÉléments.Add(GestionInput3D);
            ListeDesÉléments.Add(new Afficheur3D(Jeu));

            ListeDesÉléments.Add(CaméraJeu);
            ListeDesÉléments.Add(Box);
            ListeDesÉléments.Add(MapManager);

            ListeDesÉléments.Add(BaldorLeBrave);
            ListeDesÉléments.Add(MonstManager);

            ListeDesÉléments.Add(FinalBoss);
            ListeDesÉléments.Add(ProjManager);
            ListeDesÉléments.Add(NovManager);
            ListeDesÉléments.Add(DoodManager);
            ListeDesÉléments.Add(CollisionManager);
            ListeDesÉléments.Add(HeadsUpDisplay);
            //ListeDesÉléments.Add(ExpBar);
            ListeDesÉléments.Add(BarresManager);
            ListeDesÉléments.Add(new AfficheurFPS(Jeu, "Arial"));



            base.Initialize();


            CréerDoodads();
            CréerMonstres();
        }
Example #5
0
        // Add() components
        public override void Initialize()
        {
            Scale = new Vector2((float)Jeu.Window.ClientBounds.Width / RÉSOLUTION_PAR_DÉFAUT_X, (float)Jeu.Window.ClientBounds.Height / RÉSOLUTION_PAR_DÉFAUT_Y);
            Vector3 positionCaméra = new Vector3(300, 70, -10);
            TexturesSkybox = new List<string[]>();
            string[] TexturesTerrain = new string[] {"Terrain\\Grass",
                                              "Terrain\\Snow",
                                              "Terrain\\Sand",
                                              "Terrain\\Lava",
                                              "Terrain\\Lava"};
               FogData[] fogData = new FogData[] {new FogData(new Vector3(0.7f, 1f, 0.8f), 30, 450),
                                              new FogData(new Vector3(0.3f, 0.3f, 0.35f), 30, 450),
                                              new FogData(new Vector3(1f, 0.8f, 0.1f), -200, 1500),
                                              new FogData(new Vector3(1f, 0.6f, 0.1f), 20, 450),
                                              new FogData(new Vector3(0.70f, 0.32f, 0.0f), 10, 420)};

            List<string> listNomMusic = new List<string>() { "m_act1", "m_act2", "m_act3", "m_act4", "m_act4" };

            TexturesSkybox.Add(new string[]{"DarkBox\\topdark",
                                              "DarkBox\\frontdark",
                                               "DarkBox\\backdark",
                                               "DarkBox\\leftdark",
                                               "DarkBox\\rightdark",
                                               "DarkBox\\botdark"} );

            string[] SpellIcons = new string[] {"HUD\\Spells\\ChaosBoltButton",
                                                      "HUD\\Spells\\PlasmaFieldButton",
                                                      "HUD\\Spells\\SlowTimeButton",
                                                      "HUD\\Spells\\SpellstealButton"};

            string[] SpellIconsAlt = new string[] {null,
                                                         null,
                                                         "HUD\\Spells\\TimeLockButton",
                                                         null};

            string[] SpellTooltips = new string[] {"Content\\Text\\Firebolt.txt",
                                                   "Content\\Text\\Nova.txt",
                                                   "Content\\Text\\SlowMissiles.txt",
                                                   "Content\\Text\\MindControl.txt"};

            string[] SpellTooltipsAlt = new string[] {null,
                                                      null,
                                                      "Content\\Text\\SlowMissilesAlt.txt",
                                                      null};

            //Vector3 positionCaméra = new Vector3(0, 10, 0);

            GestionInput3D = new InputManager3D(Jeu, this);
            MapManager = new TerrainManager(Jeu, this, NB_ZONES, new Vector2(ÉTENDUE_MAP, ÉTENDUE_MAP), TexturesTerrain, fogData, GestionnaireDeTextures.Find("Terrain\\heightmap3.0"), listNomMusic);
            BaldorLeBrave = new Héros(Jeu, this, "dude", 0.2f, 1f,
                                       new Vector3(300, 0, -50), new Vector3(0, MathHelper.PiOver2, 0), new Vector3(0, -MathHelper.PiOver2, 0),
                                       "Baldor Le Brave",
                                       35f, MathHelper.Pi * 4, true,
                                       42, 18, 0, 5, 3, 0.8f,
                                       "nova");
            CaméraJeu = new CaméraThirdPerson(Jeu, GestionInput3D, positionCaméra, BaldorLeBrave, Vector3.Up);
            Box = new Skybox(Jeu, this, "skybox2", TexturesSkybox[0], new Vector3(0,-1,0));
            FinalBoss = new Boss(Jeu, this, BaldorLeBrave, "Cyclops\\terrorwurm", 0.2f, ÉCHELLE_BOX_WURM, new Vector3(ÉTENDUE_MAP/2, 0, -ÉTENDUE_MAP*4.6f), new Vector3(0, 0, 0), new Vector3(0, -MathHelper.PiOver2, 0), "Demon Grostesque", 30f, MathHelper.Pi * 4, false, 400, 3, 6, 4, 1f, false, 15, 70, 42, 0);

            HeadsUpDisplay = new HUD(Jeu, this, BaldorLeBrave, "HUD\\HUD", "HUD\\Vie", "HUD\\Mana", "HUD\\Exp", 2.5f, SpellIcons, SpellIconsAlt, "HighTowerText", "HUD\\TextBackground", SpellTooltips, SpellTooltipsAlt);
            ProjManager = new ProjectileManager(Jeu, this, "OrangeBall", 0.01f);
            MonstManager = new MonsterManager(Jeu, this);
            CollisionManager = new CollisionManager(Jeu, this);
            BarresManager = new HealthBarManager(Jeu, this, "HUD\\healthbar", "HUD\\healthbarbg", "Stroke");
            NovManager = new NovaManager(Jeu, this);
            DoodManager = new DoodadManager (Jeu, this);

            ListeDesÉléments.Add(GestionInput3D);
            ListeDesÉléments.Add(new Afficheur3D(Jeu));

            ListeDesÉléments.Add(CaméraJeu);
            ListeDesÉléments.Add(Box);
            ListeDesÉléments.Add(MapManager);

            ListeDesÉléments.Add(BaldorLeBrave);
            ListeDesÉléments.Add(MonstManager);

            ListeDesÉléments.Add(FinalBoss);
            ListeDesÉléments.Add(ProjManager);
            ListeDesÉléments.Add(NovManager);
            ListeDesÉléments.Add(DoodManager);
            ListeDesÉléments.Add(CollisionManager);
            ListeDesÉléments.Add(HeadsUpDisplay);
            //ListeDesÉléments.Add(ExpBar);
            ListeDesÉléments.Add(BarresManager);
            ListeDesÉléments.Add(new AfficheurFPS(Jeu, "Arial"));

            base.Initialize();

            CréerDoodads();
            CréerMonstres();
        }