private void OnTriggerEnter(Collider other) { // Debug.Log(other); if (other.GetComponent <damageHitbox>() != null) { damageHitbox otherDH = other.GetComponent <damageHitbox>(); if ((otherDH.isFriendly && gameObject.tag == "Player") || (otherDH.isUnFriendly && gameObject.tag == "Enemy") && !isDeath) { if (other.tag == "Heal" && !otherDH.isDamaged(this) && hpCurrent < hpMax) { otherDH.regisUnit(this); Debug.Log("tigger enter heal" + other.name); takenHeal(otherDH.damage); showParticleEffect(otherDH.effect); } return; } /* if (otherDH.isUnFriendly && gameObject.tag == "Enemy") * { * return; * }*/ if (other.tag == "Damage" && !otherDH.isDamaged(this)) { otherDH.regisUnit(this); // Debug.Log("tigger enter " + other.name); takenDamage(otherDH.damage, otherDH.ownerUnit); showParticleEffect(otherDH.effect); } // else } // deal with item DropItem dt = other.GetComponent <DropItem>(); if (dt != null && gameObject.tag == "Player" && dt.CanPlayerPickItem(this)) { ItemBase item = other.GetComponent <ItemBase>(); if (item != null && !item.picked) { DamageTextControl.instance.CreateGetItemText(item.itemModel.popupWhenGetItemText, transform); item.picked = true; } // showParticleEffect(potion.getParticle()); dt.getItem(this); } }