⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 monstermanager.h

📁 吃豆子游戏源码
💻 H
字号:
/**
 *	File	:	MonsterManager.h
 *  Author	:	Kevin Lynx
 *	Date	:	2007/7/31
 */
#ifndef	_MONSTER_MANAGER_H_
#define _MONSTER_MANAGER_H_

#include <vector>
#include <list>
#include "Singleton.h"

using std::vector;
using std::list;

class Monster;
class Player;

/**
 * MonsterManager class, 
 *
 * manage all the monsters in the game
 */
class	MonsterManager : public Singleton<MonsterManager>
{
public:
	/**
	 * Dead monster list, the manager will create
	 * monsters by the list
	 *
	 */
	typedef vector<int>	tDeadMonsters;

	/**
	 * alive monsters list
	 *
	 */
	typedef list<Monster*> tAliveMonsters;

public:
	/** 
	 * Constructor
	 *
	 */
	MonsterManager( IrrlichtDevice *device );

	/**
	 * Destructor
	 *
	 */
	~MonsterManager();

	/**
	 * init 
	 *
	 * this function will be called when load a level,
	 * and it will create all the monsters in this level
	 *
	 * @param file the file pointer that can be used to read monster's
	 *             data to create, donot close fp, because it is maintained by
	 *             World manager
	 */
	bool	init( FILE *fp );

	/**
	 * release
	 *
	 * delete all the alive monsters
	 */
	void	release();

	/** 
	 * createMonster
	 *
	 * create one monster
	 *
	 */
	void	createMonster( int type, const vector3df &pos );

	/**
	 * checkPlayer
	 *
	 * check with the player, can this monster eat the player ? i hope so .:D
	 */
	bool	checkPlayer( Player *player );

	/**
	 * recordDead
	 *
	 * record the dead monster, and the manager will create that monster later
	 *
	 * @param type the monster type
	 */
	void	recordDead( int type );

	/**
	 * update
	 *
	 * udpate all the monsters and some logic in the manager
	 *
	 */
	void	update( float dt );

	/**
	 * killAll
	 *
	 * when the level is clear, kill all the monsters , :D
	 */
	void	killAll();

private:
	IrrlichtDevice	*mDevice;

	tDeadMonsters   mDeadMonsters;
	tAliveMonsters  mAliveMonsters;
};

#endif // end _MONSTER_MANAGER_H_

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -