void RotateBlock() { transform.Rotate(Vector3.forward, curRot); foreach (Transform child in transform) { if (MatrixGrid.CheckPosFilled(Vector3Int.RoundToInt(child.position))) { transform.Rotate(Vector3.forward, -curRot); return; } } }
void CheckBlockPosition() { if (delayStart + delay > Time.time) { valid = true; foreach (Transform child in transform) { if (MatrixGrid.CheckPosFilled(Vector3Int.RoundToInt(child.position))) { MatrixGrid.gameOver = true; return; } if (MatrixGrid.ReachedBottom(Vector3Int.RoundToInt(child.position))) { valid = false; } } if (valid) { SoftDrop(); } foreach (Transform child in transform) { if (MatrixGrid.ReachedBottom(Vector3Int.RoundToInt(child.position))) { Spawner.activeBlock = null; //yield return new WaitForSeconds(BlockFallTimer.timer + (14f / 60f)); foreach (Transform child2 in transform) { MatrixGrid.Lock(Vector3Int.RoundToInt(child2.position)); MatrixGrid.SetGrid(Vector3Int.RoundToInt(child2.position), child2.gameObject); } CheckRowClears(); Spawner.isBlockPlaced = true; Destroy(this); break; } } } }