var damageActive:boolean=true;
var explosionPrefab:GameObject;
var hitPoint:int=10;
var destroyScore:int=100; 
var  boss:boolean=false;


function ApplyDamage(damage:int){

       if (hitPoint <= 0)
		return;

        if(damageActive==true){
        
		
		hitPoint  -= damage;
	
		}
        if(hitPoint <= 0) {
		GameController.playerScore   += destroyScore;
		Kill();
        }
}

function Kill (){

     if(explosionPrefab){
	 
	   if(boss){ GameController.stageClearFlag=true;}
	

       Instantiate(explosionPrefab, transform.position, transform.rotation);
        
       Destroy(gameObject);
      }  

}