Esempio n. 1
0
        CPitchMeter mcPitchMeter;                           // The Pitch Meter


        // Class constructor
        public CShootingGallery(AxWMPLib.AxWindowsMediaPlayer cWindowsMediaPlayer)
        {
            try
            {
                // Pre-load images
                mcTargetFacingLeftImage  = Image.FromFile("../../Data/Images/ShootingGalleryDuckFacingLeft.png");
                mcTargetFacingRightImage = Image.FromFile("../../Data/Images/ShootingGalleryDuckFacingRight.png");

                // Pre-load sounds
            }
            catch (Exception e)
            {
                MessageBox.Show(e.ToString(), "Exception caught");
            }

            // Seed the Random number generator
            mcRandom = new Random(Environment.TickCount);

            // Save a handle to the Windows Media Player
            mcWindowsMediaPlayer = cWindowsMediaPlayer;

            // Set the Transparent Color of the Images
            mcTargetImageAttributes = new ImageAttributes();
            mcTargetImageAttributes.SetColorKey(Color.FromArgb(255, 0, 255), Color.FromArgb(255, 0, 255));

            // Setup the Fonts
            mcFontText             = new Font("Arial", 20, FontStyle.Regular);
            mcFontPause            = new Font("Arial", 120, FontStyle.Regular);
            mcFontChooseMusicTitle = new Font("Arial", 40, FontStyle.Bold);

            // Set the Row Y coordinates
            miTOP_ROW_Y    = 75;
            miMIDDLE_ROW_Y = 210;
            miBOTTOM_ROW_Y = 350;

            // Set the Shoot Target Area Range
            miSHOOT_TARGET_AREA_LEFT   = 375;
            miSHOOT_TARGET_AREA_RIGHT  = 426;
            miSHOOT_TARGET_AREA_TOP    = 75;
            miSHOOT_TARGET_AREA_BOTTOM = 450;

            // Specify the Center X pixel of the screen
            miCENTER_OF_SCREEN_X = 398;

            // Initialize the Pitch Meter
            mcPitchMeter = new CPitchMeter(miSHOOT_TARGET_AREA_LEFT + 22, miSHOOT_TARGET_AREA_TOP, 5, (miSHOOT_TARGET_AREA_BOTTOM - miSHOOT_TARGET_AREA_TOP));
            mcPitchMeter.ShowThirdsMarkers(true);

            // Set the Mario Music parameters
            mcSIMPLE_MUSIC     = new CMusic(EMusic.Simple, 1, 52, 55);
            mcDANS_MARIO_MUSIC = new CMusic(EMusic.DansMario, 1, 76, 78);
            mcMARIO_MUSIC      = new CMusic(EMusic.Mario, 1, 54, 59);

            // Set the Players Score to zero
            miScore = 0;

            // Set the other variables default values
            Reset();
        }
Esempio n. 2
0
        // Class constructor
        public CSpong()
        {
            try
            {
                // Pre-load images
                mcPaddleImage = Image.FromFile("../../Data/Images/SpongPaddle.png");
                mcBallImage   = Image.FromFile("../../Data/Images/SpongBall.png");

                // Pre-load sounds
                CFMOD.CheckResult(CFMOD.GetSystem().createSound("../../Data/Sounds/SpongBallBounce.wav", FMOD.MODE.DEFAULT, ref msSoundBallBounce), "FMOD Create Sound Error");
                CFMOD.CheckResult(CFMOD.GetSystem().createSound("../../Data/Sounds/SpongBallDied.wav", FMOD.MODE.DEFAULT, ref msSoundBallDied), "FMOD Create Sound Error");
                CFMOD.CheckResult(CFMOD.GetSystem().createSound("../../Data/Sounds/SpongGameOver.wav", FMOD.MODE.DEFAULT, ref msSoundGameOver), "FMOD Create Sound Error");
            }
            catch (Exception e)
            {
                MessageBox.Show(e.ToString(), "Exception caught");
            }

            // Seed the Random number generator
            mcRandom = new Random(Environment.TickCount);

            // Mouse turned off by default
            mbMouseEnabled    = false;
            miMouseYLastFrame = 0;

            // Setup the Walls
            mrLeftWall   = new Rectangle(60, 50, 10, 460);
            mrRightWall  = new Rectangle(770, 50, 10, 460);
            mrTopWall    = new Rectangle(60, 50, 720, 10);
            mrBottomWall = new Rectangle(60, 500, 720, 10);

            // Setup the Pitch Meter
            mcPitchMeter = new CPitchMeter(26, 125);
            mcPitchMeter.ShowHalfPointMarker(true);

            // Setup the Fonts
            mcFontText  = new Font("Arial", 20, FontStyle.Regular);
            mcFontPause = new Font("Arial", 50, FontStyle.Regular);

            // Set the other variables default values
            Reset();
        }
Esempio n. 3
0
        Random mcRandom;                                // Used to generate random numbers


        // Class constructor
        public CPitchMatcher()
        {
            try
            {
                // Pre-load images


                // Pre-load sounds
            }
            catch (Exception e)
            {
                MessageBox.Show(e.ToString(), "Exception caught");
            }

            // Seed the Random number generator
            mcRandom = new Random(Environment.TickCount);

            // Setup the Pitch Meter
            mcPitchMeter = new CPitchMeter(500, 125);
            mcPitchMeter.ShowFourthsMarkers(true);

            // Setup the Pitch Meter to Match
            mcPitchMeterToMatch = new CPitchMeter(300, 125);
            mcPitchMeterToMatch.ShowFourthsMarkers(true);

            // Setup the Fonts
            mcFontText  = new Font("Arial", 20, FontStyle.Regular);
            mcFontPause = new Font("Arial", 50, FontStyle.Regular);

            // Specify the Game Duration, Max Target Wait Time, and Max Pitch Difference to get Points
            miGAME_DURATION = 30;
            mfMAX_TARGET_PITCH_WAIT_TIME = 3.0f;
            mfMAX_UNIT_PITCH_DIFFERENCE_TO_EARN_POINTS = 0.25f;

            // Start the player with no Score
            miScore = 0;

            // Set the other variables default values
            Reset();
        }
        // Form Constructor
        public formProfileSettings()
        {
            // Initializes form controls
            InitializeComponent();

            try
            {
                // Pre-load images

                // Pre-load Sounds
                CFMOD.CheckResult(CFMOD.GetSystem().createSound("../../Data/Sounds/ProfileSettingsExample.wav", FMOD.MODE.DEFAULT, ref msSoundPitchTransitionExample), "FMOD Create Sound Error");
            }
            catch (Exception e)
            {
                MessageBox.Show(e.ToString(), "Exception caught");
            }

            // Setup the Update Timer
            mcUpdateTimer          = new Timer();
            mcUpdateTimer.Tick    += new EventHandler(UpdateTimer_Tick);
            mcUpdateTimer.Interval = 16;
            mcUpdateTimer.Enabled  = true;
            mcUpdateTimer.Start();

            // Set all of the Pitch Hits to zero
            for (int i = 0; i < miaPitchHits.Length; i++)
            {
                miaPitchHits[i] = 0;
            }

            // Display the Profiles in the Profiles combo box
            UpdateShownProfilesAndCurrentSettings();

            // Set the initial Pitch Meter Indicators position
            mcPitchMeter = new CPitchMeter(350, 125);
            mcPitchMeter.ShowHalfPointMarker(true);
        }
Esempio n. 5
0
        FMOD.Sound msSoundFire = null;      // Sound when the player Fires the Arrow

        // Class constructor
        public CTargetPractice()
        {
            try
            {
                // Pre-load images
                mcBowAndArrowImage = Image.FromFile("../../Data/Images/TargetPracticeBowAndArrow.png");
                mcArrowImage       = Image.FromFile("../../Data/Images/TargetPracticeArrow.png");
                mcTargetImage      = Image.FromFile("../../Data/Images/TargetPracticeTarget.png");

                // Pre-load sounds
                CFMOD.CheckResult(CFMOD.GetSystem().createSound("../../Data/Sounds/TargetPracticeHit.wav", FMOD.MODE.DEFAULT, ref msSoundHit), "FMOD Create Sound Error");
                CFMOD.CheckResult(CFMOD.GetSystem().createSound("../../Data/Sounds/TargetPracticeMiss.wav", FMOD.MODE.DEFAULT, ref msSoundMiss), "FMOD Create Sound Error");
                CFMOD.CheckResult(CFMOD.GetSystem().createSound("../../Data/Sounds/TargetPracticeFire.wav", FMOD.MODE.DEFAULT, ref msSoundFire), "FMOD Create Sound Error");
            }
            catch (Exception e)
            {
                MessageBox.Show(e.ToString(), "Exception caught");
            }

            // Seed the Random number generator
            mcRandom = new Random(Environment.TickCount);

            // Setup the Pitch Meter
            mcPitchMeter = new CPitchMeter(500, 125);
            mcPitchMeter.ShowFourthsMarkers(true);

            // Setup the Fonts
            mcFontText  = new Font("Arial", 20, FontStyle.Regular);
            mcFontLarge = new Font("Arial", 50, FontStyle.Regular);

            // Start the player with no Score
            miScore = 0;

            // Record that we are playing Pong
            meGame = EGames.TargetPractice;

            // Set the games initial State
            meTargetPracticeState = ETargetPracticeGameStates.Aiming;

            // Set the initial Pitch Meter Indicator positions
            mcPitchMeter.UpdatePitchIndicatorsPosition(0.0f);

            // Initialize the constants
            mcGRAVITY_ACCELERATION   = new Vector2(0.0f, 65.0f);
            mrBOW_AND_ARROW_POSITION = new Rectangle(10, 400, 60, 69);

            // Specify the initial Target and Arrow positions
            mrTarget = new Rectangle(650, 250, 128, 128);
            mrArrow  = new RectangleF(10, 10, 60, 11);
            MoveTargetToNewRandomLocation();
            MoveArrowToBow();

            // Set the Arrows initial Velocity and the initial Power
            mcArrowVelocity        = new Vector2();
            mfUnitBowAndArrowPower = 0.0f;

            // Set the initial Bow And Arrow and Arrow Rotations
            miBowAndArrowRotation = miArrowRotation = 0;

            // Initialize the Reset Arrow Wait Time
            mfResetArrowWaitTime = 0.0f;

            // Initialize the Arrow Hit Target variable
            mbArrowHitTarget = false;
        }