Exemple #1
0
 public IdentificateurPersonnage(Game jeu, Personnage personnage)
     : base(jeu)
 {
     PersonnageÀIdentifier = personnage;
     PtsVieMax             = PersonnageÀIdentifier.PtsDeVie;
     PtsViePersonnage      = PersonnageÀIdentifier.PtsDeVie;
     DéterminerNomImage();
     DéterminerPosition();
     ZoneAffichage   = new Rectangle(0, 0, Game.Window.ClientBounds.Width, Game.Window.ClientBounds.Height / 15);
     AfficheurPtsVie = new TexteCentré(Game, ":" + PtsViePersonnage.ToString() + "/" + PtsVieMax.ToString(), "Arial20",
                                       new Rectangle((int)Position.X + 2 * Game.Window.ClientBounds.Width / (3 * NB_CASES), (int)Position.Y, Game.Window.ClientBounds.Width / NB_CASES, Game.Window.ClientBounds.Height / 15),
                                       Color.Red, 0);
     AfficheurPtsVie.DrawOrder = (int)OrdreDraw.AVANT_PLAN;
     Game.Components.Add(AfficheurPtsVie);
 }
Exemple #2
0
 public override void Update(GameTime gameTime)
 {
     if (PtsViePersonnage != PersonnageÀIdentifier.PtsDeVie)
     {
         PtsViePersonnage = PersonnageÀIdentifier.PtsDeVie;
         AfficheurPtsVie.ModifierTexte(":" + PtsViePersonnage.ToString() + "/" + PtsVieMax.ToString());
     }
     if (DimensionFenêtre != Game.Window.ClientBounds)
     {
         Position         = new Vector2(Position.X * Game.Window.ClientBounds.Width / DimensionFenêtre.Width, Position.Y * Game.Window.ClientBounds.Height / DimensionFenêtre.Height);
         DimensionFenêtre = Game.Window.ClientBounds;
     }
 }