private void Update() { Targetable target = targeter.GetTarget(); if (!target) { return; } if (!CanFireAtTarget()) { return; } Quaternion targetRotation = Quaternion.LookRotation(target.transform.position - transform.position); transform.rotation = Quaternion.RotateTowards(transform.rotation, targetRotation, rotationSpeed * Time.deltaTime); if (Time.time <= (1 / fireRate) + lastFireTime) { return; } Quaternion projectileRotation = Quaternion.LookRotation(target.GetTargetPoint().position - spawnPoint.position); GameObject projectileInstance = Instantiate(projectilePrefab, spawnPoint.position, projectileRotation); NetworkServer.Spawn(projectileInstance, connectionToClient); lastFireTime = Time.time; }