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; }
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 = ""; } }
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(); }
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 }
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; } }
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; } }