public void Init(EnemyActionSetting settings, Transform target) { _attackRate = settings.attackRate; switch (settings.actionType) { case EnemyActionType.DISTANCE: settings.muzzlePosition = transform.Find("Muzzle"); switch (settings.distanceAttackType) { case DistanceAttackType.SINGLE: _attackBehaviour = new EnemySingleDistanceAttack(settings, GetComponent <HealthState>(), target); break; case DistanceAttackType.TRIPLE: _attackBehaviour = new EnemyTripleDistanceAttack(settings, GetComponent <HealthState>(), target); break; case DistanceAttackType.MACHINE_GUN: _attackBehaviour = new EnemyMachineGunDistanceAttack(settings, GetComponent <HealthState>(), target); break; case DistanceAttackType.NONE: break; default: throw new ArgumentOutOfRangeException(); } break; case EnemyActionType.MELEE: switch (settings.meleeAttackType) { case MeleeAttackType.EXPLOSION: break; case MeleeAttackType.NONE: break; default: throw new ArgumentOutOfRangeException(); } break; default: throw new ArgumentOutOfRangeException(); } }
public EnemySuicideMeleeAttack(EnemyActionSetting setting) { attackDamage = setting.damage; _timeToExplode = setting.timeToExplode; }