Пример #1
0
 private void IntroTimer_Tick(object sender, EventArgs e)
 {
     StateOfTheGame = GameStates.LoadBullet;
     IntroTimer.Stop();
 }
Пример #2
0
        private void pnl_canvas_MouseDown(object sender, MouseEventArgs e)
        {
            switch (StateOfTheGame)
            {
            case GameStates.Intro:     //skip intro
                StateOfTheGame = GameStates.LoadBullet;
                IntroTimer.Stop();
                break;

            case GameStates.LoadBullet:
                if (e.X > 130 && e.X < 180 && e.Y > 285 && e.Y < 385)     //user clicked on first bullet
                {
                    BulletLoad = true;
                    GameAudio  = new SoundPlayer(Properties.Resources.Load);
                    GameAudio.Play();
                }
                break;

            case GameStates.SpinChamber:
                if (e.X > 350 && e.X < 445 && e.Y > 75 && e.Y < 170)     //user clicked on Chamber
                {
                    GameAudio = new SoundPlayer(Properties.Resources.Chamber);
                    GameAudio.Play();
                    Anim_SpinChamber.Advance();
                }
                break;

            case GameStates.PointDirection:
                if (e.X > pnl_canvas.Width / 2)     //user clicked on Point Away
                {
                    PointingAway      = true;
                    PointAwayChances -= 1;           //used up a chance
                }
                else if (e.X < pnl_canvas.Width / 2) // user clicks on Point at user
                {
                    PointingAway = false;
                }
                PointDirectionTimer.Start();
                break;

            case GameStates.Fire:
                if (PointingAway)
                {
                    if (e.X > 123 && e.X < 160 && e.Y > 90 && e.Y < 125 && Hammer == false)     //user clicked on Hammer alt
                    {
                        GameAudio = new SoundPlayer(Properties.Resources.Hammer);
                        GameAudio.Play();
                        Hammer = true;
                        Anim_AltFire.Advance();
                    }
                    if (e.X > 175 && e.X < 220 && e.Y > 230 && e.Y < 290 && Hammer == true)     //user clicked on Trigger alt
                    {
                        Triggered = true;
                    }
                }
                else                                                                        //!PointingAway
                {
                    if (e.X > 400 && e.X < 430 && e.Y > 90 && e.Y < 125 && Hammer == false) //user clicked on Hammer
                    {
                        GameAudio = new SoundPlayer(Properties.Resources.Hammer);
                        GameAudio.Play();
                        Hammer = true;
                        Anim_Fire.Advance();
                    }
                    if (e.X > 330 && e.X < 380 && e.Y > 230 && e.Y < 290 && Hammer == true)     //user clicked on Trigger
                    {
                        Triggered = true;
                    }
                }

                break;

            case GameStates.Death:
                if (GameEnded)
                {
                    if (e.X > 520 && e.X < 555 && e.Y > pnl_canvas.Height - 25)     //user clicked on Yes
                    {
                        NewGame = true;
                        this.Close();
                    }
                    else if (e.X > 560 && e.Y > pnl_canvas.Height - 25)     //user clicked on No
                    {
                        NewGame = false;
                        this.Close();
                    }
                }
                break;

            case GameStates.Survive:
                if (!GameEnded)
                {
                    if (CurrentChamber != 5)
                    {
                        GameAnimations.ResetAll();
                        CurrentChamber++;
                        if (PointAwayChances != 0)
                        {
                            StateOfTheGame = GameStates.PointDirection;
                        }
                        else
                        {
                            PointingAway   = false;
                            StateOfTheGame = GameStates.Fire;
                        }
                    }
                }
                else
                {
                    if (e.X > 520 && e.X < 555 && e.Y > pnl_canvas.Height - 25)     //user clicked on Yes
                    {
                        NewGame = true;
                        this.Close();
                    }
                    else if (e.X > 560 && e.Y > pnl_canvas.Height - 25)     //user clicked on No
                    {
                        NewGame = false;
                        this.Close();
                    }
                }

                break;

            case GameStates.DeusExMachina:
                if (GameEnded)
                {
                    if (e.X > 520 && e.X < 555 && e.Y > pnl_canvas.Height - 25)     //user clicked on Yes
                    {
                        NewGame = true;
                        this.Close();
                    }
                    else if (e.X > 560 && e.Y > pnl_canvas.Height - 25)     //user clicked on No
                    {
                        NewGame = false;
                        this.Close();
                    }
                }
                break;

            default:
                break;
            }
        }
Пример #3
0
        private void IntroTimer_Tick(object sender, EventArgs e)
        {
            switch (phase)
            {
            case 0:
                IntroTimer.Stop();
                IntroTimer.Interval = 10;
                phase = 1;
                IntroTimer.Start();
                break;

            case 1:
                count++;
                WelcomeLabel.ForeColor = Color.FromArgb(255, (int)FloatLerp(255, 32, (float)count / 50), (int)FloatLerp(255, 32, (float)count / 50), (int)FloatLerp(255, 32, (float)count / 50));
                if (count >= 50)
                {
                    count             = 0;
                    WelcomeLabel.Text = "Please enter your Unique ID";
                    UniqueID.Visible  = true;
                    UniqueID.Focus();
                    phase = 2;
                }
                break;

            case 2:
                count++;
                WelcomeLabel.ForeColor = Color.FromArgb(255, (int)FloatLerp(32, 255, (float)count / 50), (int)FloatLerp(32, 255, (float)count / 50), (int)FloatLerp(32, 255, (float)count / 50));
                UniqueID.ForeColor     = WelcomeLabel.ForeColor;
                if (count >= 50)
                {
                    phase = 3;
                    count = 0;
                    IntroTimer.Stop();
                }
                break;

            case 3:
                count++;
                WelcomeLabel.ForeColor = Color.FromArgb(255, (int)FloatLerp(255, 32, (float)count / 50), (int)FloatLerp(255, 32, (float)count / 50), (int)FloatLerp(255, 32, (float)count / 50));
                if (count >= 50)
                {
                    count             = 0;
                    WelcomeLabel.Text = "Just a second...";
                    phase             = 4;
                }
                break;

            case 4:
                count++;
                WelcomeLabel.ForeColor = Color.FromArgb(255, (int)FloatLerp(32, 255, (float)count / 50), (int)FloatLerp(32, 255, (float)count / 50), (int)FloatLerp(32, 255, (float)count / 50));
                if (count >= 50)
                {
                    phase = 5;
                    count = 0;
                    IntroTimer.Stop();
                    ValidateID();
                }
                break;

            case 5:
                count++;
                WelcomeLabel.ForeColor = Color.FromArgb(255, (int)FloatLerp(255, 32, (float)count / 50), (int)FloatLerp(255, 32, (float)count / 50), (int)FloatLerp(255, 32, (float)count / 50));
                UniqueID.ForeColor     = Color.FromArgb(255, (int)FloatLerp(Color.LightGreen.R, 32, (float)count / 50), (int)FloatLerp(Color.LightGreen.G, 32, (float)count / 50), (int)FloatLerp(Color.LightGreen.B, 32, (float)count / 50));
                if (count >= 50)
                {
                    phase             = 6;
                    WelcomeLabel.Text = "Starting Installation...";
                    Controls.Remove(UniqueID);
                    count = 0;
                }
                break;

            case 6:
                count++;
                WelcomeLabel.ForeColor = Color.FromArgb(255, (int)FloatLerp(32, 255, (float)count / 50), (int)FloatLerp(32, 255, (float)count / 50), (int)FloatLerp(32, 255, (float)count / 50));
                if (count >= 50)
                {
                    phase = 7;
                    Controls.Remove(UniqueID);
                    StatusMessage.Visible = false;
                    count = 0;
                    Commence();
                }
                break;

            case 7:
                count++;
                if (count < 50)
                {
                    BackColor = Color.FromArgb(255, (int)FloatLerp(CurrentColor.R, NextColor.R, (float)count / 50), (int)FloatLerp(CurrentColor.G, NextColor.G, (float)count / 50), (int)FloatLerp(CurrentColor.B, NextColor.B, (float)count / 50));
                }
                else
                {
                    phase = 8;
                }
                break;

            case 8:
                count++;
                if (count >= 250)
                {
                    count = 0;
                    colorindex++;
                    if (colorindex >= RandomColors.Count)
                    {
                        colorindex = 0;
                    }
                    phase = 7;
                }
                break;
            }
        }