public override void Update(TimeSpan elapsedTime) { foreach (var component in Components) { component.Update(elapsedTime); } }
public override void Update(TimeSpan t) { this.game.CollisionHandler.HandleCollision(this); if (this.Deleted) { return; } var acceleration = Vector2.Zero; foreach (var body in this.game.Bodies) { var shape = body.Shape; var difference = shape.Center - this.position; var distanceSquared = difference.LengthSquared; var a = Constants.G * body.Mass / distanceSquared.NumericValue; var dirNormal = difference.Direction.Vector; acceleration += dirNormal * a; } this.velocity += new Velocity2(acceleration * (float)t.NumericValue); this.position += this.velocity * t; }
public void Update(TimeSpan elapsedTime, ControlState controlState) { var leftRight = this.helpSteer(controlState).Clamped(-1, 1); this.updateMovement(elapsedTime, controlState.Acceleration, leftRight); this.update(); }
public override void Update(TimeSpan elapsedTime) { this.goalPoint = this.controller.Control(); updateMovement(elapsedTime); this.eventListenerTileManager.Update(); }
public override void Update(TimeSpan elapsedTime) { this.goalPoint = this.controller.Control(); updateMovement(elapsedTime); this.eventListenerTileManager.Update(); }
public void Update(TimeSpan elapsedTime, ControlState controlState) { var leftRight = this.helpSteer(controlState).Clamped(-1, 1); this.updateMovement(elapsedTime, controlState.Acceleration, leftRight); this.update(); }
public override void Update(TimeSpan elapsedTime) { while (spawnQueue.Count > 0 && spawnQueue.First.Value.Item1 <= Game.Time) { spawnEnemy(spawnQueue.First.Value.Item2); spawnQueue.RemoveFirst(); } }
public void Advance(TimeSpan elapsedTime) { Time += elapsedTime; foreach (var obj in gameObjects) { obj.Update(elapsedTime); } }
private void update(TimeSpan t) { this.time += t; foreach (var gameObject in this.gameObjects) { gameObject.Update(t); } }
public void Update(TimeSpan elapsedTimeInS) { if (InitialLifetime == TimeSpan.Zero) { firstRun(); } Position += elapsedTimeInS * Velocity; Lifetime -= elapsedTimeInS; }
public void Update(UpdateEventArgs args) { var elapsedTime = new TimeSpan(args.ElapsedTimeInS); this.Time += elapsedTime; foreach (var gameObject in this.gameObjects) { gameObject.Update(elapsedTime); } }
private void updateZoom(TimeSpan t) { float zoomDelta = InputManager.DeltaScroll; zoomDelta += (float)t.NumericValue * 15 * (this.controls.ZoomOut.AnalogAmount - this.controls.ZoomIn.AnalogAmount) + (this.controls.ZoomOut.Hit ? 1 : 0) + (this.controls.ZoomIn.Hit ? -1 : 0); if (zoomDelta != 0) { var zoomFactor = GameMath.Pow(1 / 1.4f, zoomDelta); this.view.Zoom *= zoomFactor; } }
public override void Update(TimeSpan elapsedTime) { var interiorAlphaGoal = this.RevealInside ? 1 : 0; var fade = (float)elapsedTime.NumericValue * 2; if (interiorAlphaGoal > this.interiorAlpha) { this.interiorAlpha = Math.Min(interiorAlphaGoal, this.interiorAlpha + fade); } else { this.interiorAlpha = Math.Max(interiorAlphaGoal, this.interiorAlpha - fade); } }
private void updateMovement(TimeSpan elapsedTime) { var maxMoveThisFrame = new Speed(2) * elapsedTime; var differenceToGoal = this.goalPoint - this.Position; var distanceToGoal = differenceToGoal.Length; if (distanceToGoal < maxMoveThisFrame) { this.Position = this.goalPoint; } else { this.Position += differenceToGoal / distanceToGoal * maxMoveThisFrame; } }
private void updateMovement(TimeSpan elapsedTime, float acceleration, float leftRight) { var t = (float)elapsedTime.NumericValue; this.speed += new Acceleration(acceleration * 50) * elapsedTime; this.speed *= Mathf.Pow(1e-3f, t); this.turnSpeed += AngularAcceleration.FromRadians(leftRight * 5) * elapsedTime; this.turnSpeed *= Mathf.Pow(1e-7f, t); this.Direction += this.turnSpeed * (elapsedTime * this.speed.NumericValue); this.Position += this.Direction * this.speed * elapsedTime; this.distanceTraveled += this.speed * elapsedTime; }
public override void Update(TimeSpan elapsedTime) { var movementLeft = elapsedTime * Blueprint.Speed; while (movementLeft > Unit.Zero) { if (currentMovementDir == Direction.Unknown) { currentMovementDir = GetNextDirection(); if (currentMovementDir == Direction.Unknown) { break; } } movementLeft = updateMovement(movementLeft); } Position = Game.Level.GetPosition(anchorTile) + movementProgress * currentMovementDir.SpaceTimeDirection(); }
public override void Update(TimeSpan t) { var rotation = this.controls.RotateCounterClockwise.AnalogAmount - this.controls.RotateClockwise.AnalogAmount; this.aimDirection += 2f.Radians() * rotation * (float)t.NumericValue; #if DEBUG if (this.controls.ShootDebug.Hit) { var request = ShootDebugParticleFromPlanet.Request(this.game, this, this.body, this.aimDirection); this.game.RequestHandler.TryDo(request); } #endif if (this.controls.Shoot.Active) { var fireInterval = new TimeSpan(1 / this.economy[EcoValue.FireRate].Value); var timeSinceLastShot = this.game.Time - this.lastShot; if (timeSinceLastShot > fireInterval) { if (this.economy[EcoValue.Projectiles].Value >= 1) { var request = ShootProjectileFromPlanet.Request(this.game, this, this.body, this.aimDirection); this.game.RequestHandler.TryDo(request); this.lastShot = this.game.Time; } } } this.updateZoom(t); foreach (var stat in this.stats) { stat.Update(t); } }
public override void Update(TimeSpan elapsedTime) { var interiorAlphaGoal = this.RevealInside ? 1 : 0; var fade = (float)elapsedTime.NumericValue * 2; if (interiorAlphaGoal > this.interiorAlpha) { this.interiorAlpha = Math.Min(interiorAlphaGoal, this.interiorAlpha + fade); } else { this.interiorAlpha = Math.Max(interiorAlphaGoal, this.interiorAlpha - fade); } }
public override void Update(TimeSpan t) { var rotation = this.controls.RotateCounterClockwise.AnalogAmount - this.controls.RotateClockwise.AnalogAmount; this.aimDirection += 2f.Radians() * rotation * (float)t.NumericValue; #if DEBUG if (this.controls.ShootDebug.Hit) { var request = ShootDebugParticleFromPlanet.Request(this.game, this, this.body, this.aimDirection); this.game.RequestHandler.TryDo(request); } #endif if (this.controls.Shoot.Active) { var fireInterval = new TimeSpan(1 / this.economy[EcoValue.FireRate].Value); var timeSinceLastShot = this.game.Time - this.lastShot; if (timeSinceLastShot > fireInterval) { if (this.economy[EcoValue.Projectiles].Value >= 1) { var request = ShootProjectileFromPlanet.Request(this.game, this, this.body, this.aimDirection); this.game.RequestHandler.TryDo(request); this.lastShot = this.game.Time; } } } this.updateZoom(t); foreach (var stat in this.stats) { stat.Update(t); } }
private void updateZoom(TimeSpan t) { float zoomDelta = InputManager.DeltaScroll; zoomDelta += (float)t.NumericValue * 15 * (this.controls.ZoomOut.AnalogAmount - this.controls.ZoomIn.AnalogAmount) + (this.controls.ZoomOut.Hit ? 1 : 0) + (this.controls.ZoomIn.Hit ? -1 : 0); if (zoomDelta != 0) { var zoomFactor = GameMath.Pow(1 / 1.4f, zoomDelta); this.view.Zoom *= zoomFactor; } }
private void updateMovement(TimeSpan elapsedTime, float acceleration, float leftRight) { var t = (float)elapsedTime.NumericValue; this.speed += new Acceleration(acceleration * 50) * elapsedTime; this.speed *= Mathf.Pow(1e-3f, t); this.turnSpeed += AngularAcceleration.FromRadians(leftRight * 5) * elapsedTime; this.turnSpeed *= Mathf.Pow(1e-7f, t); this.Direction += this.turnSpeed * (elapsedTime * this.speed.NumericValue); this.Position += this.Direction * this.speed * elapsedTime; this.distanceTraveled += this.speed * elapsedTime; }
public override void Update(TimeSpan t) { this.orbitDirection = Direction2.Zero + this.angularVelocity * (float)this.game.Time.NumericValue; this.center = this.calculatePosition(); }
private void updateMovement(TimeSpan elapsedTime) { var maxMoveThisFrame = new Speed(2) * elapsedTime; var differenceToGoal = this.goalPoint - this.Position; var distanceToGoal = differenceToGoal.Length; if (distanceToGoal < maxMoveThisFrame) { this.Position = this.goalPoint; } else { this.Position += differenceToGoal / distanceToGoal * maxMoveThisFrame; } }
public void Update(UpdateEventArgs e) { var elapsed = new TimeSpan(e.ElapsedTimeInS); this.update(elapsed); }
public override void Update(TimeSpan elapsedTime) { }
public override void Update(TimeSpan elapsedTime) { }