public override IEnumerator Excute() { UIBattleCard battleCard = BattleForm.GetUIBattleCard(CardData); if (battleCard == null) { yield return(null); } battleCard.UseCard(); Vector3 cachePos = battleCard.cacheChildCardTrans.position; battleCard.transform.SetParent(BattleForm.UsedCardsGrid.transform, false); BattleForm.UsedCardsGrid.Reposition(); BattleForm.MyCardsGrid.Reposition(); battleCard.cacheChildCardTrans.position = cachePos; yield return(null); TweenPosition.Begin(battleCard.cacheChildCardTrans.gameObject, 0.5f, Vector3.zero, false); PlayerInfoView playerInfoView = BattleForm.GetPlayerInfoViewByPlayer(CardData.Owner); playerInfoView.PlayerInfo.CemeteryCount++; //playerInfoView.PlayerInfo.AP -= battleCard.CardData.Data.Spending; yield return(new WaitForSeconds(0.5f)); BattleForm.OppCardsGrid.Reposition(); battleCard.RefreshDepth(); yield return(null); }
public UIBattleCard CreateBattleCard(BattleCardData cardData, UIGrid parentGrid) { GameObject newCard = GameObject.Instantiate(m_BattleCardTemplate, parentGrid.transform); newCard.SetActive(true); UIBattleCard battleCard = newCard.GetComponent <UIBattleCard>(); battleCard.SetData(cardData, this); dicBattleCard.Add(cardData, battleCard); parentGrid.Reposition(); return(battleCard); }