本文整理汇总了C#中GameTime.GetElapsedSeconds方法的典型用法代码示例。如果您正苦于以下问题:C# GameTime.GetElapsedSeconds方法的具体用法?C# GameTime.GetElapsedSeconds怎么用?C# GameTime.GetElapsedSeconds使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类GameTime
的用法示例。
在下文中一共展示了GameTime.GetElapsedSeconds方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: OnUpdate
protected override void OnUpdate(GameTime gameTime, InputState istate)
{
ShapePosition += velocity * gameTime.GetElapsedSeconds();
ShapeRotation = FloatMath.IncModulo(ShapeRotation, rotationSpeed * gameTime.GetElapsedSeconds(), FloatMath.TAU);
if (Lifetime < maxLifetime) ShapeAlpha = 1 - Lifetime / maxLifetime;
if (Lifetime > maxLifetime) Alive = false;
}
示例2: OnBeforeUpdate
protected override void OnBeforeUpdate(GameTime gameTime, InputState state)
{
#if DEBUG
debugView.DebugPanelPosition = new Vector2(55, Owner.VAdapter.RealTotalHeight - 180);
debugView.PerformancePanelBounds = new Rectangle(450, (int) (Owner.VAdapter.RealTotalHeight - 180), 200, 100);
debugView.Enabled = DebugSettings.Get("PhysicsDebugView");
#endif
PhysicsWorld.Step(gameTime.GetElapsedSeconds());
}
示例3: UpdateBarrel
private void UpdateBarrel(GameTime gameTime)
{
if ((CannonHealth.TargetValue >= 1 || Fraction.IsNeutral) && controller.DoBarrelRecharge())
{
barrelCharge += BARREL_CHARGE_SPEED * Fraction.Multiplicator * RealBoost * gameTime.GetElapsedSeconds();
if (barrelCharge >= 1f)
{
barrelCharge -= 1f;
Shoot();
}
}
if (barrelRecoil < 1)
{
barrelRecoil = FloatMath.LimitedInc(barrelRecoil, BARREL_RECOIL_SPEED * Fraction.Multiplicator * RealBoost * gameTime.GetElapsedSeconds(), 1f);
}
}
示例4: UpdateHealth
private void UpdateHealth(GameTime gameTime)
{
CannonHealth.Update(gameTime);
if (CannonHealth.TargetValue < 1 && CannonHealth.TargetValue > 0)
{
var bonus = START_HEALTH_REGEN + (END_HEALTH_REGEN - START_HEALTH_REGEN) * CannonHealth.TargetValue;
CannonHealth.Inc(bonus * gameTime.GetElapsedSeconds());
CannonHealth.Limit(0f, 1f);
}
if (CannonHealth.ActualValue >= 1 || (CannonHealth.ActualValue <= 0 && Fraction.IsNeutral))
{
var rotInc = BASE_COG_ROTATION_SPEED * Fraction.Multiplicator * RealBoost * gameTime.GetElapsedSeconds();
cannonCogRotation = (cannonCogRotation + rotInc) % (FloatMath.PI / 2);
}
else
{
if (FloatMath.FloatInequals(cannonCogRotation, FloatMath.PI / 2))
{
var rotInc = BASE_COG_ROTATION_SPEED * Fraction.GetNeutral().Multiplicator * RealBoost * gameTime.GetElapsedSeconds();
bool isLimited;
cannonCogRotation = FloatMath.LimitedInc(cannonCogRotation, rotInc, FloatMath.PI/2, out isLimited);
if (isLimited) cannonCogRotation = FloatMath.PI / 2;
}
}
}