private void InitBgTiles() { int totalTileCount = m_gridResolution * m_gridResolution; m_bgTiles = new Transform[totalTileCount]; Vector2 lossyTileSize = GetLossyTileSize(); Vector3 gridOffset = lossyTileSize * Mathf.FloorToInt(m_gridResolution / 2); for (int idx = 0; idx < totalTileCount; ++idx) { int row = idx / m_gridResolution; int col = idx % m_gridResolution; Vector3 tilePos = new Vector3() { x = row * lossyTileSize.x, y = col * lossyTileSize.y, z = transform.position.z }; tilePos -= gridOffset; Background newBgTile = m_bgFactory.Create(tilePos, Quaternion.identity, transform); m_bgTiles[idx] = newBgTile.transform; } m_maxDistance = (m_gridResolution - 2) * lossyTileSize; m_maxDistance += lossyTileSize / 2f; }
void CreateBackGround() { if (BackgroundFactory != null) { var background = BackgroundFactory.Create(this); SetCameraPosition(background.Center); } }
protected virtual IViewLayout Create() { IBackgroundView backgroundView = null; if (_backgroundFactory != null) { backgroundView = _backgroundFactory.Create(); backgroundView.Hide(); } if (_layoutBehaviourFactory == null) { throw new NullReferenceException(nameof(_layoutBehaviourFactory)); } return(_layoutBehaviourFactory.Create(_layoutCanvas.transform, backgroundView)); }
Captcha(bool createBuilder, Config config) { // the createBuilder is false when the object has been created from the builder // and true when a public constructor is used instead if (createBuilder) { if (config == null) { throw new ArgumentNullException("config", "Configuration object can't be null"); } new Builder(this) .Background(BackgroundFactory.Create(config)) .Keygen(KeygenFactory.Create(config)) .Drawer(DrawerFactory.Create(config)) .Filters(FilterFactory.Create(config)) .Build(); } }