public override void OnFall(int fallHeight) { DeRegisterMethodsFromCell(x, y); RegisterMethodsOnCell(x, y + fallHeight); y += fallHeight; MasterSequence.Append(transform.DOMove(GridDisplayer.GridToWorld(x, y), fallTweenDuration).SetEase(Ease.OutBounce)); }
public override void OnSwap(Vector2Int newCellPos) { // deregister methods from the original cell DeRegisterMethodsFromCell(x, y); // register methods on the new cell RegisterMethodsOnCell(newCellPos); // set x and y to new cell x = newCellPos.x; y = newCellPos.y; // tween position MasterSequence.Append(transform.DOMove(GridDisplayer.GridToWorld(x, y), swapTweenDuration)); wasSwapped = true; }
public override void OnSwapFail(Vector2Int newCellPos) { // move to the new position then back to the old one MasterSequence.Append(transform.DOMove(GridDisplayer.GridToWorld(newCellPos), swapTweenDuration)); MasterSequence.Append(transform.DOMove(GridDisplayer.GridToWorld(x, y), swapTweenDuration)); }