private void Update() { if (!bDieState && BattleMng.Ins.battleStart) { bRunState = true; if (bRunState) { anim.SetBool("RnuState", bRunState); if (BattleMng.Ins.monster != null) { this.transform.LookAt(BattleMng.Ins.monster.transform); float step = fSpeed * Time.deltaTime; //transform.position = Vector3.MoveTowards(transform.position, BattleMng.Ins.monster.transform.position, step); bAtkState = ExtensionMethod.Distance(this.transform.position, BattleMng.Ins.monster.transform.position, nAtkRange); if (!bAtkState) { transform.Translate(Vector3.forward * step); } } } } else if (bDieState && BattleMng.Ins.battleStart) { bAtkState = false; bIdleState = true; bRunState = false; anim.SetBool("IdleState", bIdleState); anim.SetBool("AtkState", bAtkState); anim.SetBool("RunState", bRunState); anim.SetFloat("DieState", -0.1f); StartCoroutine(Die()); return; } if (bAtkState) { bRunState = false; bIdleState = false; anim.SetBool("RnuState", bRunState); anim.SetBool("AtkState", bAtkState); anim.SetBool("bIdleState", bIdleState); if (currentTime > 0.0f) { currentTime -= Time.deltaTime; if (currentTime < 0.0f) { Define.Attack_ToMonster(BattleMng.Ins.monster, data); var temp = BattleUIMng.Ins.hitText.GetHitText(); BattleUIMng.Ins.hitTextUI.ActionText(BattleMng.Ins.monster, temp, nAtk); BattleUIMng.Ins.monsterHPBar.HpDown(nAtk); currentTime = time; } } } if (bDamageState) { StartCoroutine(Damage()); } }
public void SkillCall() { if (BattleMng.Ins.monster == null) { return; } while (true) { //쓸 스킬 슬롯 int nRanVal = UnityEngine.Random.Range(0, li_ActiveSkill.Count); //활성화된 스킬 중 전체 스킬 쿨타임 //li_ActiveSkillCoolTime[nRanVal].gameObject.activeSelf == false는 이미 쓴 스킬. //li_ActiveSkillCoolTime[nRanVal].fillAmount <= 0.95f는 현재 스킬은 사용할 수 있으나 아직 쿨타임이 돌고있다. if (li_ActiveSkillCoolTime[nRanVal].gameObject.activeSelf == false || li_ActiveSkillCoolTime[nRanVal].fillAmount <= 0.95f) { continue; } //스킬을 쓸 수 없다. //li_DeActiveSkillCoolTime[nRanVal].fillAmount <=0.95f는 if (li_DeActiveSkillCoolTime[nRanVal].fillAmount <= 0.95f) { continue; } //li_ActiveSkillCoolTime[nRanVal]이 게임오브젝트는 꺼서 비활성화 시켜주고 = 스킬을 썻다. li_ActiveSkillCoolTime[nRanVal].gameObject.SetActive(false); string strSkill = li_DeActiveSkillCoolTime[nRanVal].sprite.name; eHeroSkill eSkill = (eHeroSkill)System.Enum.Parse(typeof(eHeroSkill), strSkill); int key = 0; //스킬 발동 foreach (var val in dli_Pool) { if (val.Value == eSkill) { if (li_Pool[key].gameObject.activeSelf == false) { Debug.Log(eSkill); Debug.Log(val.Value); Debug.Log(li_Pool[key].gameObject.name); Debug.Log(key); li_Pool[key].gameObject.SetActive(true); Vector3 skillPos = BattleMng.Ins.monster.transform.position; float y = 0.5f; skillPos.y += y; li_Pool[key].position = skillPos; break; } } ++key; } var data = eSkill.GetHeroSkillDamageData(); if (data != null) { Define.Attack_ToMonster(BattleMng.Ins.monster, data); } var skillData = eSkill.GetHeroSkillDamageData(); int damage = skillData.nDamage; var temp = BattleUIMng.Ins.hitText.GetHitText(); BattleUIMng.Ins.hitTextUI.ActionText(BattleMng.Ins.monster, temp, damage, sTag); BattleUIMng.Ins.monsterHPBar.HpDown(damage); //스킬 obj끄기 StartCoroutine(SkillSetActive(key)); //쓴 스킬 다시 쿨타임 돌리기 StartCoroutine(DeActiveSkillCoolTime(nRanVal)); break; } }