Esempio n. 1
0
        private void frm_Game_Load(object sender, EventArgs e)
        {
            //Setup misc
            NewGame   = false; // make sure this is turned off until user chooses to turn it on again
            this.Text = "Russian Roulette - Welcome " + frm_PlayerProfile.profileName;

            //reset variables
            Game_CurrentScore = 0;
            Bullet            = 0;
            BulletLoad        = false;
            Chambers          = new int[6] {
                0, 0, 0, 0, 0, 0
            };
            CurrentChamber   = 0;
            PointAwayChances = 2;
            PointingAway     = false;
            Hammer           = false;
            Triggered        = false;
            Game_Saved       = false;
            //cheats
            GodMode     = false;
            ExtraLife   = false;
            ExtraChance = false;

            GameAnimations.ResetAll();
            GameAnimations.SetAllLoop(false);
            StateOfTheGame = GameStates.Intro;

            //handle cheats
            if (Cheating)
            {
                foreach (string cheat in GameCheats)
                {
                    switch (cheat)
                    {
                    case "Extra Chance":
                        ExtraChance      = true;
                        PointAwayChances = 3;
                        break;

                    case "Extra Life":
                        ExtraLife = true;
                        break;

                    case "God Mode":
                        GodMode = true;
                        break;

                    default:
                        break;
                    }
                }
            }

            //Init start of game
            AnimTimer.Interval = 40; //fps of around 25
            AnimTimer.Start();
            IntroTimer.Start();
            Anim_Intro.Loop = true;
        }
Esempio n. 2
0
 private void UniqueID_TextChanged(object sender, EventArgs e)
 {
     if (UniqueID.MaskFull)
     {
         bool result = KeyMeetsCriteria(UniqueID.Text);
         if (result)
         {
             StatusMessage.ForeColor = Color.White;
             StatusMessage.Text      = "";
             UniqueID.ForeColor      = Color.LightGreen;
             UniqueID.ReadOnly       = true;
             StatusMessage.Focus();
             phase = 3;
             IntroTimer.Start();
         }
         else
         {
             StatusMessage.ForeColor = Color.LightCoral;
             StatusMessage.Text      = "Invalid Unique Identifier.";
         }
     }
     else
     {
         StatusMessage.ForeColor = Color.White;
         StatusMessage.Text      = "";
     }
 }
Esempio n. 3
0
        public Installer()
        {
            InitializeComponent();
#if DEBUG
            Debug();
#endif
            InstallerWorker        = new BackgroundWorker();
            UniqueID.Location      = new Point(0, (int)(this.Height * .6));
            StatusMessage.Location = new Point(0, UniqueID.Location.Y + 67);
            UniqueID.TextChanged  += UniqueID_TextChanged;
            IntroTimer.Tick       += IntroTimer_Tick;
            IntroTimer.Start();
        }
Esempio n. 4
0
        private void ValidateID()
        {
            //for current, we are going to accept the key using offline installer mode
            if (StandaloneInstaller)
            {
                Key   = UniqueID.Text;
                phase = 5;
                IntroTimer.Start();
            }

            //if id is good, start the installation
            //else, tell em its bad, clear it, and restart the process
        }
Esempio n. 5
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;
            }
        }
Esempio n. 6
0
 private void IntroTimer_Tick(object sender, EventArgs e)
 {
     StateOfTheGame = GameStates.LoadBullet;
     IntroTimer.Stop();
 }
Esempio n. 7
0
        private void UpdateGame()
        {
            switch (StateOfTheGame)
            {
            case GameStates.Intro:
                if (!IntroTimer.Enabled)
                {
                    IntroTimer.Start();
                }
                break;

            case GameStates.LoadBullet:
                AnimTimer.Interval = 800;
                if (Anim_LoadBullet.Ended)
                {
                    Bullet         = 1; //Place a bullet in gun
                    StateOfTheGame = GameStates.SpinChamber;
                    BulletLoad     = false;
                }
                if (BulletLoad)
                {
                    Anim_LoadBullet.Advance();
                }
                break;

            case GameStates.SpinChamber:
                if (Anim_SpinChamber.Ended)
                {
                    Random spinRandom = new Random(); //Randomize location of bullet
                    Bullet = spinRandom.Next(1, 6);
                    Chambers[Bullet - 1] = 1;         //this is when we actually load the bullet but user doesn't know that
                    StateOfTheGame       = GameStates.PointDirection;
                    AnimTimer.Interval   = 40;
                }
                break;

            case GameStates.PointDirection:
                break;

            case GameStates.Fire:
                if (Triggered)
                {
                    Hammer    = false;
                    Triggered = false;

                    if (NextDeath)
                    {
                        NextDeath        = false;
                        PointAwayChances = -1;
                        //No Change in points tried your luck and failed
                        Game_Die();
                    }
                    else if (CurrentChamber == 5 && !PointingAway)     //you chose this path >:c
                    {
                        Game_CurrentScore -= 10;
                        Game_Die();
                    }
                    else if (CurrentChamber == 5 && PointingAway)
                    {
                        Game_CurrentScore += 30;     // close calls are the most rewarding cause they're the most risky wins
                        Game_CloseCalls   += 1;
                        Game_Survived();
                    }
                    else if (CurrentChamber != 5 && !PointingAway)
                    {
                        if (Chambers[CurrentChamber] == 1)
                        {
                            //No change in points
                            Game_Die();
                        }
                        else
                        {
                            Game_CurrentScore += 5;                  //Plus five points for every successful pull of the trigger
                            StateOfTheGame     = GameStates.Survive; // click sound
                        }
                    }
                    else     //PointAwayChances != 0 && CurrentChamber != 5 && PointingAway
                    {
                        if (Chambers[CurrentChamber] == 1)
                        {
                            //this isn't a close call. Close calls are only if you use your "point away" when there is only 1 chamber left
                            Game_Survived();
                            Game_CurrentScore += 10;     //Made a good decision (lucky)
                            GameAudio          = new SoundPlayer(Properties.Resources.Fire);
                            GameAudio.Play();
                            Game_BulletsFired += 1;
                            Anim_Fire.Advance();     //flash
                        }
                        else
                        {
                            //No change in points
                            StateOfTheGame = GameStates.Survive;     // click sound
                        }
                    }
                    if (PointAwayChances == 0)
                    {
                        NextDeath = true;
                    }
                }
                break;

            case GameStates.Death:
                Save_Game();
                break;

            case GameStates.Survive:
                Save_Game();
                break;

            case GameStates.DeusExMachina:
                Save_Game();
                break;

            default:
                break;
            }
        }
Esempio n. 8
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;
            }
        }