void CheckAttack() { //Collider targetCollider = FIndTarget(); if (m_collider == null) { return; } m_targetHealth = m_collider.GetComponent <MonsterHealth>(); if (m_targetHealth == null || m_targetHealth.IsDie) { return; } float distance = Vector3.Distance(m_targetHealth.transform.position, transform.position); AnimatorStateInfo stateinfo = m_animator.GetCurrentAnimatorStateInfo(0); if ((stateinfo.IsName("Combo3") || stateinfo.IsName("Combo4")) && m_collider.tag == "Monster") { m_collider.GetComponent <MonsterController>().GetHitBack = true; } if (distance <= m_attackRange) { m_targetHealth.DecreaseHp(m_totalStr, CriticalCheck(), gameObject); //m_targetHealth.DecreaseHp(10, CriticalCheck()); if (m_collider.tag == "Monster") { Animator animator = m_targetHealth.GetComponent <Animator>(); m_targetHealth.GetComponent <MonsterController>().GetHitCheck = true; m_targetHealth.GetComponent <MonsterController>().PlayerAttackCheck(gameObject); } } }
public void FifthSkill() { Collider[] targets = Physics.OverlapSphere(transform.position, fifthDistance); if (targets.Length != 0) { foreach (Collider col in targets) { if (col.gameObject.tag == "Monster" || col.gameObject.tag == "Boss") { if (m_collider == null) { m_collider = col.GetComponent <Collider>(); } int damage = (int)(m_totalStr * FindSkillInfo("Skill5", m_SL5)); MonsterHealth health = col.GetComponent <MonsterHealth>(); health.DecreaseHp(damage, CriticalCheck(), gameObject); if (col.tag == "Monster") { health.GetComponent <MonsterController>().PlayerAttackCheck(gameObject); } } } } }
public void ForthSkill() { //지금은 몬스터가 바로 앞으로 소환 되는데 이후 자연스럽게 이동하게 처리하기 Collider[] targets = Physics.OverlapSphere(transform.position, forthDistance); float forwardRange = 1.0f; if (targets.Length != 0) { foreach (Collider col in targets) { if (col.gameObject.tag == "Monster" || col.gameObject.tag == "Boss") { if (m_collider == null) { m_collider = col.GetComponent <Collider>(); } int damage = (int)(m_totalStr * FindSkillInfo("Skill4", m_SL4)); col.transform.position = transform.position + transform.forward * forwardRange; MonsterHealth health = col.GetComponent <MonsterHealth>(); health.DecreaseHp(damage, CriticalCheck(), gameObject); if (col.tag == "Monster") { health.GetComponent <MonsterController>().PlayerAttackCheck(gameObject); } } } } }
public void MagicianFirstSkill() { Collider[] targets = Physics.OverlapSphere(transform.position + transform.forward * 4.0f, m_firstSkillDistance); foreach (Collider col in targets) { if (col.gameObject.tag == "Monster" || col.gameObject.tag == "Boss") { //int damage = (int)(m_totalStr * FindSkillInfo("Skill3", m_SL3)); MonsterHealth health = col.GetComponent <MonsterHealth>(); health.DecreaseHp(m_str, false, gameObject); if (col.gameObject.tag == "Monster") { health.GetComponent <MonsterController>().PlayerAttackCheck(gameObject); } } } }
public void SecondSkill() { m_targetObj.Clear(); float forwardRange = 3.0f; Collider[] targets = Physics.OverlapBox(transform.position + transform.forward * forwardRange, new Vector3(1, 1, 3.0f), transform.rotation); foreach (Collider col in targets) { if (col.gameObject.tag == "Monster" || col.gameObject.tag == "Boss") { if (m_collider == null) { m_collider = col.GetComponent <Collider>(); } int damage = (int)(m_totalStr * FindSkillInfo("Skill2", m_SL2)); MonsterHealth health = col.GetComponent <MonsterHealth>(); health.DecreaseHp(damage, CriticalCheck(), gameObject); if (col.tag == "Monster") { health.GetComponent <MonsterController>().PlayerAttackCheck(gameObject); } } } }
public void SkillOne() { /* * mesh 사용할때 참고 * Shader sh = Shader.Find(""); * Material mat; * mat.shader = sh; */ m_targetObj.Clear(); Collider[] targets = Physics.OverlapSphere(transform.position, firstDistance); foreach (Collider col in targets) { if (col.gameObject.tag == "Monster" || col.gameObject.tag == "Boss") { FirstSkillRange(col.transform); } } if (m_targetObj.Count != 0) { foreach (GameObject g in m_targetObj) { if (m_collider == null) { m_collider = g.GetComponent <Collider>(); } int damage = (int)(m_totalStr * FindSkillInfo("Skill1", m_SL1)); MonsterHealth health = g.GetComponent <MonsterHealth>(); health.DecreaseHp(damage, CriticalCheck(), gameObject); if (g.tag == "Monster") { health.GetComponent <MonsterController>().PlayerAttackCheck(gameObject); } } } }