Пример #1
0
        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();
            }
        }
Пример #2
0
 public EnemySuicideMeleeAttack(EnemyActionSetting setting)
 {
     attackDamage   = setting.damage;
     _timeToExplode = setting.timeToExplode;
 }