public void Update(float dt) { lifeTimer.Update(dt); if (fadeAway) { Opacity = lifeTimer.PercentFromTimeUp() * initialOpacity; } if (alphaAway) { Alpha = lifeTimer.PercentFromTimeUp() * initialAlpha; } if (lifeTimer.IsTimeUp()) { this.Active = false; } }
public override void Update(float dt) { base.Update(dt); //Console.WriteLine("velx: {0}", body.LinearVelocity.X); onGroundTimer.Update(dt); onLeftWallTimer.Update(dt); onRightWallTimer.Update(dt); if (body.LinearVelocity.Y > terminalVelocity) { body.LinearVelocity = new Vector2(body.LinearVelocity.X, terminalVelocity); } if (wallSlideEnabled) { if (OnWall()) { // this helps keep the player on the wall when doing a wall slide if (!OnGround && !checkEdgeCatching()) { if (OnLeftWall) { body.LinearVelocity = new Vector2(-0.02f, body.LinearVelocity.Y); // don't go lower than -0.02, otherwise there's "edge-catching" } else if (OnRightWall) { body.LinearVelocity = new Vector2(0.02f, body.LinearVelocity.Y); // ^^ same with higher than 0.02 } } if (body.LinearVelocity.Y >= slideTerminalVelocity) { body.LinearVelocity = new Vector2(body.LinearVelocity.X, slideTerminalVelocity); } } } // perform this check at the end adjustForEdgeCatching(); }
public void Update(float dt) { if (Running) { emissionTimer.Update(dt); if (emissionTimer.IsTimeUp()) { emissionTimer.SetAccumulatedDelay(emissionDelay); EmitParticleWithDisplayEntity(this.DisplayEntity); } } foreach (Particle particle in particles) { if (particle.Active) { particle.Update(dt); } } }
public override void Update(float dt) { // horizontally if (Math.Abs(Position.X - ConvertUnits.ToSimUnits(initialPosition.X)) > ConvertUnits.ToSimUnits(distance)) { MarkDone(); } // vertically else if (Math.Abs(Position.Y - ConvertUnits.ToSimUnits(initialPosition.Y)) > ConvertUnits.ToSimUnits(distance)) { MarkDone(); } if (!doneTimer.IsReset()) { doneTimer.Update(dt); if (doneTimer.IsTimeUp()) { MarkDone(); doneTimer.Reset(); } } }
public void Update(float dt) { enemySawPlayerTimer.Update(dt); }
public void Update(float dt) { turnAroundTimer.Update(dt); }