Ejemplo n.º 1
0
        void RecrerArme()
        {
            SoldatDeArmée[,] temp = new SoldatDeArmée[Positions.GetLength(0), Positions.GetLength(1)];
            int soldatsAjoute = 0;
            int tempI         = 0;
            int tempJ         = 0;

            for (int i = 0; i < Armés.GetLength(0); i++)
            {
                for (int j = 0; j < Armés.GetLength(1); j++)
                {
                    if (soldatsAjoute < NbVivants)
                    {
                        if (Armés[i, j] != null && Armés[i, j].EstVivant)
                        {
                            temp[tempI, tempJ] = Armés[i, j];
                            tempJ++;
                            if (tempJ == Positions.GetLength(1))
                            {
                                tempJ = 0;
                                tempI++;
                            }
                            soldatsAjoute++;
                        }
                    }
                }
            }
            Armés = temp;
        }
Ejemplo n.º 2
0
        public bool VerifierLesMorts()
        {
            bool aReformer     = false;
            int  soldatCompte  = 0;
            int  tempNbVivants = 0;

            for (int i = 0; i < Armés.GetLength(0); i++)
            {
                for (int j = 0; j < Armés.GetLength(1); j++)
                {
                    if (soldatCompte < NbVivants)
                    {
                        if (Armés[i, j] == null || !Armés[i, j].EstVivant)
                        {
                            aReformer = true;
                        }
                        else
                        {
                            tempNbVivants++;
                        }
                    }
                    soldatCompte++;
                }
            }
            NbVivants = tempNbVivants;
            return(aReformer);
        }
Ejemplo n.º 3
0
 void ToutDetruire()
 {
     for (int i = 0; i < Armés.GetLength(0); i++)
     {
         for (int j = 0; j < Armés.GetLength(1); j++)
         {
             Game.Components.Remove(Armés[i, j]);
         }
     }
     Armés     = new SoldatDeArmée[(int)Math.Ceiling(Math.Sqrt(NombreSoldat)), (int)Math.Ceiling(Math.Sqrt(NombreSoldat))];
     NbVivants = NombreSoldat;
 }
Ejemplo n.º 4
0
 void ReformerArmee()
 {
     for (int i = 0; i < Armés.GetLength(0); i++)
     {
         for (int j = 0; j < Armés.GetLength(1); j++)
         {
             if (Armés[i, j] != null)
             {
                 if (new Vector3(Armés[i, j].VarPosition.X, 5, Armés[i, j].VarPosition.Z) != Positions[i, j])
                 {
                     Armés[i, j].ModifierPositionCible(PosFlag + Positions[i, j]);
                 }
             }
         }
     }
 }
Ejemplo n.º 5
0
        void CréerHitboxCaméra()
        {
            BoundingSphere temp            = new BoundingSphere();
            bool           firstTime       = true;
            int            soldatsComptées = 0;;

            for (int i = 0; i < Armés.GetLength(0); i++)
            {
                for (int j = 0; j < Armés.GetLength(1); j++)
                {
                    if (soldatsComptées <= NbVivants)
                    {
                        if (Armés[i, j] != null)
                        {
                            if (Armés[i, j].EstVivant)
                            {
                                if (EstDansLimiteTerrain(Armés[i, j]))
                                {
                                    if (firstTime)
                                    {
                                        temp      = BoundingSphere.CreateFromBoundingBox(Armés[i, j].HitBoxGénérale);
                                        firstTime = false;
                                        soldatsComptées++;
                                    }
                                    temp = BoundingSphere.CreateMerged(temp, BoundingSphere.CreateFromBoundingBox(Armés[i, j].HitBoxGénérale));
                                    soldatsComptées++;
                                }
                            }
                        }
                    }
                }
            }


            Caméra.DonnerBoundingSphere(BoundingSphere.CreateMerged(temp, Flag.ViewFlag));
        }