Example #1
0
    void Update()
    {
        if (target == null || Vector3.Distance(this.transform.position, target.position) > DistanceToForget)
        {
            ReloadComponents();
            randomMovement.enabled = true;
            this.enabled           = false;

            randomMovement.SetNewNavPoint();
        }
        else
        {
            if (attackElapsed <= 0)
            {
                ShootTarget();
                attackElapsed = AttackRate;
            }

            attackElapsed -= Time.deltaTime;
        }
    }
Example #2
0
 void StopChasing()
 {
     randomMovement.enabled = true;
     this.enabled           = false;
     randomMovement.SetNewNavPoint();
 }