void Start() { gameClock = GetComponent <GameClock>(); tetrominoManager = GetComponent <TetrominoManager>(); scoreKeeper = GetComponent <ScoreKeeper>(); board = transform.Find("Board").GetComponent <Board>(); }
public void Close() { gameManager = null; tetrominoManager = null; timer = null; arrowKeyHeld = false; }
void Initialize() { //Create and set configurables //First all Monobehaviours if (gameUIManager == null) { gameUIManager = FindObjectOfType <GameUIManager>(); } if (audioManager == null) { audioManager = FindObjectOfType <AudioManager>(); } gameUIManager.SetSpawnConfig(configsReferences.GetConfig(ConfigType.TetrominoSpawn)); audioManager.SetSpawnConfig(configsReferences.GetConfig(ConfigType.Audio)); board = new Board(configsReferences.GetConfig(ConfigType.Board)); tetrominoManager = new TetrominoManager(configsReferences.GetConfig(ConfigType.TetrominoSpawn)); inputManager = new InputManager(configsReferences.GetConfig(ConfigType.KeyboardInput)); boardStateController = new BoardStateController(board, tetrominoManager, BoardStateType.InitState); }
private void Start() { tetrominoManager = GameObject.Find("Tetromino Manager").GetComponent <TetrominoManager>(); levelText = GameObject.Find("Level").GetComponent <Text>(); scoreText = GameObject.Find("Score").GetComponent <Text>(); comboText = GameObject.Find("Combo").GetComponent <Text>(); }
void Start() { tetrominoManager = GameObject.FindGameObjectWithTag("Session").GetComponent <TetrominoManager> (); grid = new Block[GRID_HEIGHT, GRID_WIDTH]; foreach (Transform block in transform.Find("Blocks")) { Destroy(block.gameObject); } }
public void Init() { gameManager = GameObject.FindGameObjectWithTag("GameManager").GetComponent <GameManager>(); GameObject session = gameManager.transform.Find("Session").gameObject; tetrominoManager = session.GetComponent <TetrominoManager>(); timer = session.GetComponent <GameClock> ().GetNewTimer(); timer.SetTimeout(LONG_PRESS_LATERAL); activeArrowKey = KeyCode.None; }
//On Create public BoardStateController(Board board, TetrominoManager tetrominoManager, BoardStateType initStateType) { //Fill up the dictionary by creating and adding all board states boardStates = new Dictionary <BoardStateType, BoardState>(); boardStates.Add(BoardStateType.InitState, new InitBoardState(board, this)); boardStates.Add(BoardStateType.AutoFallState, new AutoFallBoardState(board, this, tetrominoManager)); boardStates.Add(BoardStateType.LockingState, new LockingBoardState(board, this)); boardStates.Add(BoardStateType.LineCompletionState, new LineCompletionBoardState(board, this)); boardStates.Add(BoardStateType.GameOverState, new GameOverBoardState(board, this)); InitializeBoardState(initStateType); }
private void Start() { grid = GameObject.Find("Grid").GetComponent <Grid>(); tetrominoManager = GameObject.Find("Tetromino Manager").GetComponent <TetrominoManager>(); map = new List <GameObject> [grid.Height]; for (int row = 0; row < map.Length; ++row) { map[row] = new List <GameObject>(10); for (int col = 0; col < grid.Width; ++col) { map[row].Add(null); } } }
//On Create public AutoFallBoardState(Board _board, BoardStateController _controller, TetrominoManager _tMan) : base(_board, _controller) { //Cache tetromino manager reference tetrominoManager = _tMan; //Set fall timers fallTime = boardConfig.fallTime; fallMultiplier = boardConfig.fallMultiplier; fallPieces = boardConfig.fallPieces; lockedPieces = 0; //Set proper rotation method SetRotation(); boardRenderer = new BoardRenderer(_board, _tMan); }
/// <summary> /// Check is above grid /// </summary> /// <param name="tetrominoManager"></param> /// <returns></returns> public static bool CheckIsAboveGrid(TetrominoManager tetrominoManager) { for (var x = 0; x < GridWidth; ++x) { foreach (Transform mino in tetrominoManager.transform) { var pos = Game.RoundPosition(mino.position); if (pos.y > GridHeight - 1) { return(true); } } } return(false); }
//Init public BoardRenderer(Board _board, TetrominoManager _tMan) { board = _board; tetrominoManager = _tMan; boardConfig = board.boardConfig; }