예제 #1
0
 private void NextPositionOccupiedHandler(IntVector2 occupiedPosition)
 {
     _moveStepByStepController.Cancel();
     _occupiedPossitions = _occupatedPossitionsMap.GetOccupiedPositions();
     RemoveCurrentUnitPosition();
     _pathGeneratorController.MoveToPositionAvoidingOccupiedCells(_pathGeneratorController.Destination, _occupiedPossitions);
 }
예제 #2
0
        public void Cancel_ShouldNotRiseMovePathComplete(int moveCompleteCalledCount)
        {
            // Arrange
            List <IntVector2> path = new List <IntVector2>();

            path.Add(new IntVector2(0, 0));
            path.Add(new IntVector2(1, 1));
            path.Add(new IntVector2(2, 1));
            path.Add(new IntVector2(3, 1));

            int actualMoveCompleteCalledCount = 0;

            Mock.Arrange(() => _occupatedPossitionsMap.IsVacantPosition(Arg.IsAny <IntVector2>()))
            .Returns(true);

            _moveStepByStepController = CreateMoveStepByStepController();
            _moveStepByStepController.MovePathComplete += () => actualMoveCompleteCalledCount++;

            // Act
            _moveStepByStepController.MoveTo(path);
            _moveStepByStepController.Cancel();
            for (int i = 0; i < moveCompleteCalledCount; i++)
            {
                _unitGameObjectController.MoveTo(new IntVector2(0, 0));
            }

            // Assert
            Assert.Equal(1, actualMoveCompleteCalledCount);
        }
예제 #3
0
 private void ChangeDirrectionPath()
 {
     _unitGameObjectController.MoveTileComplete -= OnChangeDirrectionMovePathCmplete;
     _moveStepByStepController.Cancel();
     _unitGameObjectController.MoveTileComplete += OnChangeDirrectionMovePathCmplete;
 }