void RotateShape() { _currentShape.RotateRight(); var checkPos = CheckPosForShift(_currentShape.transform); if (checkPos) { UpdateGameField(_currentShape.transform); } else { if (_deltaX != 0) { var oldPos = _currentShape.transform.position; if (TryShiftAfterRotate()) { UpdateGameField(_currentShape.transform); } else { _currentShape.transform.position = oldPos; _currentShape.RotateLeft(); } } else { _currentShape.RotateLeft(); } } }
void NextShape() { int next = 0; for (int i = 0; i < 4; i++) { next = Random.Range(0, 10000) % shapeList.Length; if (!_usedElements.Contains(next)) { break; } } _spawnedObj = Instantiate(shapeList[next], nextShapePoint.transform); _spawnedSp = _spawnedObj.GetComponent <ShapeProps>(); for (int i = 0; i < (int)Random.Range(0, 4); i++) { _spawnedSp.RotateRight(); } SaveToUsedElements(next); }