Beispiel #1
0
 protected override void Step(float deltaTime)
 {
     if (_attackerable.HasTarget())
     {
         _movable.StopMovement();
         _movable.Anchor();
         if (!_attackerable.OnCooldown)
         {
             var target = _attackerable.Targets[0];
             _attackerable.Attack(target);
         }
     }
     //Aggroable is optional so we check for null
     else if (_aggroable != null && _aggroable.HasTarget())
     {
         _movable.UnAnchor();
         var target   = _aggroable.Targets[0];
         var position = target.transform.position;
         _movable.MoveTo(position);
         _movable.StartMovement();
     }
     else
     {
         _movable.UnAnchor();
         _movable.StartMovement();
         _movable.MoveTo(_destenation);
     }
 }
Beispiel #2
0
 // Update is called once per frame
 void Update()
 {
     if (_attackerable.HasTarget() && !_attackerable.OnCooldown)
     {
         _attackerable.Attack(_attackerable.Targets[0]);
     }
 }
Beispiel #3
0
        public override void PreStep(float deltaStep)
        {
            var enemies = ScanForEnemies();

            if (enemies.Length == 0)
            {
                _movable.MoveTo(_destenation);
            }
            else
            {
                _movable.Stop();
                _attackerable.Attack(enemies[0]);
            }
        }