function ArcherSpawner( x , z , player )
{
    this.building = new Building( x , z , player , ARCHER_SPAWNER );
    this.lasttime = Date.now();

    this.entityDamageUpgrade = 0;
    this.entityHPUpgrade = 0;
    this.entitySpeedUpgrade = 0;
}



ArcherSpawner.prototype.update = function()
{
    this.building.update();
    if ( this.building.isDead() ) return;

    if ( Date.now() > this.lasttime+5000 )
    {
        var enemyPlayer = aiPlayer;
        if ( this.building.player == aiPlayer ) enemyPlayer = player;

        var entity = new Entity( this.building.worldPosition.x , this.building.worldPosition.y , this.building.player , enemyPlayer );
        entity.modelFilename = "models/archer.glb";
        entity.type = ARCHER;
        entity.attackRange = 0.75;

        entity.setSpeed( 0.8+this.entitySpeedUpgrade );

        entity.damage = 3+this.entityDamageUpgrade;
        entity.coreDamage = 1+this.entityDamageUpgrade;
        entity.buildingDamage = 1+this.entityDamageUpgrade;
        
        entity.setHP( 20+this.entityHPUpgrade );

        entity.spawn();
        entities.push( entity );
        this.lasttime = Date.now();
    }
}



ArcherSpawner.prototype.build = function( scene )
{
    var pthis = this;
    this.model = null;
    loadModel( "models/archer_camp.glb" , "spawner" , scene , function( model )
    {
        pthis.model = model;
        pthis.model.position.x = pthis.building.worldPosition.x;
        pthis.model.position.z = pthis.building.worldPosition.y;
        pthis.building.healthBar = new HealthBar( scene , pthis.model , 0.4 , 0.03 , -0.7 );
        for ( var i = 0 ; i < pthis.model._children.length ; ++i )
        {
            pthis.model._children[i].name = pthis.building.ID;
        }
    } );
}



ArcherSpawner.prototype.remove = function()
{
    this.building.b_modelRemoved = true;
    this.model.dispose();
}