regarding tower defence game

what i have done:
when enemy comes in the range of the tower the tower rotates towards the enemy and start firing…and keep rotating until it crosses the range…
but when the second enemy comes it dont move…
my code is like this

using UnityEngine;
using System.Collections;

public class TowerControleRotation : MonoBehaviour {

public Transform lookAtTarget;
public int range;
public Transform captureEnemy;
public GameObject EnemyInHand;
public int enemynumber=0;
public int countt=0;
void Awake()
	{	
	
			if (!lookAtTarget)
				{
    					lookAtTarget = GameObject.FindWithTag("enemy").transform;
					
				}
	


void Update() 

	{ 		
    			
				if(lookAtTarget && CanAttackTarget())
					{
				var rotate = Quaternion.LookRotation(lookAtTarget.transform.position - transform.position);
    			transform.rotation = Quaternion.Slerp(transform.rotation, rotate, 1); 
   				transform.Translate (0,0,0);
				
					}
				
			
	
	
	}

bool CanAttackTarget()
	{
		//check if in range
		if(Vector3.Distance(transform.position, lookAtTarget.position) > range)
			{
    			return false;
			}

				return true;

	}

}

The way you are choosing which enemy to attack doesn’t care about the range limits of the tower. It will most likely always choose the same enemy, even if it is too far away.

Where you have
if (!lookAtTarget) { lookAtTarget = GameObject.FindWithTag("enemy").transform;
you should really consider changing it to find all the enemies and checking their distance in order to choose a target.

The second problem is that when an enemy moves out of range, your tower still considers them a target and never sets lookAtTarget back to null.

My own approach to this would be to create a co-routine which runs every second or so, and scans all the enemies ranges until it finds one it can reach and attacks that.

You could also use trigger-colliders to notice when enemies enter or leave range, and keep a list of suitable enemies for when your current target is destroyed or moves out of range.