示例#1
0
        public void DétruireNiveau()
        {
            foreach (List <PrimitiveDeBase> p in TabListObjetCollisionables)
            {
                p.Clear();
            }
            ListSections.Clear();

            List <int> index = new List <int>();

            for (int i = 0; i < Jeu.Components.Count(); i++)
            {
                if (Jeu.Components[i] is IDeletable)
                {
                    index.Add(i);
                }
            }

            index = index.OrderByDescending(x => x).ToList();
            for (int j = 0; j < index.Count(); j++)
            {
                Jeu.Components.RemoveAt(index[j]);
            }
        }
示例#2
0
        void CréerNiveau()
        {
            SectionRepos c = new SectionRepos(Jeu, Position, 0);

            ListSections.Add(c);
            Jeu.Components.Add(c);
            foreach (PrimitiveDeBase b in c.ObjetCollisionables)
            {
                TabListObjetCollisionables[0].Add(b);
            }
            Position = new Vector3(Position.X, Position.Y, Position.Z - c.LongueurNiveau);

            for (int i = 1; i < NbrSections; ++i)
            {
                int             nombreAléatoire = GénérateurAléatoire.Next(0, NB_SECTIONS_DISPO);
                SectionDeNiveau a = null;

                switch (nombreAléatoire)
                {
                case 0:
                    a        = new SectionRepos(Jeu, Position, i);
                    Position = new Vector3(Position.X, Position.Y, Position.Z - a.LongueurNiveau);
                    break;

                case 1:
                    a        = new SectionHache(Jeu, Position, i);
                    Position = new Vector3(Position.X, Position.Y, Position.Z - a.LongueurNiveau);
                    break;

                case 2:
                    a        = new SectionHachesMultiples(Jeu, Position, 4, i);
                    Position = new Vector3(Position.X, Position.Y, Position.Z - a.LongueurNiveau);
                    break;

                case 3:
                    a        = new SectionVentilateur(Jeu, Position, i);
                    Position = new Vector3(Position.X, Position.Y, Position.Z - a.LongueurNiveau);
                    break;

                case 4:
                    a        = new SectionMobileHorizontale(Jeu, Position, i);
                    Position = new Vector3(Position.X, Position.Y, Position.Z - a.LongueurNiveau);
                    break;

                case 5:
                    a        = new SectionMobileMultiples(Jeu, Position, i);
                    Position = new Vector3(Position.X, Position.Y, Position.Z - a.LongueurNiveau);
                    break;

                case 6:
                    a        = new SectionMoitiéMur(Jeu, Position, i);
                    Position = new Vector3(Position.X, Position.Y, Position.Z - a.LongueurNiveau);
                    break;

                case 7:
                    a        = new SectionVentilateurDroite(Jeu, Position, i);
                    Position = new Vector3(Position.X, Position.Y, Position.Z - a.LongueurNiveau);
                    break;
                }

                ListSections.Add(a);
                Jeu.Components.Add(a);
                foreach (PrimitiveDeBase b in a.ObjetCollisionables)
                {
                    TabListObjetCollisionables[i].Add(b);
                }
            }
        }