void Damage() { Collider2D[] enemyColList = new Collider2D[5]; int enemyCount = attackTrigger.OverlapCollider(enemyFilter, enemyColList); if (enemyCount > 0) { for (int i = 0; i < enemyCount; i++) { if (enemyColList[i].GetComponent <Enemy_Dead>().isDead == true) { continue; } Enemy_base enemy_Base = enemyColList[i].GetComponent <Enemy_base>(); enemy_Base.TakeDamage(1); enemy_Base.KnockBack(PlayerControl.facingRight ? Vector3.right : Vector3.left, 100f); } } Collider2D[] atkObjColList = new Collider2D[5]; int ObjCount = attackTrigger.OverlapCollider(canAtkObjFilter, atkObjColList); if (ObjCount > 0) { for (int i = 0; i < ObjCount; i++) { CanAtkObj canAtkObj = atkObjColList[i].GetComponent <CanAtkObj>(); if (canAtkObj != null) { canAtkObj.TakeDamage(1); } } } }
// Use this for initialization void Start() { canatkobj = Ice.GetComponentInChildren <CanAtkObj>(); animator = transform.GetComponent <Animator>(); }