package meyermike.script.step 
{
    import meyermike.GameObjectHolder;
    import meyermike.Layers;
    import meyermike.script.Step;
    
    /**
     * Step to spawn an enemy
     * @author Mike Meyer
     */
    public class SpawnGameObject extends Step
    {
        private var mEnemyType:Class;
        private var mHowMany:Number;
        private var mLayer:GameObjectHolder;
        
        public function SpawnGameObject(layer:GameObjectHolder, enemyType:Class, howMany:Number = 1)
        {
            mHowMany = howMany;
            mEnemyType = enemyType;
            mLayer = layer;
        }
        
        public override function Execute():Boolean
        {
            for (var i:Number = 0; i < mHowMany; ++i)
            {
                mLayer.Add(mEnemyType);
            }
            
            return true;
        }
    }
    
}