当前位置: 首页>>代码示例>>C#>>正文


C# GameTime.TotalMsLong方法代码示例

本文整理汇总了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;
            }
        }
开发者ID:ZetaTwo,项目名称:Project-Easter-Egg,代码行数:26,代码来源:GameMovableModel.cs

示例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);
        }
开发者ID:ZetaTwo,项目名称:Project-Easter-Egg,代码行数:15,代码来源:GameMovableModel.cs


注:本文中的Microsoft.Xna.Framework.GameTime.TotalMsLong方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。