Exemplo n.º 1
0
 public game3()
 {
    
     InitializeComponent();
     new Settings();
     //게임시작
     GameOverTimer.Tick += UpdateScreen;
     GameOverTimer.Start();
     StartGame();
        
 }
Exemplo n.º 2
0
        private void timer1_Tick(object sender, EventArgs e)
        {
            if (Game.Hero.Health >= 0)
            {
                HeroHealth.Value = Game.Hero.Health;
            }
            enemyTimerCounter++;

            if (Game.Level == 2)
            {
                Game.TimeCounter--;
            }

            if (enemyTimerCounter % 2 == 0 && Game.Level == 2 && Game.Enemies.Count == 0)
            {
                Game.TimeCounter--;
                enemyTimerCounter = 0;
                Game.addMeteor();
                Game.NextLevel();
            }

            if (enemyTimerCounter == 20 && Game.Level == 1)
            {
                enemyTimerCounter = 0;
                Game.addEnemy();
                Game.addMeteor();
            }
            Game.MoveEnemies();
            Game.MoveMeteors();
            Game.MoveBoss();

            if (Game.Level == 3 && Game.Boss.Health > 0)
            {
                BossHealth.Visible = true;
                BossHealth.Enabled = true;
                BossHealth.Value   = Game.Boss.Health;
            }

            if (Game.Hero.Health <= 0 || Game.Boss.Health <= 0)
            {
                Game.GameOver();
                HeroHealth.Visible = false;
                HeroHealth.Enabled = false;
                BossHealth.Visible = false;
                BossHealth.Enabled = false;
                GameOverTimer.Start();
                GameOverLabel.Visible = true;
                GameOverLabel.Enabled = true;
            }

            Game.CheckBulletsImpact();
            Game.CheckMeteorImpact();
        }
Exemplo n.º 3
0
        private void GameOverTimer_Tick(object sender, EventArgs e)
        {
            timer1.Stop();
            PickedHeroFlag = false;
            string Shipstate      = "DESTROYED";
            string Pilotstate     = "KIA";
            string Missiondebrief = "Due to the sheer number of enemies and unforseen space debries, the mission to intercept and deflect the incoming invasion has ended in failure" +
                                    "\n Your valiant effort and sacrifice will not be forgotten";
            string Missionend = "FAILED";

            // WON
            string ShipstateWon      = "FUNCTIONAL";
            string PilotStateWon     = "ALIVE";
            string MissionDebriefWon = "We have witnessed history, through your brave and gallant effort, the mission to intercept and deflect the incoming invasion was a success" +
                                       "\n Prepare yourself for the media, HERO";
            string MissionendWon = "SUCCESS";



            EndGameNewGameButton.Enabled = true;
            EndGameNewGameButton.Visible = true;

            EndGameQuitGameButton.Enabled = true;
            EndGameQuitGameButton.Visible = true;

            ShipStateLabel.Visible = true;
            ShipStateLabel.Enabled = true;

            PilotStateLabel.Visible = true;
            PilotStateLabel.Enabled = true;

            MissionDebriefLabel.Visible = true;
            MissionDebriefLabel.Enabled = true;

            MissionLabel.Visible = true;
            MissionLabel.Enabled = true;


            ShipStateTB.Visible = true;
            ShipStateTB.Enabled = true;

            PilotStateTB.Visible = true;
            PilotStateTB.Enabled = true;

            MissionDebriefTB.Visible = true;
            MissionDebriefTB.Enabled = true;

            MissionTB.Visible = true;
            MissionTB.Enabled = true;

            if (Game.Hero.Health <= 0)
            {
                for (int i = 0; i < Shipstate.Length; i++)
                {
                    Invoke(new MethodInvoker(delegate { ShipStateTB.AppendText(Shipstate[i].ToString()); }));
                    System.Threading.Thread.Sleep(150);
                    if (i == Shipstate.Length - 1)
                    {
                        break;
                    }
                }

                for (int i = 0; i < Pilotstate.Length; i++)
                {
                    Invoke(new MethodInvoker(delegate { PilotStateTB.AppendText(Pilotstate[i].ToString()); }));
                    System.Threading.Thread.Sleep(150);
                    if (i == Pilotstate.Length - 1)
                    {
                        break;
                    }
                }

                for (int i = 0; i < Missiondebrief.Length; i++)
                {
                    Invoke(new MethodInvoker(delegate { MissionDebriefTB.AppendText(Missiondebrief[i].ToString()); }));
                    System.Threading.Thread.Sleep(10);
                    if (i == Missiondebrief.Length - 1)
                    {
                        break;
                    }
                }

                for (int i = 0; i < Missionend.Length; i++)
                {
                    Invoke(new MethodInvoker(delegate { MissionTB.AppendText(Missionend[i].ToString()); }));
                    System.Threading.Thread.Sleep(150);
                    Game.Hero.Health = 100;
                    if (i == Missionend.Length - 1)
                    {
                        break;
                    }
                }
            }
            else if (Game.Boss.Health <= 0)
            {
                for (int i = 0; i < ShipstateWon.Length; i++)
                {
                    Invoke(new MethodInvoker(delegate { ShipStateTB.AppendText(ShipstateWon[i].ToString()); }));
                    System.Threading.Thread.Sleep(150);
                    if (i == ShipstateWon.Length - 1)
                    {
                        break;
                    }
                }

                for (int i = 0; i < PilotStateWon.Length; i++)
                {
                    Invoke(new MethodInvoker(delegate { PilotStateTB.AppendText(PilotStateWon[i].ToString()); }));
                    System.Threading.Thread.Sleep(150);
                    if (i == PilotStateWon.Length - 1)
                    {
                        break;
                    }
                }

                for (int i = 0; i < MissionDebriefWon.Length; i++)
                {
                    Invoke(new MethodInvoker(delegate { MissionDebriefTB.AppendText(MissionDebriefWon[i].ToString()); }));
                    System.Threading.Thread.Sleep(10);
                    if (i == MissionDebriefWon.Length - 1)
                    {
                        break;
                    }
                }

                for (int i = 0; i < MissionendWon.Length; i++)
                {
                    Invoke(new MethodInvoker(delegate { MissionTB.AppendText(MissionendWon[i].ToString()); }));
                    System.Threading.Thread.Sleep(150);
                    Game.Boss.Health = 150;
                    if (i == MissionendWon.Length - 1)
                    {
                        break;
                    }
                }
            }
            GameOverTimer.Stop();
        }