Ejemplo n.º 1
0
        //====== ctors

        public AppleEntity(Point position, AppleType appleType, GameTime gameTime) : base(position)
        {
            Type = appleType;

            Verify.NotNull(gameTime, nameof(gameTime));

            DelayBeforeDie = gameTime.CreateDelay(TimeSpan.FromSeconds(LifetimeInSeconds));
        }
Ejemplo n.º 2
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);
        }
Ejemplo n.º 3
0
        public bool Move(Direction direction)
        {
            if (moveDelay.IsDone == false)
            {
                return(false);
            }

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

            return(true);
        }