private void FixedUpdate() { UpdateOnGround(); UpdateOnWall(); mState.Update(); previousVelocity = rb.velocity; }
public override void Update(GameTime gameTime) { Physics.Update(gameTime); HealthState.Update(gameTime); MovementState.Update(gameTime); if (Physics.yVelocity > yVelocityThreshholdForFalling) { MovementState.Fall(); } if (Physics.xVelocity < xVelocityThreshholdForIdling && Physics.xVelocity > -xVelocityThreshholdForIdling) { MovementState.Idle(); } sprite.Update(gameTime); if (Physics.yPosition > Config.GetDespawnThreshhold()) { this.TakeDamage(); } Console.WriteLine(Physics.xVelocity); }
public override void Update(GameTime gameTime) { Physics.Update(gameTime); HealthState.Update(gameTime); MovementState.Update(gameTime); if (Physics.yVelocity > yVelocityThreshholdForFalling) { MovementState.Fall(); } if (Physics.xVelocity < xVelocityThreshholdForIdling && Physics.xVelocity > -xVelocityThreshholdForIdling) { MovementState.Idle(); } sprite.Update(gameTime); if (Physics.yPosition > Config.GetDespawnThreshhold()) { this.TakeDamage(); } speedMultiplier -= Config.GetSpeedBoostDeteriorationRate(); if (speedMultiplier < 1.0f) { speedMultiplier = 1.0f; } }
//Handles state changes during a regular update public void Update(float deltaT) { currentState.Update(deltaT); }