// Author : Chris Tolley
// Date   : 7/21/2004
// Plant.h contains the class declaration for a class of plants to use
// in the survival game

#if !defined(AFX_PLANT_H__B98009A4_40D0_49A2_876F_127CDE50B2F3__INCLUDED_)
#define AFX_PLANT_H__B98009A4_40D0_49A2_876F_127CDE50B2F3__INCLUDED_

#if _MSC_VER > 1000
#pragma once
#endif // _MSC_VER > 1000

// Forward class declaration
class GLUquadric;
class quadTreeTerrain;
class SurvivalEngine;
class quadTreeTerrain;

#include <string>
#include <vector>
using std::string;
using std::vector;

#include "texture.h"
#include "Object.h"

class Plant : public Object
{
public:
	// Constructor
	Plant( const float x, const float y, const float z );

	// Destructor
	~Plant();

	// Returns the type of object.  Overloaded from Object
	inline string GetType() { return "plant"; };

	// Renders the plant to the screen.  Overloaded from object
	void Render();

	// Updates the plant.  Overloaded from object
	void Update( float elapsedSec );

	// Returns true if this Object is inside the sphere.  Derived from Object
	bool InSphere( float x, float z, float radius );

	// Returns true if it is time for this object to be removed
	bool TimeToDie() { return m_fAge <= 0; };

	// Returns the amount of food available from this plant
	int GetFoodUnits();

	// Sets the growth rate
	inline void SetGrowthRate( float rate )
	{ if( rate >= 0 && rate <= 1 ) m_fGrowthRate = rate; };

	// Returns the growth rate
	inline float GetGrowthRate() { return m_fGrowthRate; };

	// Initializes the display list used for all plants.
	static void InitList( const char* PlantModel, SurvivalEngine* engine );

	// Cleans up the display list
	static void DltList();
private:
	// The age of the plant
	float m_fAge;

	// The size of the plant
	float m_fSize;

	// The growth rate of this plant.  Must be between 1 and 0
	float m_fGrowthRate;

	// Used in calculating when to produce a seed
	float m_fSeedTime;

	// Used in updating the plant.  The amount of time is multiplied by this
	// number so that we the plant is dying, a negative number will be added
	float m_fDirection;

	// Static variables used by all plants
	// The index to the display list used to draw the sphere
	static unsigned int m_suiList;

	// The texture to use when drawing this plant
	static texture m_Texture;

	// The engine that is running game.  Used for creating and removing plants
	static SurvivalEngine* m_pEngine;
};// End class Plant

#endif // !defined(AFX_PLANT_H__B98009A4_40D0_49A2_876F_127CDE50B2F3__INCLUDED_)
