コード例 #1
0
ファイル: ChaoticMindGame.cs プロジェクト: pR0Ps/ChaoticMind
        private void normalGameUpdate(float deltaTime)
        {
            //Update all objects in our list. This is not where physics is evaluated,
            // it is only where object-specific actions are performed, like applying control forces

            Objects.Update(deltaTime);

            PainStaticMaker.Update(deltaTime);
        }
コード例 #2
0
ファイル: ChaoticMindGame.cs プロジェクト: pR0Ps/ChaoticMind
        /// <summary>
        /// Undoes StartNewGame() so that a new game can be created.
        /// </summary>
        private void ClearGame()
        {
            GameState.ClearGame();
            PainStaticMaker.ClearGame();
            LoseScreen.ClearGame();
            _shiftInterface.ClearGame();

            Objects.ClearGame();
        }
コード例 #3
0
ファイル: Player.cs プロジェクト: pR0Ps/ChaoticMind
        public override void ApplyDamage(float amount)
        {
            SoundEffectManager.PlayEffect("impact", 0.1f);
            PainStaticMaker.AddDamage(amount);

            //heatbeat
            if ((_currentHealth / _maxHealth) < 0.3 && SoundEffectManager.GetSoundState("heartbeat") != SoundState.Playing)
            {
                SoundEffectManager.PlaySound("heartbeat");
            }
            base.ApplyDamage(amount);
        }
コード例 #4
0
ファイル: ChaoticMindGame.cs プロジェクト: pR0Ps/ChaoticMind
        /// <summary>
        /// Allows the game to run logic such as updating the world,
        /// checking for collisions, gathering input, and playing audio.
        /// </summary>
        /// <param name="gameTime">Provides a snapshot of timing values.</param>
        protected override void Update(GameTime gameTime)
        {
            float deltaTime = ((float)gameTime.ElapsedGameTime.TotalMilliseconds) * 0.001f;

            //must call once BEFORE any keyboard/mouse operations
            InputManager.Update(deltaTime);

            updateGameState();

            if (GameState.Mode == GameState.GameMode.EXITED)
            {
                return;
            }
            else if (GameState.Mode == GameState.GameMode.PREGAME)
            {
            }
            else if (GameState.Mode == GameState.GameMode.NORMAL)
            {
                normalGameUpdate(deltaTime);
            }
            else if (GameState.Mode == GameState.GameMode.SHIFTING)
            {
                _shiftInterface.Update(deltaTime);
            }
            else if (GameState.Mode == GameState.GameMode.PAUSED)
            {
                //update stuff for the pause menu
            }
            else if (GameState.Mode == GameState.GameMode.GAMEOVERWIN)
            {
                //quack goes the duck
            }
            else if (GameState.Mode == GameState.GameMode.GAMEOVERLOSE)
            {
                _backgroundMusic.Stop();
                LoseScreen.Update(deltaTime);
                Objects.MainCamera.Update(deltaTime);
                PainStaticMaker.Update(deltaTime);
            }

            base.Update(gameTime);
        }
コード例 #5
0
ファイル: ChaoticMindGame.cs プロジェクト: pR0Ps/ChaoticMind
        /// <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.StartNewGame will enumerate through any components
        /// and initialize them as well.
        /// </summary>
        protected override void Initialize()
        {
            // Create a new SpriteBatch, which can be used to draw textures.
            _spriteBatch = new SpriteBatch(GraphicsDevice);

            _hudManager.Initialize();

            //set up the black pixel used for clearing the screen
            _blackPx = new Texture2D(_graphics.GraphicsDevice, 1, 1);
            uint[] px = { 0xFFFFFFFF };
            _blackPx.SetData <uint>(px);

            InputManager.Initialize();

            SoundEffectManager.Initilize();

            //initial menu music
            _backgroundMusic = new MusicController();
            _backgroundMusic.Enqueue("Predatory Instincts_ElevatorRemix");
            _backgroundMusic.Play();

            PainStaticMaker.Initialize();

            _mouseDrawer.Initialize();

            CharacterType.Initialize();
            ParticleType.Initialize();

            LoseScreen.Initialize();

            GameState.Initilize();
            StartNewGame();

            _shiftInterface.Initialize(_spriteBatch);

            base.Initialize();
        }
コード例 #6
0
ファイル: ChaoticMindGame.cs プロジェクト: pR0Ps/ChaoticMind
        /// <summary>
        /// This is called when the game should draw itself.
        /// </summary>
        /// <param name="gameTime">Provides a snapshot of timing values.</param>
        protected override void Draw(GameTime gameTime)
        {
            GraphicsDevice.Clear(Color.Black);

            /**** Draw Game Objects ****/
            _spriteBatch.Begin(SpriteSortMode.BackToFront, BlendState.AlphaBlend);

            //Draw real game
            drawObjects(gameTime);

            _spriteBatch.End();


            /**** Draw Glow Effects ****/
            //Using BlendState.Additive will make things drawn in this section only brighten, never darken.
            //This means colors will be intensified, and look like glow

            _spriteBatch.Begin(SpriteSortMode.Immediate, BlendState.Additive);

            //Draw real game
            drawGlows(gameTime);

            PainStaticMaker.DrawStatic(_spriteBatch);

            _spriteBatch.End();



            _spriteBatch.Begin(SpriteSortMode.BackToFront, BlendState.AlphaBlend);

            /**** Draw HUD ****/
            _hudManager.Draw_HUD(_spriteBatch);

            Objects.DrawMinimap(Objects.MainCamera);


            /**** Draw Special State Objects ****/

            if (GameState.Mode == GameState.GameMode.PAUSED)
            {
                drawPauseOverlay();
            }
            else if (GameState.Mode == GameState.GameMode.GAMEOVERWIN)
            {
                drawGameoverWinOverlay();
            }
            else if (GameState.Mode == GameState.GameMode.GAMEOVERLOSE)
            {
                LoseScreen.Draw(_spriteBatch);
            }
            else if (GameState.Mode == GameState.GameMode.PREGAME)
            {
                drawStartMenuOverlay(gameTime);
            }
            else if (GameState.Mode == GameState.GameMode.SHIFTING)
            {
                _shiftInterface.Draw();
                Objects.DrawOnShiftInterface(_shiftInterface);
            }

            _mouseDrawer.drawMouse(_spriteBatch);

            _spriteBatch.End();

            base.Draw(gameTime);
        }