Ejemplo n.º 1
0
        private void HandleMoves(Sequence sequence)
        {
            for (int m = 0; m < sequence.Times; ++m)
            {
                // although it can go multiple fields we need it just to move one field
                Turtle.Move();

                var collidedWith = collision.Check(Turtle);

                if (collidedWith == null)
                {
                    logger.Info($"Success!");

                    continue;
                }

                collidedWith.Handle(logger, Turtle);

                if (Turtle.Dead || Turtle.Exited)
                {
                    break;
                }
            }
        }
Ejemplo n.º 2
0
 public virtual void Handle(ILogger logger, Turtle turtle)
 {
 }
Ejemplo n.º 3
0
        public override void Handle(ILogger logger, Turtle turtle)
        {
            logger.Info("Mine hit!");

            turtle.Dead = true;
        }
Ejemplo n.º 4
0
        public override void Handle(ILogger logger, Turtle turtle)
        {
            logger.Info("Exit reached!");

            turtle.Exited = true;
        }
Ejemplo n.º 5
0
        public override void Handle(ILogger logger, Turtle turtle)
        {
            logger.Info("Wall hit!");

            turtle.Position -= turtle.LastMove;
        }