本文整理汇总了C#中Microsoft.Xna.Framework.GameTime.TotalMsLong方法的典型用法代码示例。如果您正苦于以下问题:C# GameTime.TotalMsLong方法的具体用法?C# GameTime.TotalMsLong怎么用?C# GameTime.TotalMsLong使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Microsoft.Xna.Framework.GameTime
的用法示例。
在下文中一共展示了GameTime.TotalMsLong方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: checkIfDoneMoving
/// <summary>
///
/// </summary>
/// <param name="gameTime"></param>
/// <returns>true if completely done moving (no more queued up moves either)</returns>
private bool checkIfDoneMoving(GameTime gameTime)
{
long startTimeForNextMove = gameTime.TotalMsLong();
if (moving && gameTime.TotalMsLong() - begunMovingAt >= totalTimeMsToFinishCurrentMove)
{
this.ParentMap().WorldMatrix.endMoveModel(this, Position + moveOffset);
moving = false;
startTimeForNextMove = begunMovingAt + totalTimeMsToFinishCurrentMove;
}
if (!moving && PathCheckpoints != null && PathCheckpoints.Count > 0)
{
MoveOffsetIfNotAlreadyMoving(PathCheckpoints.First.Value, startTimeForNextMove);
PathCheckpoints.RemoveFirst();
return false;
}
else
{
return true;
}
}
示例2: Update
public void Update(GameTime gameTime)
{
long startTime = gameTime.TotalMsLong();
if (Engine.Input.Keyboard.IsKeyDown(Keys.D8)) MoveOffsetIfNotAlreadyMoving(Position.N, startTime);
else if (Engine.Input.Keyboard.IsKeyDown(Keys.D9)) MoveOffsetIfNotAlreadyMoving(Position.NE, startTime);
else if (Engine.Input.Keyboard.IsKeyDown(Keys.O)) MoveOffsetIfNotAlreadyMoving(Position.E, startTime);
else if (Engine.Input.Keyboard.IsKeyDown(Keys.L)) MoveOffsetIfNotAlreadyMoving(Position.SE, startTime);
else if (Engine.Input.Keyboard.IsKeyDown(Keys.K)) MoveOffsetIfNotAlreadyMoving(Position.S, startTime);
else if (Engine.Input.Keyboard.IsKeyDown(Keys.J)) MoveOffsetIfNotAlreadyMoving(Position.SW, startTime);
else if (Engine.Input.Keyboard.IsKeyDown(Keys.U)) MoveOffsetIfNotAlreadyMoving(Position.W, startTime);
else if (Engine.Input.Keyboard.IsKeyDown(Keys.D7)) MoveOffsetIfNotAlreadyMoving(Position.NW, startTime);
else if (Engine.Input.Keyboard.IsKeyDown(Keys.F)) MoveOffsetIfNotAlreadyMoving(Position.W * 3, startTime);
checkIfDoneMoving(gameTime);
}