public virtual void Attack(GameObject enemy) { if (enemy != null) { AttackBase attack_base = enemy.GetComponent <AttackBase> (); if (!attack_base) { attack_base = enemy.GetComponentInParent <AttackBase> (); } attack_base.BeAttacked(gameObject, gameObject.PropertyComponent().attackPower); } }