receiveDamage method

bool receiveDamage(
  1. AttackOriginEnum attacker,
  2. double damage,
  3. dynamic identify
)

This method is called to give damage a this component. Only receive damage if the method checkCanReceiveDamage return true.

Implementation

bool receiveDamage(
  AttackOriginEnum attacker,
  double damage,
  dynamic identify,
) {
  if (checkCanReceiveDamage(attacker)) {
    removeLife(damage);
    return true;
  }
  return false;
}