Artificial Intelligence
Public Member Functions | Private Member Functions | Private Attributes

GamePipe::GridWorld Class Reference

represent the world by grid More...

#include <GridWorld.h>

List of all members.

Public Member Functions

 GridWorld ()
 GridWorld (int, int)
 constructor for grid world
 GridWorld (int, int, float, float)
 constructor for grid world
 ~GridWorld ()
bool setCost (int, int, float)
 set the cost of grid in position(x,y)
float getCost (int, int)
 get the cost of grid in position(x,y)
bool setCost (Ogre::Vector3 pos, float cost)
 set the cost of grid in position(x,y)
float getCost (Ogre::Vector3 pos)
 get the cost of grid in position(x,y)
bool setWidth (int newWidth)
 set the width of the grid
bool setHeight (int newHight)
 set the height of the grids
int getHeight ()
 get the height of the grids
int getWidth ()
 get the width of the grid
bool setWidthPerGrid (float newWidth)
 set the width per grid
float getWidthPerGrid ()
 get the width per grid
bool setHeightPerGrid (float newHeight)
 set the height per grid
float getHeightPerGrid ()
 get the height per grid
void setInitialPosition (Ogre::Vector3 position)
Ogre::Vector3 getInitialPosition ()
void setDebug (bool)
void initializeDebug (Ogre::SceneManager *)
void updateDebug (float)
void drawPath (Ogre::SceneManager *, std::list< GraphNode * >)
void colorPath (Ogre::ColourValue)
void removePath ()

Private Member Functions

Ogre::Vector2 changePositionToIndex (Ogre::Vector3 pos)
 change the position in the game world coordinate to index in grids world

Private Attributes

int m_width
 store the value of width and height of the grids, the value is the number of grids
int m_height
Ogre::Vector3 start_position
float m_widthPerGrid
float m_heightPerGrid
std::list< Ogre::SceneNode * > * m_pathNodes
std::list< DebugObject * > * m_pathDebugObjects
Ogre::SceneManager * m_sceneManager
float ** grid
 pointer storing the grid
bool m_debug
std::list< DebugObject * > * m_debugObjects

Detailed Description

represent the world by grid

<author>Lin Tian tina.tian1987@gmail.com</author>


Constructor & Destructor Documentation

GamePipe::GridWorld::GridWorld ( )
GamePipe::GridWorld::GridWorld ( int  width,
int  height 
)

constructor for grid world

Parameters:
widthwidth of the grids world
heightheight of the grids world
GamePipe::GridWorld::GridWorld ( int  width,
int  height,
float  widthPerGrid,
float  heightPerGrid 
)

constructor for grid world

Parameters:
widthwidth of the grids world
heightheight of the grids world
widthPerGridwidth per grid
heightPerGridheight per grid
GamePipe::GridWorld::~GridWorld ( )

Member Function Documentation

Ogre::Vector2 GamePipe::GridWorld::changePositionToIndex ( Ogre::Vector3  pos) [private]

change the position in the game world coordinate to index in grids world

Parameters:
posthe position in game world coordinate
Returns:
return a vector2 containing the x,y index in grids world
void GamePipe::GridWorld::colorPath ( Ogre::ColourValue  color)
void GamePipe::GridWorld::drawPath ( Ogre::SceneManager *  manager,
std::list< GraphNode * >  nodes 
)
float GamePipe::GridWorld::getCost ( int  X,
int  Y 
)

get the cost of grid in position(x,y)

Parameters:
Xthe index of the grid in horizontal
Ythe index of the grid in vertical
Returns:
the value of the cost
float GamePipe::GridWorld::getCost ( Ogre::Vector3  pos)

get the cost of grid in position(x,y)

Parameters:
posthe position in game world coordinate
Returns:
the value of the cost
int GamePipe::GridWorld::getHeight ( ) [inline]

get the height of the grids

float GamePipe::GridWorld::getHeightPerGrid ( ) [inline]

get the height per grid

Ogre::Vector3 GamePipe::GridWorld::getInitialPosition ( ) [inline]
int GamePipe::GridWorld::getWidth ( ) [inline]

get the width of the grid

float GamePipe::GridWorld::getWidthPerGrid ( ) [inline]

get the width per grid

void GamePipe::GridWorld::initializeDebug ( Ogre::SceneManager *  manager)
void GamePipe::GridWorld::removePath ( )
bool GamePipe::GridWorld::setCost ( int  X,
int  Y,
float  cost 
)

set the cost of grid in position(x,y)

Parameters:
Xthe index of the grid in horizontal
Ythe index of the grid in vertical
costthe value of the cost
Returns:
if set the cost successfully then return true
bool GamePipe::GridWorld::setCost ( Ogre::Vector3  pos,
float  cost 
)

set the cost of grid in position(x,y)

Parameters:
posthe position in game world coordinate
costthe value of the cost
Returns:
if set the cost successfully then return true
void GamePipe::GridWorld::setDebug ( bool  debug)
bool GamePipe::GridWorld::setHeight ( int  newHight) [inline]

set the height of the grids

bool GamePipe::GridWorld::setHeightPerGrid ( float  newHeight) [inline]

set the height per grid

void GamePipe::GridWorld::setInitialPosition ( Ogre::Vector3  position) [inline]
bool GamePipe::GridWorld::setWidth ( int  newWidth) [inline]

set the width of the grid

bool GamePipe::GridWorld::setWidthPerGrid ( float  newWidth) [inline]

set the width per grid

void GamePipe::GridWorld::updateDebug ( float  deltaTime)

Member Data Documentation

float** GamePipe::GridWorld::grid [private]

pointer storing the grid

std::list<Ogre::SceneNode*>* GamePipe::GridWorld::m_pathNodes [private]
Ogre::SceneManager* GamePipe::GridWorld::m_sceneManager [private]

store the value of width and height of the grids, the value is the number of grids

Ogre::Vector3 GamePipe::GridWorld::start_position [private]

The documentation for this class was generated from the following files:
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Defines