private void TailAttack() { m_targetObj.Clear(); Collider[] targets = Physics.OverlapSphere(transform.position, 6.0f); foreach (Collider col in targets) { if (col.gameObject.tag == "Player" || col.gameObject.tag == "Mercenary") { TailAttackRange(col.transform); } } if (m_targetObj.Count != 0) { foreach (GameObject g in m_targetObj) { int damage = (int)m_bossStr; if (g.tag == "Player") { PlayerHealth health = g.GetComponent <PlayerHealth>(); health.DecreaseHp(damage); g.GetComponent <CharController>().isHitBack = true; } else if (g.tag == "Mercenary") { string name = g.GetComponent <MercenaryHealth>().name; MercenaryHealth health = g.GetComponent <MercenaryHealth>(); health.DecreaseHp(damage); if (name == "Dwarf") { g.GetComponent <Dwarf>().isHitBack = true; } else if (name == "Magician") { g.GetComponent <Magician>().isHitBack = true; } else { Debug.Log("tail"); } } } } }
void Start() { m_player = GameObject.FindGameObjectWithTag("Player"); m_nvAgent = GetComponent <NavMeshAgent>(); m_nvAgent.enabled = true; m_animator = GetComponent <Animator>(); m_health = GetComponent <MercenaryHealth>(); Transform t = transform.Find("SkillEffect"); if (t != null) { ParticleSystem[] ps = t.GetComponentsInChildren <ParticleSystem>(true); m_particles.AddRange(ps); } //임시 m_oriHp = m_player.GetComponent <CharController>().GetTotalHp;; m_hp = m_oriHp; m_distance = 100.0f; m_health.GetHp = m_oriHp; m_health.Init(); }