コード例 #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;
 }
コード例 #2
0
ファイル: SudokuBoardSteps.cs プロジェクト: jasonyandell/Kata
        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));
        }
コード例 #3
0
        public void TestReturnsAnEmptyBoard()
        {
            Board initialBoard  = new Board(0, 0);
            Board expectedBoard = new Board(0, 0);

            Board actualBoard = BoardProcessor.GetNextBoardIteration(initialBoard);

            actualBoard.Should().BeEquivalentTo(expectedBoard);
        }
コード例 #4
0
        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);
        }
コード例 #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>());
        }
コード例 #6
0
 public void Tick()
 {
     Board = BoardProcessor.GetNextBoard(Board);
     TickNumber++;
 }