//	PickupGenerator.cpp - Simple class to generate Pickups.
//  ----------------------------------------------------------------------------
//	This file is part of 'GameTemplate', template code for a game.
//	Copyright (C) 2011  Niall Moody
//	
//	This program is free software: you can redistribute it and/or modify
//	it under the terms of the GNU General Public License as published by
//	the Free Software Foundation, either version 3 of the License, or
//	(at your option) any later version.
//
//	This program is distributed in the hope that it will be useful,
//	but WITHOUT ANY WARRANTY; without even the implied warranty of
//	MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
//	GNU General Public License for more details.
//
//	You should have received a copy of the GNU General Public License
//	along with this program.  If not, see <http://www.gnu.org/licenses/>.
//	----------------------------------------------------------------------------

#include "PickupGenerator.h"
#include "DebugHeaders.h"
#include "Random.h"

#include "../pickups/Pickup2xSpeed.h"
#include "../pickups/PickupHalfSpeed.h"
#include "../pickups/PickupFreeze.h"
#include "../pickups/PickupSticky.h"
#include "../pickups/PickupReverse.h"
#include "../pickups/PickupDeflectUp.h"
#include "../pickups/PickupDeflectDown.h"
#include "../pickups/PickupPendulum.h"
#include "../pickups/PickupSplit.h"
#include "../pickups/PickupAutopilot.h"
#include "../pickups/PickupRandom.h"

//------------------------------------------------------------------------------
PickupGenerator::PickupGenerator()
{

}

//------------------------------------------------------------------------------
PickupGenerator::~PickupGenerator()
{

}

//------------------------------------------------------------------------------
PickupPtr PickupGenerator::generate()
{
	int pickup;
	PickupPtr retval;
	const int NumPickupTypes = 11;

	pickup = (int)(Random::getGlobal().getRandomFloat() * ((float)NumPickupTypes - 0.001f));

	switch(pickup)
	{
		case 0:
			retval = PickupPtr(NiallNew PickupRandom());
			break;
		case 1:
			retval = PickupPtr(NiallNew PickupHalfSpeed());
			break;
		case 2:
			retval = PickupPtr(NiallNew PickupFreeze());
			break;
		case 3:
			retval = PickupPtr(NiallNew PickupReverse());
			break;
		case 4:
			retval = PickupPtr(NiallNew PickupSticky());
			break;
		case 5:
			retval = PickupPtr(NiallNew PickupDeflectDown());
			break;
		case 6:
			retval = PickupPtr(NiallNew PickupDeflectUp());
			break;
		case 7:
			retval = PickupPtr(NiallNew PickupPendulum());
			break;
		case 8:
			retval = PickupPtr(NiallNew PickupSplit());
			break;
		case 9:
			retval = PickupPtr(NiallNew PickupAutopilot());
			break;
		case 10:
			retval = PickupPtr(NiallNew PickupRandom());
			break;
		/*default:
			retval = PickupPtr(NiallNew PickupSplit());*/
	}

	return retval;
}
