checkCanReceiveDamage method
This method is used to check if this component can receive damage from any attacker.
Implementation
bool checkCanReceiveDamage(
AttackFromEnum attacker,
double damage,
dynamic from,
) {
switch (receivesAttackFrom) {
case ReceivesAttackFromEnum.ALL:
return true;
case ReceivesAttackFromEnum.ENEMY:
if (attacker == AttackFromEnum.ENEMY) {
return true;
}
break;
case ReceivesAttackFromEnum.PLAYER_AND_ALLY:
if (attacker == AttackFromEnum.PLAYER_OR_ALLY) {
return true;
}
break;
case ReceivesAttackFromEnum.NONE:
return false;
}
return false;
}