Ejemplo n.º 1
0
        protected override void LoadContent()
        {
            GestionInput           = Game.Services.GetService(typeof(InputManager)) as InputManager;
            GestionSons            = Game.Services.GetService(typeof(SoundManager)) as SoundManager;
            GestionCollisions      = Game.Services.GetService(typeof(CollisionManager)) as CollisionManager;
            CaméraJeu              = Game.Services.GetService(typeof(Caméra)) as Caméra;
            GestionnaireDeModèles  = Game.Services.GetService(typeof(RessourcesManager <Model>)) as RessourcesManager <Model>;
            GestionnaireDeTextures = Game.Services.GetService(typeof(RessourcesManager <Texture2D>)) as RessourcesManager <Texture2D>;
            LampeDePoche           = Game.Services.GetService(typeof(LampeTorche)) as LampeTorche;
            CalculerMonde();

            Modele = GestionnaireDeModèles.Find(NomModel);
            TransformationsModèle = new Matrix[Modele.Bones.Count];
            Habit = GestionnaireDeTextures.Find(NomTexture);

            SkinningData skinningData = Modele.Tag as SkinningData;

            if (skinningData == null)
            {
                throw new InvalidOperationException
                          ("This model does not contain a SkinningData tag.");
            }

            // Create an animation player, and start decoding an animation clip.
            AnimationPlayer = new AnimationPlayer(skinningData);

            AnimationClip clip = skinningData.AnimationClips[NomAnim];

            AnimationPlayer.StartClip(clip);
            base.LoadContent();
        }
 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;
 }
Ejemplo n.º 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;
                }
            }
        }