private void CheckMoveToBoard(CardEntity card) { if (HandUI.Instance.cardInControllerHand.Contains(card)) { if (BoardUI.Instance.putDownCardArea.bounds.Contains(card.motion.cardTran.position)) { //putcard down to board if (card.info.manaCost <= Game.Instance.controller.activity.actionPoints) { if (card.info.putOn == Card.PutOn.emptySlot) { card.MoveToSlot(); } else { CheckTopOfControllerMogi(card, BoardUI.Instance.MogiInBoard(true)); } } } } }
public async void MoveToSlot(SlotUI slot, bool moveToTop, Action complete) { MotionManager.AddMotion(); if (!cardUI.showFront) { bool moveComplete = false; //move to center MoveToPosition(new Vector3(0, 0, -5), 1000, true, 20, () => { moveComplete = true; }); await new WaitUntil(() => moveComplete); await new WaitForSeconds(0.2f); Quaternion midle = Quaternion.Euler(0, -90, 0); //rotation float timeCouter = 0; while (timeCouter < 1) { timeCouter += Time.deltaTime * 10f; cardTran.rotation = Quaternion.Lerp(Quaternion.identity, midle, timeCouter); await new WaitForUpdate(); } cardUI.ShowFrontOfCard(); render.flipX = true; Quaternion last = Quaternion.Euler(0, -180, 0); timeCouter = 0; while (timeCouter < 1) { timeCouter += Time.deltaTime * 10f; cardTran.rotation = Quaternion.Lerp(midle, last, timeCouter); await new WaitForUpdate(); } render.flipX = false; cardTran.rotation = Quaternion.identity; cardUI.ShowFrontComplete(); await new WaitForSeconds(0.2f); } int sorting = 1; if (moveToTop) { sorting = 1000; } MoveToPosition(slot.slotTransform.position, sorting, false, 10, () => { //move to hand MotionManager.RemoveMotion(); if (!moveToTop) { entity.MoveToSlot(); } complete.Invoke(); }); }