private void ResetCameraToFaceMapCenter() { var mapCenterPoint = new Vector3(_mapWidth, 0f, _mapLength) * GridOffsetValue - GridOffset; var cameraTransform = _gameCamera.transform; cameraTransform.position += Vector3.up * (_cameraInitialHeight - cameraTransform.position.y); cameraTransform.position += mapCenterPoint - GroundPointUtilities.GetCameraForwardGroundPoint(_gameCamera); _baseCameraPosition = cameraTransform.position; }
public Tile GetPointedTile() { var pointerGroundPos = GroundPointUtilities.GetPointerGroundPoint(_gameCamera); var offsetGroundPos = pointerGroundPos + GridOffset; if (offsetGroundPos.x < 0 || offsetGroundPos.z < 0 || offsetGroundPos.x >= _mapLength || offsetGroundPos.z >= _mapWidth) { return(null); } else { var pointedIndex = (int)offsetGroundPos.z * _mapWidth + (int)offsetGroundPos.x; return(_tiles[pointedIndex]); } }