示例#1
0
        //====== ctors

        public SnakeDelayedMove(ISnakeMovementController snakeMover, SnakeSpeed snakeSpeed, GameTime gameTime)
        {
            this.snakeMover = Verify.NotNull(snakeMover, nameof(snakeMover));
            this.snakeSpeed = Verify.NotNull(snakeSpeed, nameof(snakeSpeed));
            this.gameTime   = Verify.NotNull(gameTime, nameof(gameTime));

            moveDelay = gameTime.CreateDelay(snakeSpeed.CurrentDelay);
        }
示例#2
0
        public bool Move(Direction direction)
        {
            if (moveDelay.IsDone == false)
            {
                return(false);
            }

            snakeMover.Move(direction);
            moveDelay = gameTime.CreateDelay(snakeSpeed.CurrentDelay);

            return(true);
        }