Exemplo n.º 1
0
        protected override void LoadContent()
        {
            sbHUD               = new SpriteBatch(GraphicsDevice);
            spriteBatch         = new SpriteBatch(GraphicsDevice);
            spriteBatchMini     = new SpriteBatch(GraphicsDevice);
            spriteBatchMini2    = new SpriteBatch(GraphicsDevice);
            destrucTileList     = new List <Vector3>();
            entityList          = new List <Entity>();
            animationList       = new List <Animate>();
            particlesEngineList = new List <ParticleEngine>();
            particleList        = new List <Particles>();
            explosionReseau     = new List <Vector2>();

            switch (gameState)
            {
            case GameState.initialize:
                //Load Cursor Texture and Position

                personalFolder           = Environment.GetFolderPath(Environment.SpecialFolder.Personal) + "TDZ";
                cursor                   = Tools.LoadTexture("Others/cursor", Content);
                controles.cursorPosition = new Vector2();
                Langage.LoadLanguage();
                destroyTile = Tools.LoadTexture("SpriteTexture/destroyed", Content);

                #region Load Textures

                TexturesGame.LoadAmmo(Content);
                TexturesGame.LoadPlayers(Content);
                TexturesGame.LoadArmes(Content);
                TexturesGame.LoadItem(Content);
                TexturesGame.LoadImpact(Content);
                TexturesGame.Loadtest(Content);
                TexturesGame.LoadBonus(Content);
                TexturesGame.LoadIAs(Content);
                TexturesGame.LoadPlatForm(Content);
                TexturesGame.Loadtest(Content);
                TexturesGame.LoadSpeedUp(Content);
                TexturesGame.LoadBackgrounds(Content);

                #endregion Load Textures

                menu      = new Menu(Content, GraphicsDevice);
                font      = Tools.LoadFont("Fonts/AngryBirds/24", Content);
                GameOver  = Tools.LoadTexture("Menu/GameOver", Content);
                fondRadar = Tools.LoadTexture("Others/fondRadar", Content);
                HUDarmes  = Tools.LoadTexture("HUD/HUD_armes", Content);
                gameState = GameState.menu;
                sound     = new Sound(Content);

                Player player = new Player(new Vector2(0, 0), TexturesGame.PlayerTab[0], 0, GraphicsDevice, LoadWeapons.LoadKnife(Content), true, FlagsType.blue);
                menu = new Menu(Content, GraphicsDevice);
                try
                {
                    XmlSerializer serializer = new XmlSerializer(typeof(Opt));
                    FileStream    fs         = new FileStream(Environment.GetFolderPath(Environment.SpecialFolder.Personal) + "/TDZ/Options/OptionMenu", FileMode.Open);
                    XmlReader     reader     = XmlReader.Create(fs);
                    Opt           obj        = (Opt)serializer.Deserialize(reader);
                    fullScreenON = obj.Fullscreen;
                    menu.optionsMenu.toFullScreen = obj.Fullscreen;
                    soundON                = obj.SoundOn;
                    sound.playEffects      = soundON;
                    controles.controleTab  = obj.controleTab;
                    Langage.langueactuelle = obj.language;

                    if (obj.masterServerAdress != null)
                    {
                        ConnectMaster.MasterIPAdress = obj.masterServerAdress;
                    }
                    fs.Close();

                    XmlSerializer serializer2 = new XmlSerializer(typeof(SavPerso));
                    FileStream    fs2         = new FileStream(Environment.GetFolderPath(Environment.SpecialFolder.Personal) + "/TDZ/Sauvegardes/" + obj.name, FileMode.Open);
                    XmlReader     reader2     = XmlReader.Create(fs2);
                    SavPerso      obj2        = (SavPerso)serializer2.Deserialize(reader2);
                    player.Deserialise(obj2, Content);
                    fs2.Close();
                }
                catch (Exception)
                {
                    player = new Player(new Vector2(0, 0), TexturesGame.PlayerTab[0], 0, GraphicsDevice, LoadWeapons.LoadKnife(Content), true, FlagsType.blue);
                    player.ItemList.Add(LoadWeapons.LoadKnife(Content));
                }
                currentPlayer = player;
                solo          = new Solo(player.currentLevel, player);
                menu.LaunchMenuSound(sound);
                break;

            case GameState.editor:

                sound.soundPlayer.Stop();

                // Prepare the process to run
                ProcessStartInfo start = new ProcessStartInfo();
                // Enter the executable to run, including the complete path
                start.FileName = "./MapEditor.exe";
                // Do you want to show a console window?
                start.WindowStyle    = ProcessWindowStyle.Hidden;
                start.CreateNoWindow = true;

                // Run the external process & wait for it to finish
                using (Process proc = Process.Start(start))
                {
                    proc.WaitForExit();
                }


                gameState = GameState.menu;
                menu      = new Menu(Content, GraphicsDevice);
                menu.LaunchMenuSound(sound);
                break;

            case GameState.solo:

                sound.soundPlayer.Stop();

                //Load List Tirs and Texture
                shotsPlayer = new Shot();

                //Load Map
                LoadMap(menu.mapname + ".xml");
                LoadMapTextures();

                //Load Player Array
                hostPlayer = 0;
                LoadPlayer();
                players[hostPlayer].position = mapWorld.spawnPoint;
                players[hostPlayer].image    = TexturesGame.PlayerTab[players[hostPlayer].spritePerso];
                // LoadEnemy();
                LoadSurvivalEnemy();
                LoadItem();

                //Load HUD
                LoadHUD();

                background = new Background(Content, mapWorld);
                camera     = new Camera(players, hostPlayer, scaleNormValue, GraphicsDevice, mapWorld);

                break;

            case GameState.scenario:

                sound.soundPlayer.Stop();

                //Load List Tirs and Texture
                shotsPlayer = new Shot();

                //Load Map
                LoadMap(solo.currentMap + ".xml");
                LoadMapTextures();

                //Load Player Array
                solo.player.position = mapWorld.spawnPoint;
                hostPlayer           = 0;
                players = new List <Player>();
                players.Add(solo.player);
                entityList.Add(solo.player);

                Enemys = new List <Enemy>();

                for (int i = 0; i < mapWorld.IASpawnList.Count; i++)
                {
                    Enemys.Add(new Enemy(mapWorld.IASpawnList[i], TexturesGame.IATab[0], 100 + i, Content, LoadWeapons.LoadIAGun(Content), false, 0, GraphicsDevice));
                    Enemys[i].iaType = IAType.patrouille;
                    entityList.Add(Enemys[i]);
                    Enemys[i].attaque = currentPlayer.niveau * 0.1f;
                    Enemys[i].defense = 2 / currentPlayer.niveau;
                }

                LoadItem();

                //Load HUD
                LoadHUD();

                background = new Background(Content, mapWorld);
                camera     = new Camera(players, hostPlayer, scaleNormValue, GraphicsDevice, mapWorld);

                break;

            case GameState.multi:
                sound.soundPlayer.Stop();

                //Launch Network and Load Map
                mapWorld = new Map();
                client   = new Client(ConnectMaster.MasterIPAdress, Convert.ToInt32(menu.multiMenu.tmpserv.port), ref hostPlayer, mapWorld, Content, menu.multiMenu.tmpserv.mode);

                if (client.mode == ModeMulti.ctf)
                {
                    flags    = new Flag[2];
                    flags[0] = new Flag(mapWorld.drapeau2, Content, FlagsType.red);
                    flags[1] = new Flag(mapWorld.drapeau1, Content, FlagsType.blue);
                    foreach (Flag item in flags)
                    {
                        mapWorld.itemList.Add(item);
                    }
                }

                LoadMapTextures();

                //Platforms
                for (int i = 0; i < mapWorld.platFormList.Count; i++)
                {
                    entityList.Add(mapWorld.platFormList[i]);
                }

                //Load List Tirs and Texture
                shotsPlayer = new Shot();

                //Load Player Array
                LoadPlayer();
                SetCurrentPlayer();
                Enemys = new List <Enemy>();

                //Load HUD
                LoadHUD();

                background = new Background(Content, mapWorld);
                camera     = new Camera(players, hostPlayer, scaleNormValue, GraphicsDevice, mapWorld);

                break;

            default:
                break;
            }
        }
Exemplo n.º 2
0
        public static void CheckEvents(Player player, Map map, List <Vector3> destructTile, int host, Shot shots, Sound sound, ref String msg, Controles controles, List <Entity> entityList, List <Animate> animationList, List <ParticleEngine> particle, ContentManager Content, List <Vector2> explosereseau)
        {
            Collisions collision = new Collisions(player, map, sound, shots, map.itemList, entityList, animationList);

            KeyEvents(player, map, controles, sound);
            if (controles.StayDown())
            {
                player.fallMax = player.fallMaxInit;
            }
            AllTimeEvents(player);

            collision.DoMove(ref msg);

            collision.IsShooted(player, shots, sound, particle);

            collision.ValideTire(map, shots, destructTile, particle, Content, explosereseau);

            player.animation.SetCorrectSprite(player);
        }
Exemplo n.º 3
0
        // vas a la ligne 298!
        public static void IACheckEvents(Enemy Glandu, IAType IAType, Map map, List <Player> PlayerTab, Shot shots, List <Vector3> destructTile, int host, Sound sound, List <Entity> entityList, List <Animate> animationList, List <ParticleEngine> particle, ContentManager Content, List <Enemy> Enemys, List <Vector2> exploseReseau)
        {
            Collisions collision = new Collisions(Glandu, map, sound, shots, map.itemList, entityList, animationList);

            if (IAcollideIA(Glandu, Enemys))
            {
                if (Glandu.id % 4 == 1)
                {
                    IAMoveRight(Glandu);
                }
                if (Glandu.id % 4 == 2)
                {
                    IAMoveLeft(Glandu);
                }
                if (Glandu.id % 4 == 3)
                {
                    IAJump(Glandu);
                }
            }
            Physics.Fall(Glandu);
            if (IAType == IAType.Survival)
            {
                IASurvival(Glandu, (Player)PlayerTab[0], 400, shots, 0, 0, sound, Content, map, Enemys);
                Glandu.iaType = IAType.patr_Snd;
            }

            if (IAType == IAType.SnD)
            {
                IA.IAModSnDestroy(Glandu, PlayerTab[PlayerNearest(Glandu, PlayerTab, 100000, 0)], 380, shots, 0, 0, sound);
            }
            String msg = "";

            collision.DoMove(ref msg);

            IAHole(Glandu, map);

            msg = "";

            collision.IsShooted(Glandu, shots, sound, particle);
            collision.ValideTire(map, shots, destructTile, particle, Content, exploseReseau);

            if ((collision.haut))// || collision.haut || collision.uR))// && Math.Abs(Glandu.pos.X - PlayerTab[0].pos.X) < 300 && Math.Abs(Glandu.pos.Y - PlayerTab[0].pos.Y) < 300)//(Glandu.direction == Direction.Gauche || Glandu.direction == Direction.Droite))
            {
                IAShoot(Glandu, shots, 0, 0, (int)Glandu.position.X, (int)Glandu.position.Y - 100, sound);
            }
            if (collision.droite || collision.gauche)
            {
                IAJump(Glandu);
            }

            if (IAType == IAType.patr_SndHigh)
            {
                if (Math.Abs(PlayerTab[0].position.X - Glandu.position.X) < 1000)
                {
                    IA.IAModSnDestroy(Glandu, PlayerTab[0], 700, shots, 0, 0, sound);
                }
                else
                {
                    IAModPatrouille(Glandu, (int)map.IASpawnList[Glandu.id - 100].X - 450, (int)map.IASpawnList[Glandu.id - 100].X + 450);
                }
            }
            if (IAType == IAType.patr_SndHigh)
            {
                if (Math.Abs(PlayerTab[0].position.X - Glandu.position.X) < 1000)
                {
                    IA.IAModSnDestroy(Glandu, PlayerTab[0], 700, shots, 0, 0, sound);
                }
                else
                {
                    IAModPatrouille(Glandu, (int)map.IASpawnList[Glandu.id - 100].X - 200, (int)map.IASpawnList[Glandu.id - 100].X + 200);
                }
            }
            if (IAType == IAType.patr_Snd)
            {
                if (Math.Abs(PlayerTab[0].position.X - Glandu.position.X) < 1000)
                {
                    IA.IAModSnDestroy(Glandu, PlayerTab[0], 700, shots, 0, 0, sound);
                }
                else
                {
                    IAModPatrouille(Glandu, (int)map.IASpawnList[Glandu.id - 100].X - 300, (int)map.IASpawnList[Glandu.id - 100].X + 300);
                }
            }
            if (IAType == IAType.random)
            {
                IARandomMove(Glandu);
            }

            Glandu.animation.SetCorrectSprite(Glandu);

            if (Glandu.direction == Direction.left)
            {
                Glandu.currentWeapon.Update(Glandu, Math.PI, null);
            }
            else
            {
                Glandu.currentWeapon.Update(Glandu, 0, null);
            }
        }
Exemplo n.º 4
0
        public void GetPacket(List <Player> players, int hostPlayer, Map map, Shot shots, ContentManager Content, GraphicsDevice graphics, List <Explosion> explosionList, List <ParticleEngine> particles, Sound sound, List <Vector2> explosions, List <Entity> entityList)
        {
            NetIncomingMessage incMsg;

            incMsg = client.ReadMessage();
            if (incMsg != null)
            {
                switch (incMsg.MessageType)
                {
                case NetIncomingMessageType.Data:
                    int count;
                    //Nplayers
                    int nbPlayers = incMsg.ReadInt32();

                    if (nbPlayers > players.Count)
                    {
                        Player player;
                        if (nbPlayers % 2 == 0)
                        {
                            player = new Player(map.spawnPoint2, TexturesGame.PlayerTab[0], players.Count, graphics, LoadWeapons.LoadKnife(Content), true, FlagsType.red);
                        }
                        else
                        {
                            player = new Player(map.spawnPoint, TexturesGame.PlayerTab[1], players.Count, graphics, LoadWeapons.LoadKnife(Content), true, FlagsType.blue);
                        }
                        players.Add(player);
                        entityList.Add(player);
                    }

                    for (int i = 0; i < nbPlayers; i++)
                    {
                        //Perso
                        if (i != hostPlayer)
                        {
                            players[i].position.X   = incMsg.ReadInt32();
                            players[i].position.Y   = incMsg.ReadInt32();
                            players[i].activeSprite = (AnimDir)incMsg.ReadInt32();
                            players[i].direction    = (Direction)incMsg.ReadInt32();

                            players[i].currentWeapon.numArme    = incMsg.ReadInt32();
                            players[i].currentWeapon.position.X = incMsg.ReadInt32();
                            players[i].currentWeapon.position.Y = incMsg.ReadInt32();
                            players[i].currentWeapon.angle      = incMsg.ReadDouble();
                            players[i].currentWeapon.numBalle   = incMsg.ReadInt32();

                            players[i].arm.position.X = incMsg.ReadInt32();
                            players[i].arm.position.Y = incMsg.ReadInt32();
                            players[i].arm.rectangle  = new Rectangle((int)players[i].arm.position.X, (int)players[i].arm.position.Y, incMsg.ReadInt32(), incMsg.ReadInt32());
                            players[i].arm.angle      = incMsg.ReadDouble();

                            //Map
                            count = incMsg.ReadInt32();
                            for (int j = 0; j < count; j++)
                            {
                                int x   = incMsg.ReadInt32();
                                int y   = incMsg.ReadInt32();
                                int hit = incMsg.ReadInt32();
                                map.world[y, x].Hit(hit, ref explosionList, particles, sound, map, Content, explosions);
                            }

                            //Tirs Others Pos
                            count = incMsg.ReadInt32();
                            for (int j = 0; j < count; j++)
                            {
                                Vector2 position = new Vector2((float)incMsg.ReadInt32(), (float)incMsg.ReadInt32());
                                double  angle    = incMsg.ReadDouble();
                                int     damage   = incMsg.ReadInt32();
                                shots.otherTirList.Add(new Tirs(TexturesGame.ammoTab[players[i].currentWeapon.numBalle], damage, position, Vector2.Zero, 0, i, angle, 0, tirTypes.bullet));    // TODO: Implémenter tirTypes !!!
                            }
                        }
                        else
                        {
                            incMsg.ReadInt32();
                            incMsg.ReadInt32();
                            incMsg.ReadInt32();
                            incMsg.ReadInt32();
                            incMsg.ReadInt32();
                            incMsg.ReadInt32();
                            incMsg.ReadInt32();
                            incMsg.ReadDouble();
                            incMsg.ReadInt32();
                            incMsg.ReadInt32();
                            incMsg.ReadInt32();
                            incMsg.ReadInt32();
                            incMsg.ReadInt32();
                            incMsg.ReadDouble();
                            count = incMsg.ReadInt32();
                            for (int j = 0; j < count; j++)
                            {
                                incMsg.ReadInt32();
                                incMsg.ReadInt32();
                                incMsg.ReadInt32();
                            }
                            count = incMsg.ReadInt32();
                            for (int j = 0; j < count; j++)
                            {
                                incMsg.ReadInt32();
                                incMsg.ReadInt32();
                                incMsg.ReadDouble();
                                incMsg.ReadInt32();
                            }
                        }
                    }

                    //Scores
                    redScore  = incMsg.ReadInt32();
                    blueScore = incMsg.ReadInt32();

                    //Platforms
                    count = incMsg.ReadInt32();
                    for (int i = 0; i < count; i++)
                    {
                        map.platFormList[i].position = new Vector2((float)incMsg.ReadInt32(), (float)incMsg.ReadInt32());
                        map.platFormList[i].speed    = new Vector2((float)incMsg.ReadInt32(), (float)incMsg.ReadInt32());
                        map.platFormList[i].oldspeed = new Vector2((float)incMsg.ReadInt32(), (float)incMsg.ReadInt32());
                    }
                    break;

                default:
                    break;
                }
            }
        }
Exemplo n.º 5
0
        public void SendPacket(List <Player> players, int hostPlayer, List <Vector3> destroyTiles, Shot shots, bool isFlagCaptured)
        {
            NetOutgoingMessage outMsg = client.CreateMessage();

            //Identifier
            outMsg.Write(hostPlayer);

            //Score
            if (mode == ModeMulti.ctf)
            {
                if (isFlagCaptured)
                {
                    outMsg.Write(1);
                }
                else
                {
                    outMsg.Write(0);
                }
            }
            else
            {
                if (players[hostPlayer].isDie)
                {
                    outMsg.Write(1);
                    players[hostPlayer].isDie = false;
                }
                else
                {
                    outMsg.Write(0);
                }
            }

            //This HostPlayer Position
            outMsg.Write((Int32)players[hostPlayer].position.X);
            outMsg.Write((Int32)players[hostPlayer].position.Y);
            outMsg.Write((Int32)players[hostPlayer].activeSprite);
            outMsg.Write((Int32)players[hostPlayer].direction);

            //Weapon
            outMsg.Write((Int32)players[hostPlayer].currentWeapon.numArme);
            outMsg.Write((Int32)players[hostPlayer].currentWeapon.position.X);
            outMsg.Write((Int32)players[hostPlayer].currentWeapon.position.Y);
            outMsg.Write(players[hostPlayer].currentWeapon.angle);
            outMsg.Write((Int32)players[hostPlayer].currentWeapon.numBalle);

            //Arm
            outMsg.Write((Int32)players[hostPlayer].arm.position.X);
            outMsg.Write((Int32)players[hostPlayer].arm.position.Y);
            outMsg.Write((Int32)players[hostPlayer].arm.rectangle.Width);
            outMsg.Write((Int32)players[hostPlayer].arm.rectangle.Height);
            outMsg.Write(players[hostPlayer].arm.angle);

            //Destruct Tile
            outMsg.Write(destroyTiles.Count);
            for (int i = 0; i < destroyTiles.Count; i++)
            {
                outMsg.Write((Int32)destroyTiles[i].X);
                outMsg.Write((Int32)destroyTiles[i].Y);
                outMsg.Write((Int32)destroyTiles[i].Z);
            }

            //Send Tirs Positions
            outMsg.Write(shots.tirList.Count);
            for (int i = 0; i < shots.tirList.Count; i++)
            {
                outMsg.Write((Int32)shots.tirList[i].position.X);
                outMsg.Write((Int32)shots.tirList[i].position.Y);
                outMsg.Write(shots.tirList[i].angle);
                outMsg.Write(shots.tirList[i].damage);
            }
            client.SendMessage(outMsg, NetDeliveryMethod.ReliableOrdered);
        }
Exemplo n.º 6
0
        public void Shoot(Controles controles, Camera camera, Shot shots, Sound sound, List <Animate> animationList, List <ParticleEngine> particle)
        {
            Random rnd = new Random();

            currentWeapon.animationn();
            Vector2 dir    = Vector2.Normalize(new Vector2(controles.cursorPosition.X - currentWeapon.position.X + camera.Xcurrent + camera.Xspecial, controles.cursorPosition.Y - currentWeapon.position.Y + camera.Ycurrent + camera.Yspecial));
            Vector2 oriTir = currentWeapon.position + (dir * currentWeapon.image[0].Width);

            if (direction == Direction.left)
            {
                oriTir.X += 15;
            }
            else
            {
                oriTir.X -= 15;
            }

            double angle = Math.Atan2(controles.cursorPosition.Y + camera.Ycurrent + camera.Yspecial - (currentWeapon.position + (dir * currentWeapon.image[0].Width / 2)).Y, controles.cursorPosition.X + camera.Xcurrent + camera.Xspecial - (currentWeapon.position + (dir * currentWeapon.image[0].Width / 2)).X);

            currentWeapon.Update(this, angle, controles);

            Vector2 destiArm = currentWeapon.position + (dir * currentWeapon.image[0].Width / 2);
            double  armangle = Math.Atan2(destiArm.Y - arm.position.Y,
                                          destiArm.X - arm.position.X);

            arm.Update(this, armangle, dir);

            if (currentWeapon.weaponType == cadenceType.none && controles.Click())
            {
                shots.tirList.Add(new Tirs(currentWeapon.ammoTexture, (int)(currentWeapon.damage * attaque), oriTir, dir * 40, currentWeapon.range, id, angle, currentWeapon.nTexture, currentWeapon.tirtype));
                sound.Play(currentWeapon.shotSound);
                if (currentWeapon.count2 < 7 && direction == Direction.right)
                {
                    currentWeapon.count2 = 2;
                }
                if (currentWeapon.count2 < 7 && direction == Direction.left)
                {
                    currentWeapon.count2 = 3;
                }
            }
            if (currentWeapon.weaponType == cadenceType.semiAuto)
            {
                currentWeapon.autoTirs += currentWeapon.cadence;
                if (currentWeapon.autoTirs > 1 && controles.Click() && currentWeapon.currentAmo > 0)
                {
                    int numX = rnd.Next(-currentWeapon.accuracy - accuracy, currentWeapon.accuracy + accuracy);
                    int numY = rnd.Next(-currentWeapon.accuracy - accuracy, currentWeapon.accuracy + accuracy);
                    dir = Vector2.Normalize(new Vector2(controles.cursorPosition.X - currentWeapon.position.X + camera.Xcurrent + camera.Xspecial + numX, controles.cursorPosition.Y - currentWeapon.position.Y + camera.Ycurrent + camera.Yspecial + numY));
                    shots.tirList.Add(new Tirs(currentWeapon.ammoTexture, (int)(currentWeapon.damage * attaque), oriTir, dir * 40, currentWeapon.range, id, angle, currentWeapon.nTexture, currentWeapon.tirtype));
                    sound.Play(currentWeapon.shotSound);

                    currentWeapon.currentAmo--;
                    currentWeapon.autoTirs = 0;
                }
            }
            else if (currentWeapon.weaponType == cadenceType.auto && controles.StayClick() && currentWeapon.currentAmo > 0)
            {
                currentWeapon.autoTirs += currentWeapon.cadence;
                if (currentWeapon.autoTirs > 1)
                {
                    for (int i = 0; i < currentWeapon.autoTirs - 1; i++)
                    {
                        int numX = rnd.Next(-currentWeapon.accuracy - accuracy, currentWeapon.accuracy + accuracy);
                        int numY = rnd.Next(-currentWeapon.accuracy - accuracy, currentWeapon.accuracy + accuracy);
                        dir = Vector2.Normalize(new Vector2(controles.cursorPosition.X - currentWeapon.position.X + camera.Xcurrent + camera.Xspecial + numX, controles.cursorPosition.Y - currentWeapon.position.Y + camera.Ycurrent + camera.Yspecial + numY));
                        shots.tirList.Add(new Tirs(currentWeapon.ammoTexture, (int)(currentWeapon.damage * attaque), oriTir, dir * 40, currentWeapon.range, id, angle, currentWeapon.nTexture, currentWeapon.tirtype));

                        currentWeapon.currentAmo--;
                    }
                    sound.Play(currentWeapon.shotSound);
                    currentWeapon.autoTirs = 0;
                }
            }
            else if (currentWeapon.weaponType == cadenceType.rafales && controles.StayClick() && currentWeapon.currentAmo > 0)
            {
                if (currentWeapon.rafalstirs < 3)
                {
                    currentWeapon.autoTirs += currentWeapon.cadence;
                    if (currentWeapon.autoTirs > 1)
                    {
                        currentWeapon.rafalstirs++;
                        for (int i = 0; i < currentWeapon.autoTirs - 1; i++)
                        {
                            int numX = rnd.Next(-currentWeapon.accuracy - accuracy, currentWeapon.accuracy + accuracy);
                            int numY = rnd.Next(-currentWeapon.accuracy - accuracy, currentWeapon.accuracy + accuracy);
                            dir = Vector2.Normalize(new Vector2(controles.cursorPosition.X - currentWeapon.position.X + camera.Xcurrent + camera.Xspecial + numX, controles.cursorPosition.Y - currentWeapon.position.Y + camera.Ycurrent + camera.Yspecial + numY));
                            shots.tirList.Add(new Tirs(currentWeapon.ammoTexture, (int)(currentWeapon.damage * attaque), oriTir, dir * 40, currentWeapon.range, id, angle, currentWeapon.nTexture, currentWeapon.tirtype));
                            sound.Play(currentWeapon.shotSound);

                            currentWeapon.currentAmo--;
                        }
                        currentWeapon.autoTirs = 0;
                    }
                }
            }
            else
            {
                currentWeapon.rafalstirs = 0;
            }
        }