private void OnMouseDown() { sequence.Kill(); // return applied card to owner's hand if (buffCardModel.isApplied()) { buffCardModel.State = BuffCardState.movingToHand; } else if (buffCardModel.isDraggable()) { buffCardModel.State = BuffCardState.dragging; } }
void Update() { //if (previousState == model.State) return; if (model.State == BuffCardState.dragging || model.isHandHovering()) { spriteRenderer.sortingOrder = 10; } if (model.State == BuffCardState.dragging) { model.transform.parent.DOScale(draggingScale, duration).SetEase(Ease.OutQuint); } if (model.State == BuffCardState.movingToHand) { buffOverlayManager.setVisible(true); buffOverlayManager.setAllActive(false); model.transform.parent.DOScale(hoveringInHandMovingDownScale, duration).SetEase(Ease.OutQuint); } if (model.State == BuffCardState.inHand || model.isApplied()) { spriteRenderer.sortingOrder = 0; } updateDraggingOver(); if (model.HoveringOverApplied) { spriteRenderer.sortingOrder = 20; buffOverlayManager.setVisible(false); model.transform.parent.DOScale(draggingScale, duration).SetEase(Ease.OutQuint); } else if (model.isApplied()) { spriteRenderer.sortingOrder = 0; buffOverlayManager.setVisible(true); tweenWithDisable(appliedScale); if (model.State == BuffCardState.appliedAsBuff) { buffOverlayManager.setAsBuff(); } if (model.State == BuffCardState.appliedAsDiscard) { buffOverlayManager.setAsDiscard(); } if (model.State == BuffCardState.appliedAsDrawThree) { buffOverlayManager.setAsDrawThree(); } if (model.State == BuffCardState.appliedAsSwitchLeft) { buffOverlayManager.setAsSwitchLeft(); } if (model.State == BuffCardState.appliedAsSwitchRight) { buffOverlayManager.setAsSwitchRight(); } if (model.State == BuffCardState.appliedAsCounter) { buffOverlayManager.setAsCounter(); } } // increase card size when hovering if (model.State == BuffCardState.hoveringInHandMovingUp) { model.transform.parent.DOScale(hoveringInHandMovingUpScale, duration).SetEase(Ease.OutQuint); } // decrease card size when stop hovering else if (model.State == BuffCardState.hoveringInHandMovingDown) { model.transform.parent.DOScale(hoveringInHandMovingDownScale, duration).SetEase(Ease.OutQuint); } previousState = model.State; }