Ejemplo n.º 1
0
 public Character(IAttackBehaviour attackBehaviour = null, IGreetingBehaviour greetingBehaviour = null,
                  IWalkBehaviour walkBehaviour     = null)
 {
     AttackBehaviour   = attackBehaviour ?? new DefaultAttack();
     GreetingBehaviour = greetingBehaviour ?? new DefaultGreeting();
     WalkBehaviour     = walkBehaviour ?? new SlowWalk();
 }
Ejemplo n.º 2
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();
            }
        }
Ejemplo n.º 3
0
 private void Awake()
 {
     InitializeStateMachine();
     Attack = GetComponent <IAttackBehaviour>();
 }