private void OnTriggerStay2D(Collider2D collision) { if (collision.tag == TagManager.FreePlace) { _onFreePlace = true; if ((Vector2)_lastPosition == (Vector2)collision.transform.position) { _freePlace = collision.GetComponent <FreePlace>(); //Получение данных свободного места перед перемещением } } if (collision.tag == TagManager.Block || collision.tag == TagManager.Chip) { _onBlock = true; //Проверка, над каким объектом находится фишка в данный момент } }
private void Chip_OnButtonUp() { _keyPressed = false; if (_onFreePlace) { transform.position = _nextPos; } if (!_onFreePlace) { transform.position = _lastPosition; if (_onBlock) { _onBlock = false; } } if (_freePlace != null) { _freePlace = null; } }