private void PointDirectionTimer_Tick(object sender, EventArgs e) { StateOfTheGame = GameStates.Fire; PointDirectionTimer.Stop(); }
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; } }