示例#1
0
 public static void Recommencer()
 {
     if (nbÉtage == ÉTAGE_BOSS)
     {
         TourGameObject.GetComponent <ÉtageBoss>().Recommencer();
     }
     else
     {
         FinirÉtage();
         NouvelÉtage(true);
     }
 }
示例#2
0
    static public void LoadÉtage()
    {
        if (nbÉtage != ÉTAGE_BOSS)
        {
            étageReader = new StreamReader(CHEMIN_DATA_ÉTAGE + "Étage" + nbÉtage.ToString() + ".txt");
            do
            {
                string obj;
                do
                {
                    obj = étageReader.ReadLine();
                } while (obj == "" || obj[0] == '/');

                string[] line      = étageReader.ReadLine().Split(SÉPARATEUR);
                float[]  attributs = new float[line.Length];
                for (int cpt = 0; cpt < line.Length; ++cpt)
                {
                    attributs[cpt] = float.Parse(line[cpt]);
                }

                //if(obj.Contains("Point")) { ListPoint.Add(new GameObject(obj)); }
                ListGameObject.Add(new GameObject(obj));

                obj = obj.Split(' ')[0]; // obj.Remove(' ');
                switch (obj)
                {
                case Plateforme.String:
                    ListGameObject.Last().AddComponent <Plateforme>().InitialisationP(attributs[0],
                                                                                      attributs[1],
                                                                                      attributs[2] * DELTA_HAUTEUR,
                                                                                      attributs[3],
                                                                                      attributs[4] * DELTA_HAUTEUR,
                                                                                      LARGEUR_PLATEFORME,
                                                                                      RAYON_TOUR,
                                                                                      0,
                                                                                      Materials.Get((int)NomMaterial.Plateforme));
                    break;

                case PlateformeMobile.String:
                    ListGameObject.Last().AddComponent <PlateformeMobile>().InitialisationPM(attributs[0],
                                                                                             attributs[1],
                                                                                             attributs[2] * DELTA_HAUTEUR,
                                                                                             attributs[3],
                                                                                             attributs[4] * DELTA_HAUTEUR,
                                                                                             LARGEUR_PLATEFORME - LARGEUR_PLATEFORME / 40,
                                                                                             RAYON_TOUR,
                                                                                             attributs[5],
                                                                                             attributs[6],
                                                                                             attributs.Length >= 8 ? (int)attributs[7] : 0,
                                                                                             attributs.Length >= 9 ? (int)attributs[8] : 0,
                                                                                             Materials.Get((int)NomMaterial.Plateforme));
                    break;

                case PlateformeTemporaire.String:
                    ListGameObject.Last().AddComponent <PlateformeTemporaire>().InitialisationPT(attributs[0],
                                                                                                 attributs[1],
                                                                                                 attributs[2] * DELTA_HAUTEUR,
                                                                                                 attributs[3],
                                                                                                 attributs[4] * DELTA_HAUTEUR,
                                                                                                 LARGEUR_PLATEFORME,
                                                                                                 RAYON_TOUR,
                                                                                                 attributs[5],
                                                                                                 attributs.Length >= 7 ? (int)attributs[6] : 0,
                                                                                                 attributs.Length >= 8 ? (int)attributs[7] : 0,
                                                                                                 Materials.Get((int)NomMaterial.Plateforme));
                    break;

                case PlateformePics.String:
                    ListGameObject.Last().AddComponent <PlateformePics>().InitialisationPP(attributs[0],
                                                                                           attributs[1],
                                                                                           attributs[2] * DELTA_HAUTEUR,
                                                                                           attributs[3],
                                                                                           attributs[4] * DELTA_HAUTEUR,
                                                                                           LARGEUR_PLATEFORME,
                                                                                           RAYON_TOUR,
                                                                                           attributs[5] * DELTA_HAUTEUR,
                                                                                           attributs.Length >= 7 ? (int)attributs[6] : 0,
                                                                                           Materials.Get((int)NomMaterial.Plateforme));
                    break;

                case Pic.String:
                    ListGameObject.Last().AddComponent <Pic>().Initialisation(attributs[0],
                                                                              attributs[1] * DELTA_HAUTEUR,
                                                                              attributs[2] * DELTA_HAUTEUR,
                                                                              LARGEUR_PLATEFORME / 2.4f,
                                                                              attributs.Length >= 4 ? (int)attributs[3] : 0,
                                                                              Materials.Get((int)NomMaterial.Pic));
                    break;

                case Point.String:
                    ListGameObject.Last().AddComponent <Point>().Initialisation(attributs[0],
                                                                                attributs[1] * DELTA_HAUTEUR + 0.5f * DELTA_HAUTEUR,
                                                                                attributs[2] == 0 ? false : true,
                                                                                attributs[3],
                                                                                attributs[2] == 0 ? Materials.Get((int)NomMaterial.Point) : Materials.Get((int)NomMaterial.Multiplicateur));
                    break;

                case Flèche.String:
                    ListGameObject.Last().AddComponent <Flèche>().Initialisation(attributs[0],
                                                                                 attributs[1] * DELTA_HAUTEUR,
                                                                                 RAYON_TOUR,
                                                                                 attributs[2]);
                    break;

                case CheckPoint.String:
                    ListGameObject.Last().AddComponent <CheckPoint>().Initialisation(attributs[0], attributs[1] * DELTA_HAUTEUR);
                    break;

                case FinÉtage.String:
                    ListGameObject.Last().AddComponent <FinÉtage>().Initialisation2(attributs[0],
                                                                                    attributs[1] * DELTA_HAUTEUR);
                    break;
                }
            } while (!étageReader.EndOfStream);
            étageReader.Close();
        }
        else
        {
            TourGameObject.AddComponent <ÉtageBoss>();;
        }
        pause = false;
        Ui.SetActive(true);
        UiScript.Réinitialiser();
    }