public void PutOnTopOfMogi(CardEntity card, MogiEntity mogi) { if (CardData.Instance.GetCard(card.name, false).features != null) { CardData.Instance.GetCard(card.name, false).features.CashSkill(); } else { Debug.Log("not have features"); } }
public async void HandToOpponentTopMogi(MogiEntity mogi, Action complete) { MotionManager.AddMotion(); render.sortingOrder = 1000; bool moveComplete = false; 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); MotionManager.RemoveMotion(); MoveToTopOfMogi(mogi); await new WaitUntil(() => !MotionManager.running); complete?.Invoke(); }
private MogiEntity WeakestCard(bool isController) { MogiEntity card = null; List <MogiEntity> cards = BoardUI.Instance.MogiInBoardNotAttacked(isController); for (int i = 0; i < cards.Count; i++) { if (card == null || cards[i].attackPoint < card.attackPoint) { card = cards[i]; } } return(card); }
private async void AttackControllerMogi(Animator animator) { //stupid AI MogiEntity attackCard = WeakestCard(false); MogiEntity targetCard = WeakestCard(true); AIBehaviour.Instance.inAction = true; ((CardMogiMotion)attackCard.motion) .MogiAttackAnimation((CardMogiMotion)targetCard.motion, () => { AIBehaviour.Instance.inAction = false; attackCard.Attack(targetCard); }); await new WaitUntil(() => AIBehaviour.Instance.inAction); await new WaitForSeconds(1); animator.SetInteger("action", 4); }
public SlotUI PutOnTopMogi(CardEntity moveCard, MogiEntity mogiCard) { SlotUI[] slots = null; if (moveCard.isController) { slots = controllerSlotUIs; } else { slots = opponentSlotUIs; } for (int i = 0; i < slots.Length; i++) { if (slots[i].cardEntity == mogiCard) { slots[i].PutOnTopOfMogi(moveCard, mogiCard); return(slots[i]); } } return(null); }
public void Attack(MogiEntity target) { hadAttack = true; target.TakeDamage(attackPoint); this.TakeDamage(target.attackPoint); }