IEnumerator DealCard() { gameState = GameState.CardGenerating; if (currentHeroName == "hero1") { GameObject cardGo = cardGenerator.RandomGenerateCard(); yield return(new WaitForSeconds(2f)); MyCard.AddCard(cardGo); } else { GameObject cardGo = cardGenerator.RandomGenerateCard(); yield return(new WaitForSeconds(2f)); EnemyCard.AddCard(cardGo); } gameState = GameState.PlayCard; GameObject.Find("myCard").GetComponent <myCard>().UpdateShow(); timer = 0; }
//处理每回合的发牌 IEnumerator DealCard() { gameState = GameState.CardGenerating; if (currentHeroName == "hero1") { GameObject cardGo = cardGenerator.RandomGenerCard();//调用方法生成一个随机卡牌//等2秒 yield return(new WaitForSeconds(2f)); //把这个卡片放在卡牌管理器内 myCard.AddCard(cardGo); cardGo = cardGenerator.RandomGenerCard();//调用方法生成一个随机卡牌//等2秒 yield return(new WaitForSeconds(2f)); //把这个卡片放在卡牌管理器内 enemyCard.AddCard(cardGo); } else { GameObject cardGo = cardGenerator.RandomGenerCard();//调用方法生成一个随机卡牌//等2秒 yield return(new WaitForSeconds(2f)); //把这个卡片放在卡牌管理器内 enemyCard.AddCard(cardGo); } gameState = GameState.PlayCard; timer = 0; }