Exemplo n.º 1
0
        public override bool Evaluate(GameContext context, Actor actor, IEnumerable <GameCell> choices)
        {
            var walkable = context.Level.GetCellAndAdjacent(actor.Pos);
            var option   = walkable.Where(o => !o.HasNonActorObstacle).GetRandomElement(context.Randomizer);

            if (option.Pos == actor.Pos)
            {
                WaitCommand.Execute(context, actor, actor.Pos, false);
            }
            else
            {
                MoveCommand.Execute(context, actor, option.Pos, false);
            }

            return(true);
        }
Exemplo n.º 2
0
        public void Execute_WaitOneSecond_DelayOfOnesecond()
        {
            var waitArgs = Mock.Of <IWaitCommandArgs>
                           (
                c => c.MilliSeconds == new LiteralScalarResolver <int>("1000")
                           );
            var command = new WaitCommand(waitArgs);

            var stopWatch = new Stopwatch();

            stopWatch.Start();
            command.Execute();
            stopWatch.Stop();
            Console.WriteLine($"Visible wait equal to { stopWatch.ElapsedMilliseconds} ms");
            Assert.That(stopWatch.ElapsedMilliseconds, Is.GreaterThanOrEqualTo(1000));
        }