Stairs.Update C# (CSharp) Method

Update() private method

private Update ( ) : void
return void
    void Update()
    {
        if (m_paused) return;

        if (teleportTimer > 0)
        {
            teleportTimer -= Time.deltaTime;
        }
        else if (teleportTimer < 0)
        {
            teleportTimer = 0;
        }
    }

Usage Example

Esempio n. 1
0
        /// <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)
        {
            MouseState mouse = Mouse.GetState();
            //Mouse.WindowHandle = Window.Handle;
            Vector2 clickCoord  = new Vector2(mouse.X, mouse.Y) + new Vector2((Ecir.cameraMove.X) + 180, (Ecir.cameraMove.Y) + 451);
            Matrix  screenScale = camera.GetTransform();
            Point   mousePoint  = new Point((int)clickCoord.X, (int)clickCoord.Y);

            //Vector2 mousePos = new Vector2(mouse.X, mouse.Y);
            // Vector2 worldPosition = Vector2.Transform(mousePos, Matrix.Invert(screenScale));
            // Console.WriteLine("mouseX=" + worldPosition.X + "mouseY=" + worldPosition.Y);

            MenuPause.Mouse1(mousePoint);
            // Console.WriteLine("mouseX=" + clickCoord.X + "mouseY=" + clickCoord.Y);


            if (GamePad.GetState(PlayerIndex.One).Buttons.Back == ButtonState.Pressed || Keyboard.GetState().IsKeyDown(Keys.Escape))
            {
                Exit();
            }
            if (exit)
            {
                Exit();
            }
            if (pause)
            {
                this.IsMouseVisible = true;
            }
            else
            {
                this.IsMouseVisible = false;
            }

            MenuPause.Update();


            keyState = Keyboard.GetState();
            if (pause == false)
            {
                if (!ecir.EcirDestroy())
                {
                    ecir.EcirMove(2, 2);
                    ecir.TerrainColisions();
                    ecir.EcirLife();
                }
                hollowKnight.Update();
                ecir.UpdateTime(gameTime.ElapsedGameTime.TotalSeconds);
                stairs.Update();
                ogre.Update();
                ogre.UpdateTime(gameTime.ElapsedGameTime.TotalSeconds);
                terrain1.Update();
                skeleton.Update();
                skeleton.UpdateTime(gameTime.ElapsedGameTime.TotalSeconds, gameTime.ElapsedGameTime.Milliseconds);
                fireBall.Update();
                fireBall.CreateFireBall(graphics);
                fireBall.UpdateTime(gameTime.ElapsedGameTime.TotalSeconds);

                if (zombie != null)
                {
                    zombie.UpdateTimer(gameTime.ElapsedGameTime.TotalSeconds);
                    zombie.ZombieChageDirection();
                    zombie.ZombieMove();
                    zombie.ZombieLife();
                    zombie.ZombieColor();
                }
                hollowKnight.UpdateTime(gameTime.ElapsedGameTime.TotalSeconds);
                Console.WriteLine("Pause==" + pause);
                base.Update(gameTime);
            }

            if (keyState.IsKeyDown(Keys.P) && !keyStateOld.IsKeyDown(Keys.P))
            {
                pause = !pause;  //->pausar o jogo
            }
            keyStateOld = keyState;
            if (restart == true)
            {
                this.Initialize();//->reiniciar o jogo
                this.LoadContent();
                Zombie.zombieLife = 100;
                Ecir.life         = 100;
                Ecir.color        = Color.White;
                this.Draw(gameTime);
            }
            restart = false;
        }
All Usage Examples Of Stairs::Update