public static void resetColors() { OBlock.resetColor(); IBlock.resetColor(); TBlock.resetColor(); JBlock.resetColor(); LBlock.resetColor(); SBlock.resetColor(); ZBlock.resetColor(); }
private void DiscardColors(OptionArgs args) { OBlock.resetColor(); IBlock.resetColor(); TBlock.resetColor(); JBlock.resetColor(); LBlock.resetColor(); SBlock.resetColor(); ZBlock.resetColor(); ColorData.saveColors(); }
private void Reset(OptionArgs args) { BlockType.textureAsset = "Game/Bricks/Cat-Eye Brick"; OBlock.resetColor(); IBlock.resetColor(); TBlock.resetColor(); JBlock.resetColor(); LBlock.resetColor(); SBlock.resetColor(); ZBlock.resetColor(); ColorData.saveColors(); }
BlockType randomize() { BlockType randomBlock; switch (random.Next(1, 8)) { case 1: randomBlock = new OBlock(); break; case 2: randomBlock = new IBlock(); break; case 3: randomBlock = new TBlock(); break; case 4: randomBlock = new LBlock(); break; case 5: randomBlock = new JBlock(); break; case 6: randomBlock = new SBlock(); break; case 7: randomBlock = new ZBlock(); break; default: randomBlock = new LBlock(); break; } randomBlock.load(Game.Content); return(randomBlock); }
public static void CreateGrid(int _width, int _height, GameObject _wallBlock) { int _originX, _originY; //To give grids some consistency, place grids at the same height (3) until size exceeds screen height if (_height <= 26) { _originY = 3; } else { _originY = maxHeight - _height; } blockSpawnPoint.x = gridMidPoint * 10f; blockSpawnPoint.y = (_originY + _height) * 10f; Debug.Log(blockSpawnPoint); Block.CreateSpawnCoordinates(blockSpawnPoint); IBlock.CreateSpawnCoordinates(blockSpawnPoint); OBlock.CreateSpawnCoordinates(blockSpawnPoint); _originX = gridMidPoint - Mathf.CeilToInt((float)(_width * 0.5)); for (int x = 0; x < maxWidth; x++) { for (int y = 0; y < maxHeight; y++) { if (x < _originX || x > (_originX + (_width - 1)) || y < _originY || y > (_originY + (_height - 1))) { GameObject wall = Instantiate <GameObject>(_wallBlock, gridTransform, false); wall.transform.localPosition = new Vector2(x * 10f, y * 10f); wall.name = x.ToString() + " " + y.ToString(); grid[x, y] = wall.transform; } else { grid[x, y] = null; } } } /////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// //Create one block border around Grid /////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// float _xPos = -20f, _ypos = -10f; //Bottom Border for (int x = 0; x <= maxWidth + 1; x++) { _xPos += 10f; Instantiate <GameObject>(_wallBlock, gridTransform, false).transform.localPosition = new Vector2(_xPos, _ypos); } //RightBorder for (int y = 0; y <= maxHeight; y++) { _ypos += 10f; Instantiate <GameObject>(_wallBlock, gridTransform, false).transform.localPosition = new Vector2(_xPos, _ypos); } //TopBorder for (int x = 0; x <= maxWidth; x++) { _xPos -= 10f; Instantiate <GameObject>(_wallBlock, gridTransform, false).transform.localPosition = new Vector2(_xPos, _ypos); } //LeftBorder for (int y = 0; y <= maxHeight - 1; y++) { _ypos -= 10f; Instantiate <GameObject>(_wallBlock, gridTransform, false).transform.localPosition = new Vector2(_xPos, _ypos); } }