예제 #1
0
        void Update()
        {
            if (_isInited == false)
            {
                return;
            }

            // Управление игроком
            var direction = _input.GetDirection();

            if (direction != Vector2Int.zero)
            {
                _currentCellItemPosition = _currentCellItemPosition + direction;

                OnPlayerPositionChanged();
            }
        }
예제 #2
0
        private void AddShip(Ship ship)
        {
            Log.Output($"Adding ship: {ship}");
            var coords = new Coordinates(-1, -1);

            while (true)
            {
                coords = _playerInput.GetCoordinates();
                if (ValidCoordinates(coords))
                {
                    var dir   = _playerInput.GetDirection();
                    var added = AddShip(ship, coords, dir);
                    if (added)
                    {
                        break;
                    }
                }
            }
        }