// This file is part of ThriceBall.
//
// Author: Kai Hillenbrand (AnTeevY)
// © Copyright, 2009 by Kai Hillenbrand, http://www.anteevy.de

// --------------------------------------------------

#pragma once
#ifndef DRAINER_H
#define DRAINER_H

// intern includes
#include "../level.h"

// --------------------------------------------------

class CRenderer;
class CLevel;
class CPlayer;

class CDrainer : public NxOgre::Callback
{
public:
	CDrainer(CRenderer *renderer, CLevel *level, NxOgre::Scene *scene, OGRE3DRenderSystem *rendersys);
	
	// create the drain field by giving it its location and drain amount
	void create(float x, float y, float z, float amount, float sizeX, float sizeZ);	

private:
	// setup the volume and its trigger
	void setupVolume();

	// the event when the ball rolls on top of the drain field
	void onVolumeEvent(NxOgre::Volume* volume, NxOgre::Shape* volumeShape, NxOgre::RigidBody* rigidBody, 
		NxOgre::Shape* rigidBodyShape, unsigned int collisionEvent);

	// general variables		
	float	m_fXPos,	// the drainer's position
			m_fYPos, 
			m_fZPos,
			m_fAmount,	// power of draining in time
			m_fSizeX,	// size of the drainer
			m_fSizeZ;	

	// pointers to instances
	CRenderer *m_pRenderer;
	CPlayer *m_pPlayer;
	CLevel *m_pLevel;

	// Ogre and NxOgre pointers
	NxOgre::Scene *m_pScene;
	SceneManager *m_pSceneMgr;
	OGRE3DRenderSystem *m_pRenderSystem;
	NxOgre::Volume *m_pVolume;
};

#endif