示例#1
0
        public Ecran_Titre() : base("TNTMan", null)
        {
            Size resolution = Gfx.getResolution();

            arrierePlan = Gfx.images["fond_ecran"];
            boutons.Add(new Bouton(0, resolution.Width / 2 - 100, resolution.Height / 2 - 100, 18, "Nouvelle Partie"));
            boutons.Add(new Bouton(1, resolution.Width / 2 - 100, resolution.Height / 2 - 50, 18, "Instructions"));
            //boutons.Add(new Bouton(2, resolution.Width / 2 - 100, resolution.Height / 2, 18, "Options"));
            boutons.Add(new Bouton(100, resolution.Width / 2 - 100, resolution.Height / 2 + 150, 18, "Quitter"));
            Sfx.ArreterJouerMusique();
            Sfx.JouerMusique("titre");
            boutonSel = 0;
        }
示例#2
0
        public Session(int nb_joueurs, int id_map, int nb_manches, long temps_imparti, long temps_mort_subite)
        {
            PointApparition pointApparition = null;

            musique = @"jeu_" + Program.random.Next(1, 3);
            joueurs = new List <Joueur>();
            map     = new Map();
            map.chargerMap(id_map);
            for (int i = 0; i < nb_joueurs; i++)
            {
                pointApparition = map.pointApparitions[i];
                switch (i)
                {
                case 0:
                    joueurs.Add(new Joueur(1, 0.5f + pointApparition.X, 0.5f + pointApparition.Y, map, SDL.SDL_Scancode.SDL_SCANCODE_W, SDL.SDL_Scancode.SDL_SCANCODE_S, SDL.SDL_Scancode.SDL_SCANCODE_A, SDL.SDL_Scancode.SDL_SCANCODE_D, SDL.SDL_Scancode.SDL_SCANCODE_E));
                    break;

                case 1:
                    joueurs.Add(new Joueur(2, 0.5f + pointApparition.X, 0.5f + pointApparition.Y, map, SDL.SDL_Scancode.SDL_SCANCODE_UP, SDL.SDL_Scancode.SDL_SCANCODE_DOWN, SDL.SDL_Scancode.SDL_SCANCODE_LEFT, SDL.SDL_Scancode.SDL_SCANCODE_RIGHT, SDL.SDL_Scancode.SDL_SCANCODE_RETURN));
                    break;

                case 2:
                    joueurs.Add(new Joueur(3, 0.5f + pointApparition.X, 0.5f + pointApparition.Y, map, SDL.SDL_Scancode.SDL_SCANCODE_U, SDL.SDL_Scancode.SDL_SCANCODE_J, SDL.SDL_Scancode.SDL_SCANCODE_H, SDL.SDL_Scancode.SDL_SCANCODE_K, SDL.SDL_Scancode.SDL_SCANCODE_I));
                    break;

                case 3:
                    joueurs.Add(new Joueur(4, 0.5f + pointApparition.X, 0.5f + pointApparition.Y, map, SDL.SDL_Scancode.SDL_SCANCODE_KP_5, SDL.SDL_Scancode.SDL_SCANCODE_KP_2, SDL.SDL_Scancode.SDL_SCANCODE_KP_1, SDL.SDL_Scancode.SDL_SCANCODE_KP_3, SDL.SDL_Scancode.SDL_SCANCODE_KP_6));
                    break;

                default:
                    Program.MessageErr("Nombre de joueurs incorrect!");
                    break;
                }
            }
            foreach (var joueur in joueurs)
            {
                map.ajoutEntite(joueur);
            }
            mancheActuelle   = 1;
            nbManches        = nb_manches;
            tempsDebutManche = DateTime.Now;
            tempsImparti     = temps_imparti;
            tempsMortSubite  = temps_mort_subite;
            Sfx.ArreterJouerMusique();
            Sfx.JouerMusique(musique);
        }
示例#3
0
        void finDeLaManche()
        {
            PointApparition pointApparition = null;

            // si un joueur gagne
            if (raisonFinManche > 0)
            {
                joueurs[raisonFinManche - 1].incrementerVictoire();
            }

            if (mancheActuelle < nbManches)
            {
                map.dechargerMap();
                // On charge la map pour la prochaine manche
                map.chargerMap(map.getId());
                foreach (var joueur in joueurs)
                {
                    pointApparition = map.pointApparitions[joueur.getId() - 1];
                    joueur.reapparaitre(0.5f + pointApparition.X, 0.5f + pointApparition.Y);
                    map.ajoutEntite(joueur);
                }

                // On réinitialise la raison de la fin de manche
                raisonFinManche = 0;
                // On réinitialise le temps
                tempsDebutManche = DateTime.Now;
                // On passe à la manche suivante
                mancheActuelle++;
                // Relancer la musique
                Sfx.JouerMusique(musique);
            }
            else
            {
                // fin de la partie
                Gfx.changerEcran(new Ecran_Score(joueurs));
            }
        }