// 배틀데이터를 받아와 공격 ( 메인 배틀 한턴 ) public IEnumerator BattleStart() { BattleUIManager.Inst.StageInfoOff(); isBattleStart = true; battleActionData stageActionInfo = UserDataManager.Inst.GetStageAction(); UserDataManager.Inst.stageState.turn = stageActionInfo.turn; for (int i = 0; i < stageActionInfo.character_action_list.Count; i++) { if (stageActionInfo.character_action_list[i].action_type == 2) { character[stageActionInfo.character_action_list[i].my_position].GetComponent <BasicAttack>().Attack(stageActionInfo.character_action_list[i]); } else if (stageActionInfo.character_action_list[i].action_type == 3) { if (stageActionInfo.character_action_list[i].my_position < 10) { BattleUIManager.Inst.MySkAction(GetCharState(stageActionInfo.character_action_list[i].my_position).activeSkillList[0].id); } else { BattleUIManager.Inst.EnemySkAction(GetCharState(stageActionInfo.character_action_list[i].my_position).activeSkillList[0].id); } SkillManager.Inst.SendMessage("Skill_" + GetCharState(stageActionInfo.character_action_list[i].my_position).activeSkillList[0].id.ToString(), stageActionInfo.character_action_list[i]); } if (i + 1 != stageActionInfo.character_action_list.Count && stageActionInfo.character_action_list[i].action_info_list.Count != 0 && stageActionInfo.character_action_list[i + 1].action_info_list[0].target_position == stageActionInfo.character_action_list[i].my_position && stageActionInfo.character_action_list[i + 1].my_position == stageActionInfo.character_action_list[i].action_info_list[0].target_position ) { yield return(new WaitForSeconds(7.0f)); } else { yield return(new WaitForSeconds(3.0f)); } isAfterDelay = false; } yield return(new WaitForSeconds(3.0f)); for (int i = 0; i < stageActionInfo.character_buff_list.Count; i++) { actionInfo tump = new actionInfo(); tump.damage = stageActionInfo.character_buff_list[i].damage; tump.target_position = stageActionInfo.character_buff_list[i].position; if (stageActionInfo.character_buff_list[i].type == 1 || stageActionInfo.character_buff_list[i].type == 3) { DamageManager.Inst.DamageShow(tump, true, ELEMENT_TYPE.None, false); } else if (stageActionInfo.character_buff_list[i].type == 2 || stageActionInfo.character_buff_list[i].type == 4) { DamageManager.Inst.DamageShow(tump, false, ELEMENT_TYPE.None, false); } yield return(new WaitForSeconds(0.1f)); } isBattleStart = false; turnIndex++; BattleUIManager.Inst.StageInfoOn(); int myHp = 0, enemyHp = 0; for (int i = 0; i < 10; i++) { myHp += status[i].NowHp; enemyHp += status[i + 10].NowHp; } if (enemyHp == 0) { #if UNITY_EDITOR Cheat.Inst.RequestStageRewardCheat(); #else if (UserDataManager.Inst.GetUserInfo().sceneState == SCENE_STATE.PVP) { PacketManager.Inst.RequestPVPResult(); } else { PacketManager.Inst.RequestStageReward(); } #endif } else if (myHp == 0) { battleFail.SetActive(true); } else if (isAuto) { yield return(new WaitForSeconds(2.0f)); TurnEnd(); } }
public void DamageShow(actionInfo attackInfo, bool isHeal, ELEMENT_TYPE type, bool isCamera = true) // 맞은 대상의 인덱스와 플레이어 여부, 데미지, 크리티컬, 힐 여부 { var damageText = textPool.ObjectSpawn(); if (!attackInfo.avoid) { if (isHeal) { damageText.text.text = attackInfo.damage.ToString(); damageText.text.color = HealColor[0]; damageText.outLine.effectColor = HealColor[1]; BattleManager.Inst.status[attackInfo.target_position].NowHp += attackInfo.damage; if (BattleManager.Inst.status[attackInfo.target_position].NowHp > BattleManager.Inst.status[attackInfo.target_position].Status[EFFECT_ID.HP]) { BattleManager.Inst.status[attackInfo.target_position].NowHp = BattleManager.Inst.status[attackInfo.target_position].Status[EFFECT_ID.HP]; } } else { if (type == ELEMENT_TYPE.None) { if (attackInfo.critical) { damageText.text.color = CriticalColor[0]; damageText.outLine.effectColor = CriticalColor[1]; damageText.text.text = "Critical\n" + attackInfo.damage.ToString(); } else { damageText.text.text = attackInfo.damage.ToString(); damageText.text.color = TextColor[0].textColor; damageText.outLine.effectColor = TextColor[0].outColor; } } else { if (type == ELEMENT_TYPE.Fire && BattleManager.Inst.GetCharState(attackInfo.target_position).elementType == 4 || type == ELEMENT_TYPE.Wind && BattleManager.Inst.GetCharState(attackInfo.target_position).elementType == 3 || type == ELEMENT_TYPE.Earth && BattleManager.Inst.GetCharState(attackInfo.target_position).elementType == 2 || type == ELEMENT_TYPE.Water && BattleManager.Inst.GetCharState(attackInfo.target_position).elementType == 1 || type == ELEMENT_TYPE.Light && BattleManager.Inst.GetCharState(attackInfo.target_position).elementType == 6 || type == ELEMENT_TYPE.Dark && BattleManager.Inst.GetCharState(attackInfo.target_position).elementType == 5) { damageText.text.color = TextColor[(int)type].textColor; damageText.outLine.effectColor = TextColor[(int)type].outColor; if (attackInfo.critical) { damageText.text.text = "Critical\n" + attackInfo.damage.ToString(); } else { damageText.text.text = "Weak\n" + attackInfo.damage.ToString(); } } else { if (attackInfo.critical) { damageText.text.text = "Critical\n" + attackInfo.damage.ToString(); damageText.text.color = CriticalColor[0]; damageText.outLine.effectColor = CriticalColor[1]; } else { damageText.text.text = attackInfo.damage.ToString(); damageText.text.color = TextColor[0].textColor; damageText.outLine.effectColor = TextColor[0].outColor; } } } BattleManager.Inst.status[attackInfo.target_position].NowHp -= attackInfo.damage; } } else { damageText.text.text = "Miss"; damageText.text.color = MissColor[0]; damageText.outLine.effectColor = MissColor[1]; } damageText.obj.transform.position = Camera.main.WorldToScreenPoint(BattleManager.Inst.character[attackInfo.target_position].transform.position + new Vector3(0, BattleManager.Inst.character[attackInfo.target_position].GetComponent <CharInfo>().Height, 0)); if (BattleManager.Inst.status[attackInfo.target_position].NowHp < 0) { BattleManager.Inst.status[attackInfo.target_position].NowHp = 0; } if (!isHeal && isCamera) { if (!attackInfo.critical) { StartCoroutine(NotCriticalAttackEffect()); } else { StartCoroutine(CriticalAttackEffect()); } } }