private void Start() { _blockInitializer = GetComponent <BlockInitializer>(); _gridManager = _blockInitializer.GridManager; _grid = _gridManager.Grid; var currentShape = _blockInitializer.CurrentShape; var spawnGridPointX = (_grid.Dimensions.x - currentShape.Size.x) / 2; _gridCoordinate = new Vector2Int(spawnGridPointX, 0); if (_gridManager.CheckIfGameOver(_gridCoordinate, currentShape)) { GameOverSignal.Dispatch(); } UpdatePosition(); ShapeVerticalMoveSignal.AddListener(ShiftVertical); ShapeHorizontalMoveSignal.AddListener(ShiftHorizontal); ShapeRotateSignal.AddListener(ShiftRotate); }
public void DispatchHorizontalMove(int v) => ShapeHorizontalMoveSignal.Dispatch(v);
private void OnDestroy() { ShapeVerticalMoveSignal.RemoveListener(ShiftVertical); ShapeHorizontalMoveSignal.RemoveListener(ShiftHorizontal); ShapeRotateSignal.RemoveListener(ShiftRotate); }