예제 #1
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();
        }
예제 #2
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();
        }
예제 #3
0
        protected override void Initialize()
        {
            ÉtatJeu            = GameState.MENU;
            EstManetteUtilisée = false;
            Vector3 positionCaméra = new Vector3(0, 20, 125);
            Vector3 cibleCaméra    = new Vector3(0, 0, 0);

            LumièreObjet              = new Lumière(this, positionCaméra, Vector3.One, RAYON_LUMIÈRE, INTENSITÉ_LUMINEUSE, Vector3.One, Vector4.One / 10);
            GrilleDeJeu               = new GrilleCollision(this, new Vector2(DIMENSION_TERRAIN, DIMENSION_TERRAIN), 5.22449f / 2f, "Labyrinthe", 0);
            CarteJeu                  = new Carte(this, new Vector3(DIMENSION_TERRAIN, 25, DIMENSION_TERRAIN), "Labyrinthe", LumièreObjet);
            GestionnaireDeFonts       = new RessourcesManager <SpriteFont>(this, "Fonts");
            GestionnaireDeTextures    = new RessourcesManager <Texture2D>(this, "Textures");
            GestionnaireDeModèles     = new RessourcesManager <Model>(this, "Models");
            GestionnaireDeShaders     = new RessourcesManager <Effect>(this, "Effects");
            GestionnaireDeSoundEffect = new RessourcesManager <SoundEffect>(this, "Sounds");
            GestionnaireMusique       = new RessourcesManager <Song>(this, "Songs");
            GestionSprites            = new SpriteBatch(GraphicsDevice);
            GestionInput              = new InputManager(this);
            GestionSounds             = new SoundManager(this);
            GestionnaireDeCollisions  = new CollisionManager(this);
            CaméraJeu                 = new Caméra(this);
            Serveur      = new Server(this, PORT);
            LampeDePoche = new LampeTorche(this, 6f, 45f);

            Services.AddService(typeof(LampeTorche), LampeDePoche);
            Components.Add(GestionSounds);
            Components.Add(GestionInput);
            Components.Add(LampeDePoche);
            Components.Add(CaméraJeu);
            Components.Add(new Afficheur3D(this));
            Components.Add(CarteJeu);
            Components.Add(GrilleDeJeu);


            Components.Add(new Zombie(this, "fml4", 1, new Vector3(-5.224495f / 2f, 0, -5.224495f / 2f), "Lambent_Femal", new Vector3(-MathHelper.PiOver2, 0, 0), INTERVALLE_MAJ_STANDARD, "zombies01", "Marche Zombie", 100f, 0));
            Components.Add(new Zombie(this, "fmj1", 1, new Vector3(5.224495f / 2f, 0, -5.224495f / 2f), "Lambent_Femal", new Vector3(-MathHelper.PiOver2, 0, 0), INTERVALLE_MAJ_STANDARD, "zombies01", "Default Take", 75f, 1));
            Components.Add(new Player(this, "Superboy", "Default Take", "Lambent_Femal", 1, new Vector3(-MathHelper.PiOver2, 0, 0), new Vector3(-5, 0.5f, -5), 15f, "jump", "landing", "walk", "walk_slow", PlayerIndex.One, true, PORT, IP));
            Components.Add(new ObjetTournoyant(this, "key", 0.01f, new Vector3(0, MathHelper.PiOver2, 0), new Vector3(-2.612247f, -3.25f, 10f), 1 / 60f));
            Components.Add(new AfficheurFPS(this, INTERVALLE_CALCUL_FPS, "Arial20"));
            Components.Add(new Menu(this));
            Components.Add(Serveur);

            Services.AddService(typeof(RessourcesManager <SpriteFont>), GestionnaireDeFonts);
            Services.AddService(typeof(RessourcesManager <Texture2D>), GestionnaireDeTextures);
            Services.AddService(typeof(RessourcesManager <Model>), GestionnaireDeModèles);
            Services.AddService(typeof(RessourcesManager <Effect>), GestionnaireDeShaders);
            Services.AddService(typeof(RessourcesManager <SoundEffect>), GestionnaireDeSoundEffect);
            Services.AddService(typeof(RessourcesManager <Song>), GestionnaireMusique);
            Services.AddService(typeof(InputManager), GestionInput);
            Services.AddService(typeof(SoundManager), GestionSounds);
            Services.AddService(typeof(Caméra), CaméraJeu);
            Services.AddService(typeof(CollisionManager), GestionnaireDeCollisions);
            Services.AddService(typeof(SpriteBatch), GestionSprites);
            Services.AddService(typeof(GrilleCollision), GrilleDeJeu);
            Services.AddService(typeof(Pathfinder), new Pathfinder(this));
            Services.AddService(typeof(Carte), CarteJeu);
            Services.AddService(typeof(Server), Serveur);

            base.Initialize();

            //GestionSounds.Play("backgroundMusic");
            //GestionSounds.Play("First_Sentence", false, 0.5f);

            //wat?
            foreach (GameComponent gc in Components.Where(x => x is IGame))
            {
                gc.Enabled = false;
                if (gc is DrawableGameComponent)
                {
                    (gc as DrawableGameComponent).Visible = false;
                }
            }
        }