// Update is called once per frame void Update() { agent.destination = target.transform.position; //gameObject.transform.LookAt(target.transform.position); sinceLastShot -= Time.deltaTime; if (sinceLastShot < 0 && CanSeeTarget()) { tankGun.fireShell(); sinceLastShot = fireRate; } }