// Update is called once per frame void Update() { if (lastWaveFinished) { endLevel = true; } //Si le boss de fin n'est pas mort, le niveau n'est pas fini if (endLevel == false) { //Nombre de vague avant le boss if (cptVague < 12) { //On fait arriver les enemy groupe par groupe ... if (beginGroup) { //... en piochant parmi les patternes (présent dasn ListGroupEnemy) switch (cptVague) // { case 0: a = ListGroupEnemy.LaunchUpDownComeStopFireGroup(enemyStatic, new Vector3(bordDroite, 1.5f, -15)); a = ListGroupEnemy.ArrowGroup("SplineHorUp2"); a = ListGroupEnemy.ArrowGroup("SplineHorDown2"); break; case 1: a = ListGroupEnemy.CircleGroup("SplineHorUp2"); a.AddComponent <FireOneByOne>(); a.GetComponent <FireOneByOne>().tempsFireMax = 4; a.GetComponent <FireOneByOne>().tempsFireAct = 3; a = ListGroupEnemy.CircleGroup("SplineHorDown2"); a.AddComponent <FireOneByOne>(); a.GetComponent <FireOneByOne>().tempsFireMax = 4; a.GetComponent <FireOneByOne>().tempsFireAct = 1; a = ListGroupEnemy.ArrowGroup("SplineHorCenter"); break; case 2: a = ListGroupEnemy.CircleGroup("SplineHorCenter"); a.AddComponent <FireOneByOne>(); a.GetComponent <FireOneByOne>().tempsFireMax = 4; a.GetComponent <FireOneByOne>().tempsFireAct = 0; frequenceApparition = 2; break; case 3: a = ListGroupEnemy.Igroup("SplineCenterUp"); a.AddComponent <FireOneByOne>(); a.GetComponent <FireOneByOne>().tempsFireMax = 4; a.GetComponent <FireOneByOne>().tempsFireAct = 0; a = ListGroupEnemy.Igroup("SplineCenterDown"); a.AddComponent <FireOneByOne>(); a.GetComponent <FireOneByOne>().tempsFireMax = 4; a.GetComponent <FireOneByOne>().tempsFireAct = 0; frequenceApparition = 5; break; case 4: a = ListGroupEnemy.ArrowGroup("SplineHorUp2"); a.AddComponent <FireOneByOne>(); a.GetComponent <FireOneByOne>().tempsFireMax = 4; a.GetComponent <FireOneByOne>().tempsFireAct = 0; a = ListGroupEnemy.ArrowGroup("SplineHorDown2"); a.AddComponent <FireOneByOne>(); a.GetComponent <FireOneByOne>().tempsFireMax = 4; a.GetComponent <FireOneByOne>().tempsFireAct = 2; frequenceApparition = 3; break; case 5: a = ListGroupEnemy.Vgroup("SplineHorCenter"); a.AddComponent <FireOneByOne>(); a.GetComponent <FireOneByOne>().tempsFireMax = 4; a.GetComponent <FireOneByOne>().tempsFireAct = 0; frequenceApparition = 5; break; case 6: a = ListGroupEnemy.Vgroup("SplineHorCenter"); frequenceApparition = 1.5f; break; case 7: a = ListGroupEnemy.Igroup("SplineSnakeUp1"); a.AddComponent <FireOneByOne>(); a.GetComponent <FireOneByOne>().tempsFireMax = 4; a.GetComponent <FireOneByOne>().tempsFireAct = 0; a = ListGroupEnemy.Igroup("SplineSnakeDown1"); a.AddComponent <FireOneByOne>(); a.GetComponent <FireOneByOne>().tempsFireMax = 4; a.GetComponent <FireOneByOne>().tempsFireAct = 2; frequenceApparition = 5; break; case 8: a = ListGroupEnemy.CircleGroup("SplineHorUp1"); a = ListGroupEnemy.CircleGroup("SplineHorDown1"); frequenceApparition = 2; break; case 9: a = ListGroupEnemy.Igroup("SplineSnakeUp1"); a.AddComponent <FireOneByOne>(); a.GetComponent <FireOneByOne>().tempsFireMax = 4; a.GetComponent <FireOneByOne>().tempsFireAct = 0; frequenceApparition = 5; break; case 10: a = ListGroupEnemy.Igroup("SplineSnakeUp1"); a.AddComponent <FireOneByOne>(); a.GetComponent <FireOneByOne>().tempsFireMax = 4; a.GetComponent <FireOneByOne>().tempsFireAct = 0; frequenceApparition = 2; break; case 11: a = ListGroupEnemy.ArrowGroup("SplineHorUp2"); a.AddComponent <FireOneByOne>(); a.GetComponent <FireOneByOne>().tempsFireMax = 4; a.GetComponent <FireOneByOne>().tempsFireAct = 0; a = ListGroupEnemy.ArrowGroup("SplineHorDown2"); a.AddComponent <FireOneByOne>(); a.GetComponent <FireOneByOne>().tempsFireMax = 4; a.GetComponent <FireOneByOne>().tempsFireAct = 2; frequenceApparition = 5; break; } cptVague++; beginGroup = false; } else //Une fois un groupe lancé, on lance la tempo pour le suivant { tempsActuel += Time.deltaTime; if (tempsActuel > frequenceApparition) { tempsActuel = 0; beginGroup = true; } } } //Le nombre de vague avant le boss est atteint, on lance la phase du boss else { frequenceApparition = 10; if (tempsActuel > frequenceApparition && !lastWaveLaunched) { tempsActuel = 0; lastWave = ListGroupEnemy.LaunchUpDownComeStopFireGroup(enemyStatic, new Vector3(bordDroite, 4f, -1.5f)); lastWave2 = ListGroupEnemy.LaunchUpDownComeStopFireGroup(enemyStatic, new Vector3(bordDroite + 2.5f, 2.5f, -1.5f)); lastWave3 = ListGroupEnemy.LaunchUpDownComeStopFireGroup(enemyStatic, new Vector3(bordDroite + 5, 1f, -1.5f)); lastWave4 = ListGroupEnemy.Vgroup("SplineHorCenter"); lastWave5 = ListGroupEnemy.Vgroup("SplineHorUp2"); lastWave6 = ListGroupEnemy.Vgroup("SplineHorDown2"); lastWaveLaunched = true; } else { tempsActuel += Time.deltaTime; } if (lastWaveLaunched && lastWave == null && lastWave2 == null && lastWave3 == null && lastWave4 == null && lastWave5 == null && lastWave6 == null) { lastWaveFinished = true; } } //UTILISER SI ON VEUT QUE LES VAGUES ARRIVENT DE PLUS EN PLUS VITE if (tempsChangeFreq > tempsChangeFreqMax) { tempsChangeFreq = 0; frequenceApparition *= 0.9f; } else { tempsChangeFreq += Time.deltaTime; } } else //FIN DU NIVEAU { GameObject.FindWithTag("Pattern").GetComponent <EndLevel>().endLevel = true; if (gain) { gain = false; } } }
// Update is called once per frame void Update() { if (lastWaveFinished) { endLevel = true; } //Si le boss de fin n'est pas mort, le niveau n'est pas fini if (endLevel == false) { //Nombre de vague avant le boss if (cptVague < 13) { //On fait arriver les enemy groupe par groupe ... if (beginGroup) { //... en piochant parmi les patternes (présent dasn ListGroupEnemy) switch (cptVague) // { case 1: a = ListGroupEnemy.Igroup("SplineUp1"); a.AddComponent <FireOneByOne>(); a.GetComponent <FireOneByOne>().tempsFireMax = 4; a.GetComponent <FireOneByOne>().tempsFireAct = 0; a = ListGroupEnemy.Igroup("SplineDown1"); a.AddComponent <FireOneByOne>(); a.GetComponent <FireOneByOne>().tempsFireMax = 4; a.GetComponent <FireOneByOne>().tempsFireAct = 0; a = ListGroupEnemy.Vgroup("SplineHorCenter"); a.AddComponent <FireOneByOne>(); a.GetComponent <FireOneByOne>().tempsFireMax = 4; a.GetComponent <FireOneByOne>().tempsFireAct = 2; break; case 2: a = ListGroupEnemy.Igroup("SplineCenterUp"); a.AddComponent <FireOneByOne>(); a.GetComponent <FireOneByOne>().tempsFireMax = 4; a.GetComponent <FireOneByOne>().tempsFireAct = 0; a = ListGroupEnemy.Igroup("SplineCenterDown"); a.AddComponent <FireOneByOne>(); a.GetComponent <FireOneByOne>().tempsFireMax = 4; a.GetComponent <FireOneByOne>().tempsFireAct = 0; a = ListGroupEnemy.ArrowGroup("SplineHorCenter"); a.AddComponent <FireOneByOne>(); a.GetComponent <FireOneByOne>().tempsFireMax = 4; a.GetComponent <FireOneByOne>().tempsFireAct = 2; break; case 3: a = ListGroupEnemy.ArrowGroup("SplineHorUp2"); a.AddComponent <FireOneByOne>(); a.GetComponent <FireOneByOne>().tempsFireMax = 4; a.GetComponent <FireOneByOne>().tempsFireAct = 0; a = ListGroupEnemy.ArrowGroup("SplineHorDown2"); a.AddComponent <FireOneByOne>(); a.GetComponent <FireOneByOne>().tempsFireMax = 4; a.GetComponent <FireOneByOne>().tempsFireAct = 2; a = ListGroupEnemy.Igroup("SplineSnakeCenter"); a.AddComponent <FireOneByOne>(); a.GetComponent <FireOneByOne>().tempsFireMax = 4; a.GetComponent <FireOneByOne>().tempsFireAct = 0; break; case 4: a = ListGroupEnemy.LaunchUpDownComeStopFireGroup(enemyStatic, new Vector3(bordDroite, 1.5f, -15)); a = ListGroupEnemy.Igroup("SplineUpHor1"); a = ListGroupEnemy.Igroup("SplineDownHor1"); break; case 5: a = ListGroupEnemy.ArrowGroup("SplineHorCenter"); a.AddComponent <FireOneByOne>(); a.GetComponent <FireOneByOne>().tempsFireMax = 4; a.GetComponent <FireOneByOne>().tempsFireAct = 0; frequenceApparition = 1f; break; case 6: a = ListGroupEnemy.CircleGroup("SplineHorUp2"); a.AddComponent <FireOneByOne>(); a.GetComponent <FireOneByOne>().tempsFireMax = 4; a.GetComponent <FireOneByOne>().tempsFireAct = 3; a = ListGroupEnemy.CircleGroup("SplineHorDown2"); a.AddComponent <FireOneByOne>(); a.GetComponent <FireOneByOne>().tempsFireMax = 4; a.GetComponent <FireOneByOne>().tempsFireAct = 1; frequenceApparition = 6; break; case 7: a = ListGroupEnemy.ArrowGroup("SplineHorUp2"); a.AddComponent <FireOneByOne>(); a.GetComponent <FireOneByOne>().tempsFireMax = 4; a.GetComponent <FireOneByOne>().tempsFireAct = 0; a = ListGroupEnemy.ArrowGroup("SplineHorDown2"); a.AddComponent <FireOneByOne>(); a.GetComponent <FireOneByOne>().tempsFireMax = 4; a.GetComponent <FireOneByOne>().tempsFireAct = 2; frequenceApparition = 2; break; case 8: a = ListGroupEnemy.ArrowGroup("SplineHorUp1"); a = ListGroupEnemy.ArrowGroup("SplineHorDown1"); frequenceApparition = 2; break; case 9: a = ListGroupEnemy.ArrowGroup("SplineHorCenter"); a.AddComponent <FireOneByOne>(); a.GetComponent <FireOneByOne>().tempsFireMax = 3; a.GetComponent <FireOneByOne>().tempsFireAct = 0; frequenceApparition = 6; break; case 10: a = ListGroupEnemy.Igroup("SplineSnakeUp2"); a.AddComponent <FireOneByOne>(); a.GetComponent <FireOneByOne>().tempsFireMax = 4; a.GetComponent <FireOneByOne>().tempsFireAct = 0; a = ListGroupEnemy.Igroup("SplineSnakeDown2"); a.AddComponent <FireOneByOne>(); a.GetComponent <FireOneByOne>().tempsFireMax = 4; a.GetComponent <FireOneByOne>().tempsFireAct = 2; frequenceApparition = 2; break; case 11: a = ListGroupEnemy.CircleGroup("SplineHorCenter"); frequenceApparition = 6; break; case 12: lastWave1 = ListGroupEnemy.Vgroup("SplineHorUp1"); lastWave2 = ListGroupEnemy.Vgroup("SplineHorDown1"); break; } cptVague++; beginGroup = false; } else //Une fois un groupe lancé, on lance la tempo pour le suivant { tempsActuel += Time.deltaTime; if (tempsActuel > frequenceApparition) { tempsActuel = 0; beginGroup = true; } } } //Le nombre de vague avant le boss est atteint, on lance la phase du boss else { frequenceApparition = 2; if (tempsActuel > frequenceApparition && !lastWaveLaunched) { tempsActuel = 0; lastWave3 = ListGroupEnemy.Vgroup("SplineHorUp2"); lastWave3.AddComponent <FireOneByOne>(); lastWave3.GetComponent <FireOneByOne>().tempsFireMax = 4; lastWave3.GetComponent <FireOneByOne>().tempsFireAct = 0; lastWave4 = ListGroupEnemy.Vgroup("SplineHorDown2"); lastWave4.AddComponent <FireOneByOne>(); lastWave4.GetComponent <FireOneByOne>().tempsFireMax = 4; lastWave4.GetComponent <FireOneByOne>().tempsFireAct = 2; lastWave5 = ListGroupEnemy.LaunchUpDownComeStopFireGroup(enemyStatic, new Vector3(bordDroite, 1.5f, -15)); lastWave6 = ListGroupEnemy.LaunchUpDownComeStopFireGroup(enemyStatic, new Vector3(bordDroite, 4f, -15)); lastWaveLaunched = true; } else { tempsActuel += Time.deltaTime; } if (lastWaveLaunched && lastWave1 == null && lastWave2 == null && lastWave3 == null && lastWave4 == null && lastWave5 == null && lastWave6 == null) { lastWaveFinished = true; } } } else //FIN DU NIVEAU { GameObject.FindWithTag("Pattern").GetComponent <EndLevel>().endLevel = true; if (gain) { GameObject.FindWithTag("PlayerScript").GetComponent <Player>().GagnerArgent(20000); GameObject.FindWithTag("PlayerScript").GetComponent <Player>().Gagnerferraille(100); gain = false; } } }