Пример #1
0
        /// <summary>
        /// Allows the game to perform any initialization it needs to before starting to run.
        /// This is where it can query for any required services and load any non-graphic
        /// related content.  Calling base.Initialize will enumerate through any components
        /// and initialize them as well.
        /// </summary>
        protected override void Initialize()
        {
            // TODO: Add your initialization logic here

            base.Initialize();
            _spriteBatchEffect = new BasicEffect(graphics.GraphicsDevice);
            world = new World();

            SetUpCamera();
            LevelManager.LoadLevel(0);
            MediaPlayer.Play(SFX.BGM, new TimeSpan(0, 0, 0));
            ui  = new UI();
            mdr = new MotionDataReciever();

            //C:\Users\Labuser\Documents\MonoGameMothMan\GameRoot\Game1\bin\Windows\x86\Debug
            //positions = File.AppendText(@"Positions.txt");

            cameraPosition = new Vector3(400, 190f, 0);
        }
Пример #2
0
        void DetermineButtonState()
        {
            //int press = GetLoadCellDataFromPuck();
            int press = MotionDataReciever.GetLoadCellDataFromPuck(isPlayerOne);

            if (press > pressForceNumber)
            {
                if (currButtonState == LoadCellState.ButtonReleased)
                {
                    currButtonState = LoadCellState.ButtonPressed;
                }
                else
                {
                    currButtonState = LoadCellState.ButtonHeld;
                }
            }
            else
            {
                currButtonState = LoadCellState.ButtonReleased;
            }
        }
Пример #3
0
        protected virtual void ManageMotionInput(float speed)
        {
            body.LinearVelocity = new Vector2(-speed * MotionDataReciever.GetPlayerMotionInput(isPlayerOne).Y, body.LinearVelocity.Y);
            if (body.LinearVelocity.X < 0)
            {
                flipped   = SpriteEffects.FlipHorizontally;
                isFlipped = true;
            }
            else if (body.LinearVelocity.X > 0)
            {
                flipped   = SpriteEffects.None;
                isFlipped = false;
            }

            DetermineButtonState();
            if (currButtonState == LoadCellState.ButtonPressed)
            {
                currState = AnimStates.Flapping;
                DoJump(0, speed);
            }
        }
Пример #4
0
 /// <summary>
 /// UnloadContent will be called once per game and is the place to unload
 /// game-specific content.
 /// </summary>
 protected override void UnloadContent()
 {
     MotionDataReciever.OnApplicationQuit();
     //   positions.Close();
     // TODO: Unload any non ContentManager content here
 }