public Avatar_(Game1 jeu, string nomImage, Vector3 position, Vector3 dimension, float intervalMAJ, int indexJoueur, IOManager input) : base(jeu, nomImage, position, dimension, intervalMAJ) { IndexJoueur = indexJoueur; Input = input; Arme = null; }
public Avatar(Game1 jeu, string nomImage,Vector2 position,Vector2 dimension,float IntervalMAJ, int indexJoueur, IOManager input ) :base(jeu,nomImage,position,dimension,IntervalMAJ) { IndexJoueur = indexJoueur; Input = input; VitesseJoueur = 0.5f; HauteurActuelle = 0; Arme = null; }
protected override void Initialize() { Vector2 DimensionÉcran = new Vector2(GameConstants.WindowWidth, GameConstants.WindowHeight); AfficheurFPS_ a = new AfficheurFPS_(this, 1 / 60f); F1 = new Fusil(this, "balle", Vector2.Zero, new Vector2(15, 15), new Vector2(0, -15)); cam = new Camera2d(); cam.Pos = Vector2.Zero; GestionnaireTextures = new RessourcesManager<Texture2D>(this, "Textures"); GestionnaireFonts = new RessourcesManager<SpriteFont>(this, "Fonts"); GestionnaireInput = new InputManager(this); spriteBatch = new SpriteBatch(GraphicsDevice); Services.AddService(typeof(RessourcesManager<Texture2D>), GestionnaireTextures); Services.AddService(typeof(RessourcesManager<SpriteFont>), GestionnaireFonts); Services.AddService(typeof(InputManager), GestionnaireInput); Services.AddService(typeof(SpriteBatch), spriteBatch); Services.AddService(typeof(Camera2d), cam); ListeComposantes = new List<IColisionable>(); ioManagerJ1 = new IOManager(this, 1); J1 = new Avatar(this, "hitman1_stand", DimensionÉcran / 2, new Vector2(30, 30), 1f / 1000, 1, ioManagerJ1); InfoJ1 = new InformationJoueur(this, "tile_12", new Vector2(100, 50), new Vector2(200, 100), J1); Components.Add(GestionnaireInput); Components.Add(a); //Components.Add(J1); Components.Add(ioManagerJ1); //-------------------------------- Test physique------------------// ListePhysique = new List<EntitéPhysique>(); T1 = new Tile(this, "CielÉtoilé", new Vector3(DimensionÉcran.X / 2, DimensionÉcran.Y / 2, 0), new Vector3(DimensionÉcran.X / 2, DimensionÉcran.Y / 2, 0), 1 / 60f, 0.2f); T2 = new Tile(this, "tile_12", new Vector3(0, DimensionÉcran.Y / 2, 1f), new Vector3(DimensionÉcran.X / 2, DimensionÉcran.Y / 2, 0), 1 / 60f,0.9f); J1Test = new Avatar_(this, "balle", new Vector3(DimensionÉcran.X / 2, DimensionÉcran.Y / 2, 5f), new Vector3(30, 30, 1), 1 / 60f, 1, ioManagerJ1); Components.Add(J1Test); Components.Add(T1); Components.Add(T2); ListePhysique.Add(J1Test); ListePhysique.Add(T1); ListePhysique.Add(T2); //----------------------------------------------------------------// base.Initialize(); F1.Initialize(); //les classes que je ne veux pas mettre en components pour que ne soient pas automatiquement updater/dessiner InfoJ1.Initialize(); }
public Avatar(Game1 jeu, string nomModele, Vector3 position, Vector3 dimension, float IntervalMAJ, int vieJoueur, int indexJoueur, IOManager input) : base(jeu, nomModele, position, dimension, IntervalMAJ, vieJoueur) { IndexJoueur = indexJoueur; Input = input; }
//void InitialiserAvatars() //{ // ListeAvatar = new List<Avatar_>(); // ListeAvatar.Add(new Avatar_(this, "unicorn", new Vector3(0, 10, -1), 1 / 60f, 1, manager1)); // ListeAvatar.Add(new Avatar_(this, "unicorn", new Vector3(0, 10, -1), 2 / 60f, 2, manager2)); // ListeAvatar.Add( new Avatar_(this, "unicorn", new Vector3(0, 10, -1), 3 / 60f, 2, manager2)); // ListeAvatar.Add(new Avatar_(this, "unicorn", new Vector3(0, 10, -1), 4 / 60f, 2, manager2)); //} /// <summary> /// Allows the game to perform any initialization it needs to before starting to run. /// This is where it can query for any required services and load any non-graphic /// related content. Calling base.Initialize will enumerate through any components /// and initialize them as well. /// </summary> protected override void Initialize() { NbJoueurs = 2; TestView1 = new Viewport(0, 0, GameConstants.WindowWidth / 2, GameConstants.WindowHeight); TestView2 = new Viewport(GameConstants.WindowWidth / 2, 0, GameConstants.WindowWidth / 2, GameConstants.WindowHeight); ModelManager ManagerDeModele = new ModelManager(this); IOManager manager1 = new IOManager(this,1); IOManager manager2 = new IOManager(this, 2); CubeColoré CubeBlanc = new Sol(this, 1f, Vector3.Zero, Vector3.Zero, Color.White, new Vector3(20, 1, 10), 1 / 60f); CubeColoré CubeRouge = new Sol(this, 1f, Vector3.Zero, new Vector3(0,1,-5), Color.Red, new Vector3(20, 1.5f, 10), 1 / 60f); CubeColoré CubeBleu = new Sol(this, 1f, Vector3.Zero, new Vector3(0, 1, 10), Color.Blue, new Vector3(20, 1.5f, 10), 1 / 60f); CubeColoré CubeSol = new Sol(this, 1f, Vector3.Zero, new Vector3(0, -3, 0), Color.Yellow, new Vector3(200, 2, 200), INTERVALLE_CALCUL_STANDARD); licorne = new Avatar_(this, "cubefache", new Vector3(0, 10, -1), 1 / 60f, 1, manager1); Avatar_ licorne2 = new Avatar_(this, "unicorn", new Vector3(0, 10, -1), 1 / 60f, 2, manager2); ManagerÉcranDEBUG = new ScreenManager(this, Vector2.Zero); Vector3 positionCaméra = new Vector3(10,10,10); Vector3 positionObjet = new Vector3(0, 0, 0); Vector3 rotationObjet = new Vector3(0, MathHelper.PiOver2, 0); GestionnaireDeFonts = new RessourcesManager<SpriteFont>(this, "Fonts"); GestionnaireDeTextures = new RessourcesManager<Texture2D>(this, "Textures"); GestionnaireDeModèles = new RessourcesManager<Model>(this, "Models"); spriteBatch = new SpriteBatch(GraphicsDevice); GestionInput = new InputManager(this); CaméraJeu = new CaméraFixe(this,new Vector3(10,10,10),Vector3.Zero,Vector3.Up); Caméra1 = new CaméraAvatar(this, licorne.Position, Vector3.Up, licorne,TestView1); Caméra2 = new CaméraAvatar(this, licorne.Position, Vector3.Up, licorne2, TestView2); defaut = GraphicsDevice.Viewport; //Components.Add(new ArrièrePlanDéroulant(this, "CielÉtoilé", INTERVALLE_CALCUL_STANDARD)); //Components.Add(new ObjetDeBase(this, "unicorn", 10, rotationObjet, positionObjet)); Components.Add(new AfficheurFPS(this, "Arial20", Color.Chartreuse, INTERVALLE_CALCUL_FPS)); Components.Add(new Afficheur3D(this)); Components.Add(GestionInput); Components.Add(Caméra1); Components.Add(Caméra2); Components.Add(CaméraJeu); //Components.Add(CubeBlanc); //Components.Add(CubeRouge); //Components.Add(CubeBleu); Components.Add(manager1); Components.Add(manager2); Components.Add(ManagerDeModele); //Components.Add(licorne); //Components.Add(licorne2); ManagerDeModele.AjouterModele(CubeBlanc); ManagerDeModele.AjouterModele(CubeBleu); ManagerDeModele.AjouterModele(CubeRouge); ManagerDeModele.AjouterModele(CubeSol); ManagerDeModele.AjouterModele(licorne); ManagerDeModele.AjouterModele(licorne2); ManagerDeModele.AjouterCaméra(Caméra1); ManagerDeModele.AjouterCaméra(Caméra2); Services.AddService(typeof(RessourcesManager<SpriteFont>), GestionnaireDeFonts); Services.AddService(typeof(RessourcesManager<Texture2D>), GestionnaireDeTextures); Services.AddService(typeof(RessourcesManager<Model>), GestionnaireDeModèles); Services.AddService(typeof(InputManager), GestionInput); Services.AddService(typeof(Caméra), CaméraJeu); Services.AddService(typeof(SpriteBatch), spriteBatch); base.Initialize(); ListePhysique = new List<ICollisionable>(); ListePhysique.Add(CubeBlanc as ICollisionable); ListePhysique.Add(CubeRouge as ICollisionable); ListePhysique.Add(licorne as ICollisionable); ListePhysique.Add(CubeBleu as ICollisionable); ListePhysique.Add(licorne2 as ICollisionable); ListePhysique.Add(CubeSol as ICollisionable); ManagerÉcranDEBUG.Initialize(); ManagerÉcranDEBUG.AjouterItem(licorne); ManagerÉcranDEBUG.AjouterItem(licorne2); CubeBlanc.InitialiserSommets(Color.White); CubeBleu.InitialiserSommets(Color.Blue); CubeRouge.InitialiserSommets(Color.Red); }
public Avatar(Game1 jeu, DescriptionAvatar description , PlayerIndex indexJoueur, IOManager input) : base(jeu,description) { IndexJoueur = indexJoueur; Input = input; }