Esempio n. 1
0
 private void Update()
 {
     if (!_positionValidator.IsValidPosition())
     {
         Destroy(gameObject);
     }
 }
Esempio n. 2
0
        public void NegativeXResturnsfalse()
        {
            var positionValidator = new PositionValidator();
            var ships             = InitializeShips();

            var userPosition = new Position(-2, 3);
            var columnSize   = 10;
            var rowSize      = 10;

            var actual = positionValidator.IsValidPosition(userPosition, columnSize, rowSize, ships);

            actual.Should().Be(false);
        }
Esempio n. 3
0
        public void NotOverRange()
        {
            var positionValidator = new PositionValidator();
            var ships             = InitializeShips();

            var userPosition = new Position(9, 0);
            var columnSize   = 10;
            var rowSize      = 10;

            bool output = positionValidator.IsValidPosition(userPosition, columnSize, rowSize, ships);

            output.Should().Be(true);
        }
Esempio n. 4
0
        public void OutOfPlayFieldResturnsFalse()
        {
            var positionValidator = new PositionValidator();
            var ships             = InitializeShips();

            var userPosition = new Position(0, 10);
            var columnSize   = 10;
            var rowSize      = 10;

            var actual = positionValidator.IsValidPosition(userPosition, columnSize, rowSize, ships);

            actual.Should().Be(false);
        }
Esempio n. 5
0
        public void Overlap()
        {
            var positionValidator = new PositionValidator();

            var ships = InitializeShips();

            var userPosition = new Position(5, 10);
            var columnSize   = 10;
            var rowSize      = 10;

            bool output = positionValidator.IsValidPosition(userPosition, columnSize, rowSize, ships);

            output.Should().Be(false);
        }