Ejemplo n.º 1
0
 public void RunTurret()
 {
     if (_knower.CurrentTarget != null)
     {
         _turretTurner.TurnToTarget(_knower.CurrentTarget);
     }
     else
     {
         _turretTurner.ReturnToRest();
     }
 }
Ejemplo n.º 2
0
        public void RunTurret()
        {
            var allTargets = _targetDetector.DetectTargets();
            var bestTarget = _targetPicker.FilterTargets(allTargets).OrderByDescending(t => t.Score).FirstOrDefault();

            if (_knower != null)
            {
                _knower.CurrentTarget = bestTarget;
            }

            if (bestTarget != null)
            {
                //Debug.Log(name + " is aiming at " + bestTarget.TargetTransform);
                _turretTurner.TurnToTarget(bestTarget);
                _fireControl.ShootIfAimed(bestTarget);
            }
            else
            {
                _turretTurner.ReturnToRest();
                _fireControl.Shoot(false);
            }
        }