//====== 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); }
public bool Move(Direction direction) { if (moveDelay.IsDone == false) { return(false); } snakeMover.Move(direction); moveDelay = gameTime.CreateDelay(snakeSpeed.CurrentDelay); return(true); }