//fixed update function which checks if ranged enemies are in range of the enemy and shoots void FixedUpdate() { if (thisEnemy.playerSpotted && thisEnemy.GetDistance() <= 90f && thisEnemy.activeWeapon == enemyController.Weapon.OAKSHORTBOW) { thisEnemy.rb2d.MovePosition(thisEnemy.transform.position); if (Time.time > nextShot) { nextShot = Time.time + fireRate; Instantiate(projectile, transform); bowRelease.Play(); } } }