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

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

#pragma once
#ifndef PLATFORM_H
#define PLATFORM_H

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

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

class CRenderer;
class CLevel;
class CPlayer;

class CPlatform
{
public:
	CPlatform(CRenderer *renderer, CLevel *level, NxOgre::Scene *scene, OGRE3DRenderSystem *rendersys);
	
	// create the platform by giving it its starting point (x1|y1|z1), its ending point (x2|y2|z2),
	// its speed and its scale (sX, sY, sZ)
	void create(float x1, float y1, float z1, float x2, float y2, float z2, float speed, float wait,
							float sX, float sY, float sZ);
	void move();	// move the platform

private:
	// general variables
	float	m_fXPos1,  m_fXPos2,	// position
			m_fYPos1,  m_fYPos2,
			m_fZPos1,  m_fZPos2,
			m_fXScale, m_fYScale,	// size/scale
			m_fZScale,
			m_fSpeed;				// move speed

	bool m_bForward;				// move direction (forward/backward)
	bool m_bWait;					// wait for a few secs before changing move direction
	float m_fWaitCounter;			// counts to zero while waiting
	float m_fWaitCounterMax;		// maximum wait time
	float m_fDistance;				// distance between the two points
	NxOgre::Vec3 m_vDirection;		// forward move direction vector	

	// 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;
	OGRE3DKinematicBody* m_pPlatformBody;
};

#endif