protected override void Initialize()
      {
         const int DIMENSION_TERRAIN = 256;
         Vector2 étenduePlan = new Vector2(DIMENSION_TERRAIN, DIMENSION_TERRAIN);
         Vector2 charpentePlan = new Vector2(4, 3);
         Vector3 positionCaméra = new Vector3(0, 20, 125);
         Vector3 cibleCaméra = new Vector3(0, 0, 0);
         Vector3 positionARC170 = new Vector3(25, 15, 0);
         Vector3 positionBiplan = new Vector3(20, 10, 0);
         Vector3 positionFeisar = new Vector3(20, 15, 20);
         Vector3 positionCylindre1 = new Vector3(-90, 10, -90);
         Vector3 positionCylindre2 = new Vector3(-20, 10, -20);
         Vector3 positionCylindre3 = new Vector3(-90, 10, 90);
         ListeMurs = new List<GameComponent>();

         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");
         GestionnaireDeSong = new RessourcesManager<Song>(this, "Songs");
         GestionInput = new InputManager(this);
         GestionSounds = new SoundManager(this);
         CaméraJeu = new Caméra(this, new Vector3(-105f, 0f, 4f), new Vector3(0f,(float)Math.PI/2f,0f), 50f, "jump", "landing","walk", "backgroundMusic", "walk_slow");

         Components.Add(GestionSounds);
         Components.Add(GestionInput);
         Components.Add(CaméraJeu);

         Components.Add(new Afficheur3D(this));

         Components.Add(new Carte(this, new Vector3(DIMENSION_TERRAIN, 25, DIMENSION_TERRAIN), "Terrain"));

         //Components.Add(new PlanTexturé(this, 1f, new Vector3(0, MathHelper.PiOver2, 0), new Vector3(-DIMENSION_TERRAIN / 2, DIMENSION_TERRAIN / 2, 0), étenduePlan, charpentePlan, "CielGauche", INTERVALLE_MAJ_STANDARD));
         //Components.Add(new PlanTexturé(this, 1f, new Vector3(0, -MathHelper.PiOver2, 0), new Vector3(DIMENSION_TERRAIN / 2, DIMENSION_TERRAIN / 2, 0), étenduePlan, charpentePlan, "CielDroite", INTERVALLE_MAJ_STANDARD));
         //Components.Add(new PlanTexturé(this, 1f, Vector3.Zero, new Vector3(0, DIMENSION_TERRAIN / 2, -DIMENSION_TERRAIN / 2), étenduePlan, charpentePlan, "CielAvant", INTERVALLE_MAJ_STANDARD));
         //Components.Add(new PlanTexturé(this, 1f, new Vector3(0, -MathHelper.Pi, 0), new Vector3(0, DIMENSION_TERRAIN / 2, DIMENSION_TERRAIN / 2), étenduePlan, charpentePlan, "CielArrière", INTERVALLE_MAJ_STANDARD));
         //Components.Add(new PlanTexturé(this, 1f, new Vector3(MathHelper.PiOver2, 0, 0), new Vector3(0, DIMENSION_TERRAIN - 1, 0), étenduePlan, charpentePlan, "CielDessus", INTERVALLE_MAJ_STANDARD));
         
         Components.Add(new Cylindre(this, 1f, new Vector3(0, MathHelper.PiOver2, 0), positionCylindre1, new Vector2(5f, 10f), new Vector2(30, 30), "old_brick_01", INTERVALLE_MAJ_STANDARD));
         
         Services.AddService(typeof(Random), new Random());
         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>), GestionnaireDeSong);
         Services.AddService(typeof(InputManager), GestionInput);
         Services.AddService(typeof(SoundManager), GestionSounds);
         Services.AddService(typeof(Caméra), CaméraJeu);
         GestionSprites = new SpriteBatch(GraphicsDevice);
         Services.AddService(typeof(SpriteBatch), GestionSprites);

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

      }
        public bool CollisionJoueurs(Caméra joueurA, Caméra joueurB)
        {
            Vector3 distance = joueurA.ZoneCollision.Center - joueurB.ZoneCollision.Center;
            float normeDist = distance.Length();
            float somme = joueurA.ZoneCollision.Radius + joueurB.ZoneCollision.Radius;

            return somme > normeDist;
        }
 public MatériauÉclairé(Caméra caméraJeu, Lumière lumièreJeu, Texture2D bumpMap, Vector3 couleurAmbiante, Vector4 couleurDiffuse,
                        Vector3 couleurEmissive, Vector3 couleurSpéculaire, float puissanceSpéculaire, LampeTorche lampe)
     : base(caméraJeu)
 {
     LumièreJeu               = lumièreJeu;
     BumpMap                  = bumpMap;
     CouleurLumièreAmbiante   = couleurAmbiante;
     CouleurLumièreDiffuse    = couleurDiffuse;
     CouleurLumièreEmissive   = couleurEmissive;
     CouleurLumièreSpéculaire = couleurSpéculaire;
     PuissanceSpéculaire      = puissanceSpéculaire;
     LampeDePoche             = lampe;
 }
        public bool CollisionJoueurMur(Caméra joueur, CubeColoré mur)
        {
            bool estEnCollision = false;
            Vector3 distance = joueur.ZoneCollision.Center - mur.ZoneVerifCollision.Center;
            float normeDist = distance.Length();
            float somme = joueur.ZoneCollision.Radius + mur.ZoneVerifCollision.Radius;

            if (somme > normeDist)
            {
                estEnCollision = joueur.ZoneCollision.Intersects(mur.ZoneCollision);
            }

            return estEnCollision;
        }
Ejemplo n.º 5
0
        public override void Initialize()
        {
            CréerPositionsSoldats();

            Flag = new Flag(Game, 1F, Vector3.Zero, new Vector3(PosFlag.X, 5, PosFlag.Z), new Vector2(1, 1), "FeuFollet", new Vector2(20, 1), 1f / 60);
            Game.Components.Add(Flag);
            CréerSoldats();
            CalculerMoyennePosition();
            AnciennePosition  = MoyennePosition;
            AfficheurNbVivant = new AfficheurNb(Game, Color.Red, NbVivants, new Vector2(0, Game.Window.ClientBounds.Height - MARGE_BAS), "Nombre Soldats :", INTERVALLE_STANDARD);
            Game.Components.Add(AfficheurNbVivant);

            GestionInput = Game.Services.GetService(typeof(InputManager)) as InputManager;
            base.Initialize();
            Caméra.SetPosCaméra(new Vector3(0, 9f, PosFlag.Z));
        }
Ejemplo n.º 6
0
        void CréerHitboxCaméra()
        {
            BoundingSphere temp            = new BoundingSphere();
            bool           firstTime       = true;
            int            soldatsComptées = 0;;

            for (int i = 0; i < Armés.GetLength(0); i++)
            {
                for (int j = 0; j < Armés.GetLength(1); j++)
                {
                    if (soldatsComptées <= NbVivants)
                    {
                        if (Armés[i, j] != null)
                        {
                            if (Armés[i, j].EstVivant)
                            {
                                if (EstDansLimiteTerrain(Armés[i, j]))
                                {
                                    if (firstTime)
                                    {
                                        temp      = BoundingSphere.CreateFromBoundingBox(Armés[i, j].HitBoxGénérale);
                                        firstTime = false;
                                        soldatsComptées++;
                                    }
                                    temp = BoundingSphere.CreateMerged(temp, BoundingSphere.CreateFromBoundingBox(Armés[i, j].HitBoxGénérale));
                                    soldatsComptées++;
                                }
                            }
                        }
                    }
                }
            }


            Caméra.DonnerBoundingSphere(BoundingSphere.CreateMerged(temp, Flag.ViewFlag));
        }
 protected override void LoadContent()
 {
     CaméraJeu = Game.Services.GetService(typeof(Caméra)) as Caméra;
     base.LoadContent();
 }
 public void ChangerCamera(Caméra caméra)
 {
    CaméraActuelle = caméra;
 }
Ejemplo n.º 9
0
 public void Draw(Caméra caméra)
 {
     if (Grille != null && MontrerGizmosSurGrille)
     {
         Node nodeJoueur = NodePositionMonde(PositionJoueur);
         Node nodeActuelle = NodePositionMonde(PositionActuelle);
         for (int x = 0; x < Grille.GetLength(0); ++x)
         {
             for (int y = 0; y < Grille.GetLength(1); ++y)
             {
                 if (Path != null)
                 {
                     if (Path.Any(n => n.PositionMonde == TableauCarréColoré[x, y].Position && n == nodeJoueur))
                     {
                         TableauCarréColoré[x, y].InitialiserSommets(Color.Green);
                     }
                     else if (TableauCarréColoré[x, y].Position == nodeActuelle.PositionMonde)//Path.Any(n => n.PositionMonde == TableauCarréColoré[x, y].Position && n == nodeActuelle))
                     {
                         TableauCarréColoré[x, y].InitialiserSommets(Color.Yellow);
                     }
                     else if (Path.Any(n => n.PositionMonde == TableauCarréColoré[x, y].Position))//.PositionMonde == TableauCarréColoré[x, y].Position)
                     {
                         TableauCarréColoré[x, y].InitialiserSommets(Color.Blue);
                     }
                     else if (Grille[x, y].EstSurfacePourMarcher)
                     {
                         TableauCarréColoré[x, y].InitialiserSommets(Color.White);
                     }
                     else if (!Grille[x, y].EstSurfacePourMarcher)
                     {
                         TableauCarréColoré[x, y].InitialiserSommets(Color.Red);
                     }
                 }
                 TableauCarréColoré[x, y].Draw(caméra);
             }
         }
         //foreach (Node n in Grille)
         //{
         //CarréColoré carré = new CarréColoré(Game, 1f, Vector3.Zero, n.PositionMonde, n.EstSurfacePourMarcher ? Color.White : Color.Red, Vector3.One * (DiamètreNode - 0.1f), 3f);
         //carré.Initialize();
         //carré.Draw(gameTime);
         //Gizmos.color = n.EstSurfacePourMarcher ? Color.White : Color.Red;
         ////    if (nodeJoueur == n)
         ////    {
         ////        Gizmos.color = Color.Cyan;
         ////    }
         //Gizmos.DrawCube(n.PositionMonde, Vector3.One * (DiamètreNode - 0.1f));
         //}
     }
     //CréerGrille();
 }
Ejemplo n.º 10
0
 public void Draw(Caméra caméra)
 {
     EffetDeBase.World = GetMonde();
       EffetDeBase.View = caméra.Vue; //CaméraActuelle.Vue;
       EffetDeBase.Projection = caméra.Projection; //CaméraActuelle.Projection;
       foreach (EffectPass passeEffet in EffetDeBase.CurrentTechnique.Passes)
       {
       passeEffet.Apply();
       GraphicsDevice.DrawUserPrimitives<VertexPositionColor>(PrimitiveType.TriangleStrip, Sommets1, 0, NB_TRIANGLES);
       }
       //base.Draw(gameTime);
 }
Ejemplo n.º 11
0
 public void ChangerCamera(Caméra cam)
 {
     CaméraActuelle = cam;
       CaméraActuelle = base.CaméraJeu;
 }
Ejemplo n.º 12
0
 private void DéplacerCaméra()
 {
     CalculerPositionCaméra();
     DirectionCaméra = Monde.Forward - Monde.Backward;
     Caméra.Déplacer(PositionCaméra, Position, Vector3.Up);
 }
Ejemplo n.º 13
0
 public void AjouterCaméra(Caméra caméra)
 {
     ListeCamera.Add(caméra);
 }
Ejemplo n.º 14
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;
                }
            }
        }
Ejemplo n.º 15
0
 protected override void LoadContent()
 {
    CaméraJeu = Game.Services.GetService(typeof(Caméra)) as Caméra;
    base.LoadContent();
 }
 public Matériau(Caméra caméraJeu)
 {
     Monde     = Matrix.Identity;
     CaméraJeu = caméraJeu;
 }