// 1. 내가 카드를 선택했을 때, // 2. 시간이 다 되어 자동으로 선택 되었을 때 public void Set_Battle() { if (_iBattleRound == 10) { return; } // 내 카드 Card myCard = _myDeck.Get_SelectedCard(); if (null == myCard) { return; } // 니 카드 Card yourCard = _yourDeck.Get_SelectedCard_AI(); StartCoroutine(Battle_Start(myCard, yourCard)); }
// 전투 Anim 시작 void Battle_Animation() { if (_gameState != GAME_STATE.CARD_SELECT) { return; } _gameState = GAME_STATE.BATTLE; LogManager.Log("GameState : BATTLE"); Card myCard = _myDeck.Get_SelectedCard(); Card enemyCard = _enemyDeck.Get_SelectedCard(); if (myCard == null) // 아무것도 선택하지 않고 timeout된 경우 { myCard = _myDeck.Get_LeftmostCard(); } myCard._bUsed = true; myCard.onDeSelected(); if (enemyCard == null) { enemyCard = Singleton.aiManager.Choose_Random(_enemyDeck.Get_Deck()); } enemyCard._bUsed = true; LogManager.Log("my : " + myCard._cardType + "\nenemy : " + enemyCard._cardType); // Use Card _myDeck.UseCard(myCard); _enemyDeck.UseCard(enemyCard); // 스킬 확인 if (_uiPlayer._skill._bActivated) { _uiPlayer._skill.UseSkill(); UsefulFunction.SwapCard(ref myCard, ref enemyCard); LogManager.Log("나 스킬 사용"); } if (Singleton.aiManager.EnemyUseSkill(_enemyDeck, _uiEnemy)) { _uiEnemy._skill.UseSkill(); UsefulFunction.SwapCard(ref myCard, ref enemyCard); LogManager.Log("적 스킬 사용"); } // Select View _uiPlayer._SelectCardView.SetType(myCard._cardType, myCard._bEnhanced); _uiPlayer._SelectCardView.SetFront(false); _uiPlayer._SelectCardView.SetSelectCardMode(false); _uiEnemy._SelectCardView.SetType(enemyCard._cardType, enemyCard._bEnhanced); _uiEnemy._SelectCardView.SetFront(false); // Damage float damageToMe = BattleManager.Get_Damage(enemyCard, _uiEnemy, myCard._cardType); float damageToEnemy = BattleManager.Get_Damage(myCard, _uiPlayer, enemyCard._cardType); float resultToMe = damageToMe; float resultToEnemy = damageToEnemy; if (enemyCard._cardType == CARD_TYPE.HEAL) { resultToMe -= damageToMe / 2f; resultToEnemy -= damageToMe / 2f; } if (myCard._cardType == CARD_TYPE.HEAL) { resultToEnemy -= damageToEnemy / 2f; resultToMe -= damageToEnemy / 2f; } _uiPlayer._hpDamaged = -resultToMe; _uiEnemy._hpDamaged = -resultToEnemy; // Anim StartCoroutine(Play_Anim(BattleManager.Get_BattleResult(myCard._cardType, enemyCard._cardType))); }