Пример #1
0
 void OnCollisionEnter2D(Collision2D col)
 {
     if (col.gameObject.tag == tag)
     {
         Destroy(col.gameObject);
         feedback.GetComponent <ScoreFeedback>().correct();
         Scorecounter.updateScore(1);
     }
     if (col.gameObject.tag != tag)
     {
         Destroy(col.gameObject);
         feedback.GetComponent <ScoreFeedback>().incorrect();
         Scorecounter.updateScore(-1);
     }
 }
    // Update is called once per frame
    void Update()
    {
        if (haltUpdate)
        {
            return;
        }

        timeElapsed += Time.deltaTime * 1000;
        GameObject.Find("Radial").GetComponent <Image>().fillAmount = 1 - timeElapsed / gameDuration;
        setTimerText("" + (int)(gameDuration - timeElapsed) / 1000);


        if (timeElapsed >= gameDuration)
        {
            // Terminate game
            haltUpdate     = true;
            Time.timeScale = 0;                                                          //temp
            GameObject.Find("PauseButton").GetComponent <Button>().interactable = false; // Disable UI buttons
            Add_scene("ResultScene");

            // Calculate score
            int rating = Scorecounter.getRating();
            int score  = Scorecounter.getScore();

            GameObject[] goa = SceneManager.GetSceneByName("ResultScene").GetRootGameObjects();
            foreach (GameObject go in goa)
            {
                print("test");
                if (go.name == "ResultsCanvas")
                {
                    print("HYPE");
                    go.GetComponent <ResultsRating>().setRating(score, rating);
                }
            }
        }
    }
Пример #3
0
 public void Start()
 {
     setRating(Scorecounter.getScore(), Scorecounter.getRating());
 }
Пример #4
0
        public Gamestate(Texture2D gun_light, Texture2D shadow, Texture2D[] tele_anim, Action exit, SoundEffect footstep1, SoundEffect footstep2, SoundEffect footstep3, SoundEffect ka_ching, Song gunshop_song, Texture2D gunshop_img, Texture2D gunshop_bg, Song intro_music, Texture2D menu_bg, Texture2D settings, Song gunready, SoundEffect gunfire1, SoundEffect gunfire2,
                         SoundEffect mp7a1_sound, Texture2D fire1, Texture2D fire2, Texture2D ammobox, Texture2D[] punchanim, Texture2D[] enemy_punchanim,
                         Texture2D chrtr, Texture2D chrtrw1, Texture2D chrtrw2, Texture2D enemy_chrtr, Texture2D enemy_chrtrw1, Texture2D enemy_chrtrw2, Texture2D fiftyblack, Texture2D whitep,
                         Texture2D pistol_gun_img, Texture2D rifle_gun_img, Texture2D hands_gun_img, Texture2D lantern, Texture2D pistol_icon,
                         Texture2D rifle_icon, Texture2D hands_icon, Texture2D background1, Texture2D background2, Texture2D background3,
                         Texture2D background4, Texture2D background5, Texture2D background6, Texture2D background7, Texture2D background8,
                         Texture2D background9, Texture2D fence, Texture2D licht, Texture2D analogarea_img, Texture2D analogstick_img,
                         Texture2D button_A, Texture2D button_B, Texture2D button_X, Texture2D mp7a1_icon, Texture2D mp7a1_gun, Texture2D big_enemy, Texture2D big_enemy_walk1, Texture2D big_enemy_Walk2,
                         Texture2D bg2_1, Texture2D bg2_1_prop, Texture2D bg2_2, Texture2D bg2_3, Texture2D bg2_4)
        {
            this.GameHeight = Game1.GameHeight;
            this.GameWidth  = Game1.GameWidth;

            this.StartScreen    = new List <GuiElement>();
            this.BackgroundList = new List <GuiElement>();
            this.MidList        = new List <GuiElement>();
            this.ForegroundList = new List <GuiElement>();
            this.UiList         = new List <GuiElement>();
            this.enemylist      = new List <Enemy>();
            this.big_enemylist  = new List <Big_Enemy>();
            MainList            = new List <List <GuiElement> >();
            MainList.Add(BackgroundList);
            MainList.Add(MidList);
            MainList.Add(ForegroundList);
            MainList.Add(UiList);

            this.paused         = false;
            this.gamestarted    = false;
            this.gunshop_active = false;
            this.game_over      = false;

            this.Walkanim    = new Texture2D[4];
            this.Walkanim[0] = chrtr;
            this.Walkanim[1] = chrtrw1;
            this.Walkanim[2] = chrtr;
            this.Walkanim[3] = chrtrw2;

            this.enemy_Walkanim    = new Texture2D[4];
            this.enemy_Walkanim[0] = enemy_chrtr;
            this.enemy_Walkanim[1] = enemy_chrtrw1;
            this.enemy_Walkanim[2] = enemy_chrtr;
            this.enemy_Walkanim[3] = enemy_chrtrw2;

            this.big_enemy_Walkanim    = new Texture2D[4];
            this.big_enemy_Walkanim[0] = big_enemy;
            this.big_enemy_Walkanim[1] = big_enemy_walk1;
            this.big_enemy_Walkanim[2] = big_enemy;
            this.big_enemy_Walkanim[3] = big_enemy_Walk2;

            this.Ammobox = ammobox;

            this.mp7a1  = new Gun(gun_light, mp7a1_sound, whitep, 0.4f, 96, mp7a1_gun, mp7a1_icon, fire1, fire2, (int)(GameWidth / 7.407), (int)(GameWidth / 21.052), (int)(GameWidth / 110), 28, 1.67, 3, 7);
            this.pistol = new Gun(gun_light, gunfire2, whitep, 1, 99, pistol_gun_img, pistol_icon, fire1, fire2, (int)(GameWidth / 7.407), (int)(GameWidth / 21.052), (int)(GameWidth / 110), 42.105, 2, 3, 25);
            this.rifle  = new Gun(gun_light, gunfire1, whitep, 0.8f, 98, rifle_gun_img, rifle_icon, fire1, fire2, (int)(GameWidth / 7.407), (int)(GameWidth / 21.052), 0, 17.02, 1.3, 3.5, 11);
            this.hands  = new Gun(gun_light, gunfire1, whitep, 0f, 97, hands_gun_img, hands_icon, fire1, fire2, (int)(GameWidth / 7.407), (int)(GameWidth / 21.052), 0, 17.02, 1.3, 3.5, 11);

            this.lantern1 = new Image(121, lantern, (int)(GameWidth / 10), (int)(GameWidth / 25), (int)(GameWidth / 17), (int)(GameWidth / 4.444));
            this.lantern2 = new Image(122, lantern, (int)(GameWidth / 2.285), (int)(GameWidth / 25), (int)(GameWidth / 17), (int)(GameWidth / 4.444));
            this.lantern3 = new Image(123, lantern, (int)(GameWidth / 1.29), (int)(GameWidth / 25), (int)(GameWidth / 17), (int)(GameWidth / 4.444));
            this.lantern4 = new Image(124, lantern, (int)(GameWidth / 3), (int)(GameWidth / 25), (int)(GameWidth / 17), (int)(GameWidth / 4.444));
            this.lantern5 = new Image(125, lantern, (int)(GameWidth / 1.5), (int)(GameWidth / 25), (int)(GameWidth / 17), (int)(GameWidth / 4.444));

            this.light1 = new Light(131, licht, 0, (int)(GameWidth / 25), (int)(GameWidth / 4.04), (int)(GameWidth / 2.72));
            this.light2 = new Light(132, licht, (int)(GameWidth / 2.96), (int)(GameWidth / 25), (int)(GameWidth / 4.04), (int)(GameWidth / 2.72));
            this.light3 = new Light(133, licht, (int)(GameWidth / 1.48), (int)(GameWidth / 25), (int)(GameWidth / 4.04), (int)(GameWidth / 2.72));
            this.light4 = new Light(134, licht, (int)(GameWidth / 4.333), (int)(GameWidth / 25), (int)(GameWidth / 4.04), (int)(GameWidth / 2.72));
            this.light5 = new Light(135, licht, (int)(GameWidth / 1.764), (int)(GameWidth / 25), (int)(GameWidth / 4.04), (int)(GameWidth / 2.72));

            this.gunmanager = new GunManager(104, gunready, fiftyblack, this.hands, this.pistol, this.rifle, this.mp7a1);
            this.BG1        = new Image(1, background1, 0, 0, GameWidth, GameHeight);
            this.BG2        = new Image(1, background2, 0, 0, GameWidth, GameHeight);
            this.BG3        = new Image(1, background3, 0, 0, GameWidth, GameHeight);
            this.BG4        = new Image(1, background4, 0, 0, GameWidth, GameHeight);
            this.BG5        = new Image(1, background5, 0, 0, GameWidth, GameHeight);
            this.BG6        = new Image(1, background6, 0, 0, GameWidth, GameHeight);
            this.BG7        = new Image(1, background7, 0, 0, GameWidth, GameHeight);
            this.BG8        = new Image(1, background8, 0, 0, GameWidth, GameHeight);
            this.BG9        = new Image(1, background9, 0, 0, GameWidth, GameHeight);

            this.BG2_1      = new Image(0, bg2_1, 0, 0, GameWidth, GameHeight);
            this.BG2_1_prop = new Image(0, bg2_1_prop, (int)(Game1.GameWidth / 1.639), (int)(Game1.GameWidth / 10.3), (int)(Game1.GameWidth / 2.564), (int)(Game1.GameWidth / 3.125));
            this.BG2_2      = new Image(0, bg2_2, 0, 0, GameWidth, GameHeight);
            this.BG2_3      = new Image(0, bg2_3, 0, 0, GameWidth, GameHeight);
            this.BG2_4      = new Image(0, bg2_4, 0, 0, GameWidth, GameHeight);

            this.Fence1 = new Image(1, fence, 0, (int)(Game1.GameWidth / 2.857), (int)(Game1.GameWidth / 2), (int)(Game1.GameWidth / 15.686));
            this.Fence2 = new Image(1, fence, (int)(GameWidth / 2), (int)(Game1.GameWidth / 2.857), (int)(Game1.GameWidth / 2), (int)(Game1.GameWidth / 15.686));

            this.analogarea        = new Image(4, analogarea_img, (int)(GameWidth / 80), (int)(GameWidth / 2.6666), (int)(GameWidth / 5.333333), (int)(GameWidth / 5.333333));
            this.analogstick       = new TouchButton(5, analogstick_img, (int)(GameWidth / 13.33333), (int)(GameWidth / 2.2857), (int)(GameWidth / 16), (int)(GameWidth / 16));
            this.player            = new Player(6, shadow, footstep1, footstep2, footstep3, chrtr, this.Walkanim, punchanim, whitep, analogstick, gunmanager, (int)(GameWidth / 16), (int)(GameWidth / 3.2), (int)(GameWidth / 12.5), (int)(GameWidth / 10));
            this.A_Button          = new Button(20, "", button_A, (int)(GameWidth / 1.739), (int)(GameWidth / 2.2), (int)(GameWidth / 12.307), (int)(GameWidth / 12.307), () => { });
            this.B_Button          = new Button(21, "", button_B, (int)(GameWidth / 1.428), (int)(GameWidth / 2.329), (int)(GameWidth / 12.307), (int)(GameWidth / 12.307), () => { player.Attack(); });
            this.X_Button          = new Button(22, "", button_X, (int)(GameWidth / 1.212), (int)(GameWidth / 2.474), (int)(GameWidth / 12.307), (int)(GameWidth / 12.307), () => { player.jumpbool = true; });
            this.moneycheat_button = new Button(0, "add 1000 score", fiftyblack, (int)(GameWidth / 2), (int)(GameWidth / 5.333), (int)(GameWidth / 4), (int)(GameWidth / 16), () => { if (!this.moneycheat_button.active)
                                                                                                                                                                                      {
                                                                                                                                                                                          player.score += 1000;
                                                                                                                                                                                      }
                                                                                                                                                                                      ; });
            this.skipstage_button = new Button(0, "Skip stage", fiftyblack, (int)(GameWidth / 2), (int)(GameWidth / 4), (int)(GameWidth / 4), (int)(GameWidth / 16), () => { if (!this.skipstage_button.active && this.current_level.Next != null)
                                                                                                                                                                             {
                                                                                                                                                                                 this.current_level = this.current_level.NextLevel(); this.current_level.OnEnter();
                                                                                                                                                                             }
                                                                                                                                                                             ; });

            this.enemy1  = new Enemy(0, shadow, enemy_chrtr, whitep, this.enemy_Walkanim, enemy_punchanim, (int)(GameWidth / 1.5), (int)(GameWidth / 3.1));
            this.enemy2  = new Enemy(0, shadow, enemy_chrtr, whitep, this.enemy_Walkanim, enemy_punchanim, (int)(GameWidth / 1.2), (int)(GameWidth / 3.2));
            this.enemy3  = new Enemy(0, shadow, enemy_chrtr, whitep, this.enemy_Walkanim, enemy_punchanim, (int)(GameWidth / 1.5), (int)(GameWidth / 3.3));
            this.enemy4  = new Enemy(0, shadow, enemy_chrtr, whitep, this.enemy_Walkanim, enemy_punchanim, (int)(GameWidth / 1.35), (int)(GameWidth / 3.1));
            this.enemy5  = new Enemy(0, shadow, enemy_chrtr, whitep, this.enemy_Walkanim, enemy_punchanim, (int)(GameWidth / 1.2), (int)(GameWidth / 3.2));
            this.enemy6  = new Enemy(0, shadow, enemy_chrtr, whitep, this.enemy_Walkanim, enemy_punchanim, (int)(GameWidth / 1), (int)(GameWidth / 3.3));
            this.enemy7  = new Enemy(0, shadow, enemy_chrtr, whitep, this.enemy_Walkanim, enemy_punchanim, (int)(GameWidth / 1.5), (int)(GameWidth / 3.2));
            this.enemy8  = new Enemy(0, shadow, enemy_chrtr, whitep, this.enemy_Walkanim, enemy_punchanim, (int)(GameWidth / 1.2), (int)(GameWidth / 3.1));
            this.enemy9  = new Enemy(0, shadow, enemy_chrtr, whitep, this.enemy_Walkanim, enemy_punchanim, (int)(GameWidth / 1.45), (int)(GameWidth / 3.2));
            this.enemy10 = new Enemy(0, shadow, enemy_chrtr, whitep, this.enemy_Walkanim, enemy_punchanim, (int)(GameWidth / 1.3), (int)(GameWidth / 3.3));
            this.enemy11 = new Enemy(0, shadow, enemy_chrtr, whitep, this.enemy_Walkanim, enemy_punchanim, (int)(GameWidth / 1.2), (int)(GameWidth / 3.1));
            this.enemy12 = new Enemy(0, shadow, enemy_chrtr, whitep, this.enemy_Walkanim, enemy_punchanim, (int)(GameWidth / 1.1), (int)(GameWidth / 3.2));
            this.enemy13 = new Enemy(0, shadow, enemy_chrtr, whitep, this.enemy_Walkanim, enemy_punchanim, (int)(GameWidth / 1.15), (int)(GameWidth / 3.3));

            this.big_enemy1 = new Big_Enemy(0, shadow, big_enemy, whitep, this.big_enemy_Walkanim, (int)(GameWidth / 1.5), (int)(GameWidth / 3.2));
            this.big_enemy2 = new Big_Enemy(0, shadow, big_enemy, whitep, this.big_enemy_Walkanim, (int)(GameWidth / 1.2), (int)(GameWidth / 3.2));
            this.big_enemy3 = new Big_Enemy(0, shadow, big_enemy, whitep, this.big_enemy_Walkanim, (int)(GameWidth / 1.4), (int)(GameWidth / 3.2));
            this.big_enemy4 = new Big_Enemy(0, shadow, big_enemy, whitep, this.big_enemy_Walkanim, (int)(GameWidth / 1.3), (int)(GameWidth / 3.2));

            this.l1_1 = new Level(BG1, null, null, BackgroundList, MidList, ForegroundList, UiList, enemylist, big_enemylist,
                                  new List <Enemy> {
            },
                                  new List <Big_Enemy> {
            },
                                  () => { this.AddToFront(light1); this.AddToFront(light2); this.AddToFront(light3); },
                                  () => { },
                                  () => { this.AddToBack(lantern1); this.AddToBack(lantern2); this.AddToBack(lantern3); this.AddToBack(gunstore); },
                                  () => {});

            this.l1_2 = new Level(BG2, null, null, BackgroundList, MidList, ForegroundList, UiList, enemylist, big_enemylist,
                                  new List <Enemy> {
                enemy1
            },
                                  new List <Big_Enemy> {
            },
                                  () => { this.AddToFront(light4); this.AddToFront(light5); },
                                  () => { },
                                  () => { this.AddToBack(lantern4); this.AddToBack(lantern5); },
                                  () => {});

            this.l1_3 = new Level(BG3, null, null, BackgroundList, MidList, ForegroundList, UiList, enemylist, big_enemylist,
                                  new List <Enemy> {
                enemy2, enemy3
            },
                                  new List <Big_Enemy> {
            },
                                  () => { },
                                  () => { },
                                  () => { },
                                  () => {});

            this.l1_4 = new Level(BG4, null, null, BackgroundList, MidList, ForegroundList, UiList, enemylist, big_enemylist,
                                  new List <Enemy> {
                enemy4, enemy5, enemy6
            },
                                  new List <Big_Enemy> {
            },
                                  () => { this.AddToFront(Fence2); },
                                  () => { },
                                  () => { this.AddToBack(gunstore); },
                                  () => {});

            this.l1_5 = new Level(BG5, null, null, BackgroundList, MidList, ForegroundList, UiList, enemylist, big_enemylist,
                                  new List <Enemy> {
            },
                                  new List <Big_Enemy> {
                big_enemy1
            },
                                  () => { this.AddToFront(Fence1); this.AddToFront(Fence2); },
                                  () => { },
                                  () => { },
                                  () => {});

            this.l1_6 = new Level(BG6, null, null, BackgroundList, MidList, ForegroundList, UiList, enemylist, big_enemylist,
                                  new List <Enemy> {
                enemy7, enemy8, enemy9, enemy10
            },
                                  new List <Big_Enemy> {
            },
                                  () => { this.AddToFront(Fence1); this.AddToFront(Fence2); },
                                  () => { },
                                  () => { },
                                  () => {});

            this.l1_7 = new Level(BG7, null, null, BackgroundList, MidList, ForegroundList, UiList, enemylist, big_enemylist,
                                  new List <Enemy> {
                enemy11, enemy12
            },
                                  new List <Big_Enemy> {
                big_enemy2
            },
                                  () => { },
                                  () => { },
                                  () => { this.AddToBack(gunstore); },
                                  () => {});

            this.l1_8 = new Level(BG8, null, null, BackgroundList, MidList, ForegroundList, UiList, enemylist, big_enemylist,
                                  new List <Enemy> {
                enemy13
            },
                                  new List <Big_Enemy> {
                big_enemy3, big_enemy4
            },
                                  () => { },
                                  () => { },
                                  () => { },
                                  () => {});

            this.l1_9 = new Level(BG9, null, null, BackgroundList, MidList, ForegroundList, UiList, enemylist, big_enemylist,
                                  new List <Enemy> {
            },
                                  new List <Big_Enemy> {
            },
                                  () => { },
                                  () => { },
                                  () => { },
                                  () => { if (this.player.x > (int)(Game1.GameWidth / 2))
                                          {
                                              this.game_over = true;
                                          }
                                  });

            this.l2_1 = new Level(BG2_1, null, null, BackgroundList, MidList, ForegroundList, UiList, enemylist, big_enemylist,
                                  new List <Enemy> {
            },
                                  new List <Big_Enemy> {
            },
                                  () => { this.AddToFront(this.BG2_1_prop); this.AddToFront(light1); this.AddToFront(light2); },
                                  () => { },
                                  () => { this.AddToBack(lantern1); this.AddToBack(lantern2); },
                                  () => {});

            this.l2_2 = new Level(BG2_2, null, null, BackgroundList, MidList, ForegroundList, UiList, enemylist, big_enemylist,
                                  new List <Enemy> {
            },
                                  new List <Big_Enemy> {
            },
                                  () => { },
                                  () => { },
                                  () => { },
                                  () => { });

            this.l2_3 = new Level(BG2_3, null, null, BackgroundList, MidList, ForegroundList, UiList, enemylist, big_enemylist,
                                  new List <Enemy> {
            },
                                  new List <Big_Enemy> {
            },
                                  () => { },
                                  () => { },
                                  () => { },
                                  () => { });

            this.l2_4 = new Level(BG2_4, null, null, BackgroundList, MidList, ForegroundList, UiList, enemylist, big_enemylist,
                                  new List <Enemy> {
            },
                                  new List <Big_Enemy> {
            },
                                  () => { },
                                  () => { },
                                  () => { },
                                  () => { });

            this.current_level = l1_1;

            this.l1_1.Next = l1_2; this.l1_2.Prev = l1_1;
            this.l1_2.Next = l1_3; this.l1_3.Prev = l1_2;
            this.l1_3.Next = l1_4; this.l1_4.Prev = l1_3;
            this.l1_4.Next = l1_5; this.l1_5.Prev = l1_4;
            this.l1_5.Next = l1_6; this.l1_6.Prev = l1_5;
            this.l1_6.Next = l1_7; this.l1_7.Prev = l1_6;
            this.l1_7.Next = l1_8; this.l1_8.Prev = l1_7;
            this.l1_8.Next = l1_9; this.l1_9.Prev = l1_8;

            this.l2_1.Next = l2_2; this.l2_2.Prev = l2_1;
            this.l2_2.Next = l2_3; this.l2_3.Prev = l2_2;
            this.l2_3.Next = l2_4; this.l2_4.Prev = l2_3;



            this.player1score   = new Scorecounter((int)(Game1.GameWidth / 80), (int)(Game1.GameWidth / 16), player);
            this.keyboard       = new VirtKeyBoard(fiftyblack, "enter name", player, () => { this.StartScreen.Add(this.start_button); this.StartScreen.Add(this.name_change); this.StartScreen.Remove(keyboard); });
            this.settingsbutton = new Button(1, "", settings, 0, 0, (int)(GameWidth / 16), (int)(GameWidth / 16), () => { this.paused = true; });
            this.contbg         = new Image(1, fiftyblack, 0, (int)(GameWidth / 16), GameWidth, (int)(GameWidth / 2.105));
            this.Menu_bg        = new Image(1, menu_bg, 0, 0, Game1.GameWidth, Game1.GameHeight);
            this.start_button   = new Button(1, "START", fiftyblack, GameWidth / 2 - (int)(GameWidth / 6.5), GameHeight / 2, (int)(GameWidth / 3.8), (int)(GameWidth / 13), () => { this.gamestarted = true; this.paused = false; this.gunshop_active = false; MediaPlayer.Stop(); });
            this.name_change    = new Button(1, "CHANGE NAME", fiftyblack, GameWidth / 2 - (int)(GameWidth / 6.5), GameHeight / 2 + (int)(GameWidth / 9), (int)(GameWidth / 3.8), (int)(GameWidth / 13), () => { this.StartScreen.Remove(this.start_button); this.StartScreen.Remove(this.name_change); this.StartScreen.Add(keyboard); Thread.Sleep(120); });
            this.gunstore       = new Gunstore(gunshop_img, ka_ching, gunshop_song, fiftyblack, gunshop_bg, mp7a1_gun, rifle_gun_img, pistol_gun_img, whitep, (int)(Game1.GameWidth / 4), (int)(Game1.GameWidth / 8), player, A_Button, () => { this.gunshop_active = true; this.gunmanager.currentgun = this.gunmanager.Gun1; this.player1score.y = (int)(Game1.GameWidth / 1.95); }, () => { this.gunshop_active = false; this.player1score.y = (int)(Game1.GameWidth / 16); });

            this.fps_switch = new ONOFFswitch("Draw FPS", (int)(GameWidth / 16), (int)(GameWidth / 5.333), whitep, analogstick_img);
            this.op2        = new ONOFFswitch("GodMode", (int)(GameWidth / 16), (int)(GameWidth / 4), whitep, analogstick_img);
            this.op3        = new ONOFFswitch("Skip Stage", (int)(GameWidth / 16), (int)(GameWidth / 3.2), whitep, analogstick_img);
            this.op4        = new ONOFFswitch("Option", (int)(GameWidth / 16), (int)(GameWidth / 2.666), whitep, analogstick_img);

            this.retry_button = new Button(1, "Retry", fiftyblack, GameWidth / 2 - (int)(GameWidth / 6.5), GameHeight / 2 + (int)(GameWidth / 12), (int)(GameWidth / 3.8), (int)(GameWidth / 13), () => {
                this.current_level = l1_1;

                this.MidList.Remove(enemy1); this.enemylist.Remove(enemy1);
                this.MidList.Remove(enemy2); this.enemylist.Remove(enemy2);
                this.MidList.Remove(enemy3); this.enemylist.Remove(enemy3);
                this.MidList.Remove(enemy4); this.enemylist.Remove(enemy4);
                this.MidList.Remove(enemy5); this.enemylist.Remove(enemy5);
                this.MidList.Remove(enemy6); this.enemylist.Remove(enemy6);
                this.MidList.Remove(enemy7); this.enemylist.Remove(enemy7);
                this.MidList.Remove(enemy8); this.enemylist.Remove(enemy8);
                this.MidList.Remove(enemy9); this.enemylist.Remove(enemy9);
                this.MidList.Remove(enemy10); this.enemylist.Remove(enemy10);
                this.MidList.Remove(enemy11); this.enemylist.Remove(enemy11);
                this.MidList.Remove(enemy12); this.enemylist.Remove(enemy12);
                this.MidList.Remove(enemy13); this.enemylist.Remove(enemy13);

                this.MidList.Remove(big_enemy1); this.big_enemylist.Remove(big_enemy1);
                this.MidList.Remove(big_enemy2); this.big_enemylist.Remove(big_enemy2);
                this.MidList.Remove(big_enemy3); this.big_enemylist.Remove(big_enemy3);
                this.MidList.Remove(big_enemy4); this.big_enemylist.Remove(big_enemy4);

                this.BackgroundList.RemoveRange(0, BackgroundList.Count);
                this.MidList.RemoveRange(0, MidList.Count);
                this.UiList.RemoveRange(0, UiList.Count);
                this.ForegroundList.RemoveRange(0, ForegroundList.Count);

                this.AddToBack(BG1);
                this.AddToBack(lantern1);
                this.AddToBack(lantern2);
                this.AddToBack(lantern3);
                this.AddToFront(light1);
                this.AddToFront(light2);
                this.AddToFront(light3);
                this.AddToBack(gunstore);
                this.AddToUI(player1score);
                this.AddToUI(analogarea);
                this.AddToUI(analogstick);
                this.AddToMid(player);
                this.AddToUI(A_Button);
                this.AddToUI(B_Button);
                this.AddToUI(X_Button);
                this.AddToMid(gunmanager);
                this.AddToUI(settingsbutton);

                this.enemy1  = new Enemy(0, shadow, enemy_chrtr, whitep, this.enemy_Walkanim, enemy_punchanim, (int)(GameWidth / 1.5), (int)(GameWidth / 3.1));
                this.enemy2  = new Enemy(0, shadow, enemy_chrtr, whitep, this.enemy_Walkanim, enemy_punchanim, (int)(GameWidth / 1.2), (int)(GameWidth / 3.2));
                this.enemy3  = new Enemy(0, shadow, enemy_chrtr, whitep, this.enemy_Walkanim, enemy_punchanim, (int)(GameWidth / 1.5), (int)(GameWidth / 3.3));
                this.enemy4  = new Enemy(0, shadow, enemy_chrtr, whitep, this.enemy_Walkanim, enemy_punchanim, (int)(GameWidth / 1.35), (int)(GameWidth / 3.1));
                this.enemy5  = new Enemy(0, shadow, enemy_chrtr, whitep, this.enemy_Walkanim, enemy_punchanim, (int)(GameWidth / 1.2), (int)(GameWidth / 3.2));
                this.enemy6  = new Enemy(0, shadow, enemy_chrtr, whitep, this.enemy_Walkanim, enemy_punchanim, (int)(GameWidth / 1), (int)(GameWidth / 3.3));
                this.enemy7  = new Enemy(0, shadow, enemy_chrtr, whitep, this.enemy_Walkanim, enemy_punchanim, (int)(GameWidth / 1.5), (int)(GameWidth / 3.2));
                this.enemy8  = new Enemy(0, shadow, enemy_chrtr, whitep, this.enemy_Walkanim, enemy_punchanim, (int)(GameWidth / 1.2), (int)(GameWidth / 3.1));
                this.enemy9  = new Enemy(0, shadow, enemy_chrtr, whitep, this.enemy_Walkanim, enemy_punchanim, (int)(GameWidth / 1.45), (int)(GameWidth / 3.2));
                this.enemy10 = new Enemy(0, shadow, enemy_chrtr, whitep, this.enemy_Walkanim, enemy_punchanim, (int)(GameWidth / 1.3), (int)(GameWidth / 3.3));
                this.enemy11 = new Enemy(0, shadow, enemy_chrtr, whitep, this.enemy_Walkanim, enemy_punchanim, (int)(GameWidth / 1.2), (int)(GameWidth / 3.1));
                this.enemy12 = new Enemy(0, shadow, enemy_chrtr, whitep, this.enemy_Walkanim, enemy_punchanim, (int)(GameWidth / 1.1), (int)(GameWidth / 3.2));
                this.enemy13 = new Enemy(0, shadow, enemy_chrtr, whitep, this.enemy_Walkanim, enemy_punchanim, (int)(GameWidth / 1.15), (int)(GameWidth / 3.3));

                this.big_enemy1 = new Big_Enemy(0, shadow, big_enemy, whitep, this.big_enemy_Walkanim, (int)(GameWidth / 1.5), (int)(GameWidth / 3.2));
                this.big_enemy2 = new Big_Enemy(0, shadow, big_enemy, whitep, this.big_enemy_Walkanim, (int)(GameWidth / 1.2), (int)(GameWidth / 3.2));
                this.big_enemy3 = new Big_Enemy(0, shadow, big_enemy, whitep, this.big_enemy_Walkanim, (int)(GameWidth / 1.4), (int)(GameWidth / 3.2));
                this.big_enemy4 = new Big_Enemy(0, shadow, big_enemy, whitep, this.big_enemy_Walkanim, (int)(GameWidth / 1.3), (int)(GameWidth / 3.2));

                this.player.x      = (int)(Game1.GameWidth / 40);
                this.player.score  = 500;
                this.player.health = 100;

                this.gunmanager.gunlist.RemoveAll(gun => gun == gun);
                this.gunmanager.gunlist.Add(this.gunmanager.Gun1);
                this.gunmanager.currentgun = this.gunmanager.Gun1;

                this.endscreen.reset();
                this.gamestarted = false;
                this.game_over   = false;
            });
            this.next_level  = new Button(1, "Next Level", fiftyblack, GameWidth / 2 - (int)(GameWidth / 6.5), GameHeight / 2 + (int)(GameWidth / 12), (int)(GameWidth / 3.8), (int)(GameWidth / 13), () => { });
            this.exit_button = new Button(1, "Exit Game", fiftyblack, GameWidth / 2 - (int)(GameWidth / 6.5), GameHeight / 2 + (int)(GameWidth / 6), (int)(GameWidth / 3.8), (int)(GameWidth / 13), () => { exit(); });
            this.endscreen   = new GameOver(player, exit_button, next_level, fiftyblack, tele_anim, () => { this.player.x = (int)(Game1.GameWidth / 8); this.player.y = (int)(Game1.GameHeight / 2); this.game_over = false; this.current_level = l2_1; this.current_level.OnEnter(); });
            this.cont        = new Button(1, "BACK", fiftyblack, (int)(GameWidth / 80), (int)(GameWidth / 13.333), (int)(GameWidth / 4.444), (int)(GameWidth / 16), () => { this.paused = false; });
            this.Intro_Music = intro_music;


            this.StartScreen.Add(Menu_bg);
            this.StartScreen.Add(start_button);
            this.StartScreen.Add(name_change);

            this.current_level.OnEnter();
            this.AddToUI(player1score);
            this.AddToUI(analogarea);
            this.AddToUI(analogstick);
            this.AddToMid(player);
            this.AddToUI(A_Button);
            this.AddToUI(B_Button);
            this.AddToUI(X_Button);
            this.AddToUI(settingsbutton);
        }
 // Use this for initialization
 void Start()
 {
     timeElapsed    = 0;
     Time.timeScale = 1;
     Scorecounter.reset();
 }
Пример #6
0
 public void Start()
 {
     Scorecounter.setRatingRequirements(rating1, rating2, rating3);
 }