// Update is called once per frame void Update() { if (lastWaveFinished == false) { //Nombre de vague avant le boss if (cptVague < 8) { //On fait arriver les enemy groupe par groupe ... if (beginGroup) { //... en piochant parmi les patternes (présent dasn ListGroupEnemy) switch (cptVague) // { case 0: ListGroupEnemy.Vgroup("SplineHorUp1"); break; case 1: ListGroupEnemy.Vgroup("SplineHorDown1"); break; case 2: ListGroupEnemy.Igroup("SplineCenterUp"); break; case 3: ListGroupEnemy.Igroup("SplineCenterDown"); break; case 4: ListGroupEnemy.Igroup("SplineSnakeUp1"); frequenceApparition = 4; break; case 5: ListGroupEnemy.Igroup("SplineSnakeDown1"); frequenceApparition = 8; break; case 6: ListGroupEnemy.Igroup("SplineHorCenter"); break; case 7: ListGroupEnemy.Vgroup("SplineHorUp1"); 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 = 10; if (tempsActuel > frequenceApparition && !lastWaveLaunched) { tempsActuel = 0; lastWave = ListGroupEnemy.CircleGroup("SplineHorCenter"); lastWave2 = ListGroupEnemy.Igroup("SplineSnakeUp2"); lastWave3 = ListGroupEnemy.Igroup("SplineSnakeDown2"); lastWaveLaunched = true; } else { tempsActuel += Time.deltaTime; } if (lastWaveLaunched && lastWave == null && lastWave2 == null && lastWave3 == null) { lastWaveFinished = true; } } } else //FIN DU NIVEAU { GameObject.FindWithTag("Pattern").GetComponent <EndLevel>().endLevel = true; if (gain) { GameObject.FindWithTag("PlayerScript").GetComponent <Player>().GagnerArgent(2000); GameObject.FindWithTag("PlayerScript").GetComponent <Player>().Gagnerferraille(20); 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 < 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 < 9) { //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.Vgroup("SplineHorCenter"); a.AddComponent <FireOneByOne>(); a.GetComponent <FireOneByOne>().tempsFireMax = 4; a.GetComponent <FireOneByOne>().tempsFireAct = 2; frequenceApparition = 4; break; case 1: a = ListGroupEnemy.Igroup("SplineHorUp1"); a = ListGroupEnemy.ArrowGroup("SplineHorCenter"); a.AddComponent <FireOneByOne>(); a.GetComponent <FireOneByOne>().tempsFireMax = 4; a.GetComponent <FireOneByOne>().tempsFireAct = 2; a = ListGroupEnemy.Igroup("SplineHorDown2"); frequenceApparition = 7; break; case 2: a = ListGroupEnemy.Vgroup("SplineCenterBackUp"); a.AddComponent <FireOneByOne>(); a.GetComponent <FireOneByOne>().tempsFireMax = 4; a = ListGroupEnemy.Vgroup("SplineCenterBackDown"); a.AddComponent <FireOneByOne>(); a.GetComponent <FireOneByOne>().tempsFireMax = 4; a = ListGroupEnemy.Vgroup("SplineHorCenter"); a.AddComponent <FireOneByOne>(); a.GetComponent <FireOneByOne>().tempsFireMax = 4; break; case 3: a = ListGroupEnemy.Igroup("SplineSnakeUp1"); a.AddComponent <FireOneByOne>(); a.GetComponent <FireOneByOne>().tempsFireMax = 4; a = ListGroupEnemy.Igroup("SplineSnakeDown1"); a.AddComponent <FireOneByOne>(); a.GetComponent <FireOneByOne>().tempsFireMax = 4; frequenceApparition = 1.5f; break; case 4: ListGroupEnemy.ArrowGroup("SplineHorCenter"); a.AddComponent <FireOneByOne>(); a.GetComponent <FireOneByOne>().tempsFireMax = 4; frequenceApparition = 7; break; case 5: a = ListGroupEnemy.Vgroup("SplineHorCenter"); a.AddComponent <FireOneByOne>(); a.GetComponent <FireOneByOne>().tempsFireMax = 4; frequenceApparition = 2; break; case 6: a = ListGroupEnemy.Vgroup("SplineHorUp1"); a.AddComponent <FireOneByOne>(); a.GetComponent <FireOneByOne>().tempsFireMax = 4; a = ListGroupEnemy.Vgroup("SplineHorDown1"); a.AddComponent <FireOneByOne>(); a.GetComponent <FireOneByOne>().tempsFireMax = 4; frequenceApparition = 4; break; case 7: a = ListGroupEnemy.Vgroup("SplineHorUp2"); a.AddComponent <FireOneByOne>(); a.GetComponent <FireOneByOne>().tempsFireMax = 4; a = ListGroupEnemy.Vgroup("SplineHorDown2"); a.AddComponent <FireOneByOne>(); a.GetComponent <FireOneByOne>().tempsFireMax = 4; a = ListGroupEnemy.Vgroup("SplineHorCenter"); a.AddComponent <FireOneByOne>(); a.GetComponent <FireOneByOne>().tempsFireMax = 4; frequenceApparition = 7; break; case 8: a = ListGroupEnemy.Vgroup("SplineSnakeUp1"); a.AddComponent <FireOneByOne>(); a.GetComponent <FireOneByOne>().tempsFireMax = 4; a = ListGroupEnemy.Vgroup("SplineSnakeDown1"); a.AddComponent <FireOneByOne>(); a.GetComponent <FireOneByOne>().tempsFireMax = 4; break; case 9: lastWave1 = ListGroupEnemy.ArrowGroup("SplineHorCenter"); frequenceApparition = 1; break; case 10: lastWave1 = ListGroupEnemy.ArrowGroup("SplineCenterBackDown"); lastWave1.AddComponent <FireOneByOne>(); lastWave1.GetComponent <FireOneByOne>().tempsFireMax = 4; lastWave2 = ListGroupEnemy.ArrowGroup("SplineDownHor1"); lastWave2.AddComponent <FireOneByOne>(); lastWave2.GetComponent <FireOneByOne>().tempsFireMax = 4; lastWave3 = ListGroupEnemy.ArrowGroup("SplineUpHor1"); lastWave3.AddComponent <FireOneByOne>(); lastWave3.GetComponent <FireOneByOne>().tempsFireMax = 4; frequenceApparition = 3; 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 = 7; if (tempsActuel > frequenceApparition && !lastWaveLaunched) { tempsActuel = 0; lastWave4 = ListGroupEnemy.CircleGroup("SplineHorCenter"); lastWaveLaunched = true; } else { tempsActuel += Time.deltaTime; } if (lastWaveLaunched && lastWave1 == null && lastWave2 == null && lastWave3 == null && lastWave4 == null) { lastWaveFinished = true; } } } else //FIN DU NIVEAU { GameObject.FindWithTag("Pattern").GetComponent <EndLevel>().endLevel = true; if (gain) { GameObject.FindWithTag("PlayerScript").GetComponent <Player>().GagnerArgent(3500); GameObject.FindWithTag("PlayerScript").GetComponent <Player>().Gagnerferraille(25); gain = false; } } }
// Update is called once per frame void Update() { if (bossWaveFinished) { 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 < 6) { //On fait arriver les enemy groupe par groupe ... if (beginGroup) { //... en piochant parmi les patternes (présent dasn ListGroupEnemy) switch (cptVague) // { case 0: ListGroupEnemy.Vgroup("SplineHorCenter"); break; case 1: ListGroupEnemy.Igroup("SplineCenterUp"); break; case 2: ListGroupEnemy.Igroup("SplineCenterDown"); break; case 3: ListGroupEnemy.Vgroup("SplineHorUp1"); break; case 4: ListGroupEnemy.Vgroup("SplineHorDown1"); break; case 5: ListGroupEnemy.Igroup("SplineCenterBackUp"); ListGroupEnemy.Igroup("SplineCenterBackDown"); 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 { //Si le boss n'est pas lancé (pour le faire une seule fois) if (!bossLaunched) { //Si la durée entre la derniere vague et mtn est assez grande if (tempsAvantBoss > tempsAvantBossMax) { //On lance le boss GameObject.FindWithTag("Pattern").GetComponent <ListGroupEnemy>().LaunchCroiseurGroup(enemy, Croiseur, new Vector3(bordDroite + 1, Random.Range(posMin, posMax), -15f)); bossLaunched = true; } else //Sinon, on attend { tempsAvantBoss += Time.deltaTime; } } else { if (GameObject.FindWithTag("GroupBoss").GetComponent <EnnemyMoveBossGroup> ().bossDead&& GameObject.FindWithTag("GroupBoss").GetComponent <EnnemyMoveBossGroup> ().listEnemy.Count == 0) { bossWaveFinished = true; } } } } else //FIN DU NIVEAU { GameObject.FindWithTag("Pattern").GetComponent <EndLevel>().endLevel = true; if (gain) { GameObject.FindWithTag("PlayerScript").GetComponent <Player>().GagnerArgent(1000); GameObject.FindWithTag("PlayerScript").GetComponent <Player>().Gagnerferraille(15); gain = false; } } }