//====== ctors public AppleEntity(Point position, AppleType appleType, GameTime gameTime) : base(position) { Type = appleType; Verify.NotNull(gameTime, nameof(gameTime)); DelayBeforeDie = gameTime.CreateDelay(TimeSpan.FromSeconds(LifetimeInSeconds)); }
//====== 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); }