Exemplo n.º 1
0
 // Use this for initialization
 void Start()
 {
     board              = FindObjectOfType <BoardProcessor>();
     currentWaypoint    = board.GetNearestWaypoint(transform.position.x, transform.position.z, waypointThreshold);
     transform.position = currentWaypoint.transform.position;
     transform.parent   = currentWaypoint.transform;
 }
Exemplo n.º 2
0
        public void CannotPlayAtRowCol(int digit, int row, int col)
        {
            var p = new BoardProcessor(_board);

            Assert.IsFalse(p.CanPlay(row, col, digit),
                "Could play {2} at {0},{1}\n{3}",row,col,digit,
                Printer.Print(_board));
        }
        public void TestReturnsAnEmptyBoard()
        {
            Board initialBoard  = new Board(0, 0);
            Board expectedBoard = new Board(0, 0);

            Board actualBoard = BoardProcessor.GetNextBoardIteration(initialBoard);

            actualBoard.Should().BeEquivalentTo(expectedBoard);
        }
        public void TestBoardWithThreeLiveCellsReturnsOneLiveCell()
        {
            Board initialBoard = new Board(new[, ]
            {
                { true, true, true }
            });
            Board expectedBoard = new Board(new[, ]
            {
                { false, true, false }
            });

            Board actualBoard = BoardProcessor.GetNextBoardIteration(initialBoard);

            actualBoard.Should().BeEquivalentTo(expectedBoard);
        }
Exemplo n.º 5
0
        //TODO Consider more elegant solution to reverse movement
        public override void Use(BotMovement bot)
        {
            board = FindObjectOfType <BoardProcessor>();
            Vector3 previousPosition = bot.transform.position;

            for (int i = 0; i < (config as MoveConfig).MoveSpaces; i++)
            {
                Waypoint nextWaypoint;
                if ((config as MoveConfig).ReverseMovement)
                {
                    nextWaypoint = GetBackwardDirectionWaypoint(bot, previousPosition);
                }
                else
                {
                    nextWaypoint = GetForwardDirectionWaypoint(bot, previousPosition);
                }
                if (nextWaypoint != null)
                {
                    MoveBot(bot, nextWaypoint);
                    previousPosition = nextWaypoint.transform.position;
                }
            }
            Destroy(bot.GetComponent <MoveBehavior>());
        }
Exemplo n.º 6
0
 public void Tick()
 {
     Board = BoardProcessor.GetNextBoard(Board);
     TickNumber++;
 }