Beispiel #1
0
        void Update()
        {
            if (entityComponent.enabled)
            {
                targets = attackComponent.FindTargets(true, 10);
                if (targets.Count > 0)
                {
                    PointAt(targets[0]);

                    fireCooldownLeft -= Time.deltaTime;
                    if (fireCooldownLeft <= 0 && direction.magnitude <= range)
                    {
                        fireCooldownLeft = fireCooldown;
                        Fire(targets[0], projectilePrefab);
                    }
                }
            }
        }
Beispiel #2
0
 void FindTarget()
 {
     targetsList = attackComponent.FindTargets(false, 20);
 }