Пример #1
0
        public void BehaviorSystemShouldHaveBitMoveAwayFromPlayer()
        {
            // Arrange
            var pos   = new Pos2D(-13, 45);
            var actor = GameObjectFactory.CreateActor(Actors.Bit, pos);

            // Act
            var result = AI.ProcessActorTurn(actor);

            // Assert
            result.SelectedBehavior.ShouldBe(Behaviors.MoveAwayFromEnemy);
            actor.Pos.ShouldBe(pos.GetNeighbor(MoveDirection.Right));
        }
Пример #2
0
        private bool HasObstacle(GameContext context, Pos2D actorPos, MoveDirection direction)
        {
            var cell = context.Level.GetCell(actorPos.GetNeighbor(direction));

            return(cell == null || cell.HasObstacle);
        }