// Update is called once per frame void Update() { bool update = UpdateTimer(Time.deltaTime); bool instantMove = Input.GetKeyDown(KeyCode.Space); if (update || instantMove) { Grid grid = Grid.Ins; Tetramino tetramino = tetraminoMono.tetramino; Vector2Int offset = Vector2Int.down; bool spawnNewTetramino = false; if (instantMove) { //Vector2Int projectionPos = projection.projection.GetComponent<TetraminoMono>().tetramino.centerPos; //Vector2Int tetraminoPos = tetramino.centerPos; //offset = projectionPos - tetraminoPos; spawnNewTetramino = true; } else { bool collision = Grid.Collision(grid, tetramino, Vector2Int.down, Tetramino.RotationType.None); if (collision) { //Debug.Log("collision"); spawnNewTetramino = true; } else { tetraminoMono.TranslateCenterPosition(offset); } } if (spawnNewTetramino) { Tetramino tetraminoProjectionCopy = projection.DropProjection(); //TODO Check exact spawn time SpawnNewTetramino(); SweepLine.Sweep(tetraminoProjectionCopy); } } }