// Update is called once per frame
    void Update()
    {
        if (target == null)
        {
            return;
        }
        snare.Desnare(duracaoSnare);

        agent.destination = target.position;

        OlhandoProPlayer();

        float distance = Vector3.Distance(transform.position, target.position);

        if (distance <= disShot)
        {
            if (!isShooting)
            {
                InvokeRepeating("Shoot", Random.Range(minAtirar, maxAtirar), Random.Range(minAtirar, maxAtirar));
                isShooting = true;
            }
        }
        else
        {
            CancelInvoke("Shoot");
            isShooting = false;
        }
    }
示例#2
0
 // Update is called once per frame
 void Update()
 {
     snare.Desnare(duracaoSnare);
 }