当前位置: 首页>>代码示例>>C++>>正文


C++ Game函数代码示例

本文整理汇总了C++中Game函数的典型用法代码示例。如果您正苦于以下问题:C++ Game函数的具体用法?C++ Game怎么用?C++ Game使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。


在下文中一共展示了Game函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。

示例1: Game

/************************************************************************
*  游戏剧情的章节转换
************************************************************************/
void Controller::ChangeChapter(int nChapterID)
{
	if (nChapterID != CHAPTER_1 && nChapterID != CHAPTER_2 && nChapterID != CHAPTER_3 && nChapterID != CHAPTER_4)
	{
		return;
	}

	vector<Player*> playerList = Game()->GetPlayerManager()->GetPlayerList();
	if (m_nCurrentChapter != CHAPTER_0)
	{
		for (int i = 0; i < playerList.size(); ++i)
		{
			playerList[i]->Action(CodeMsg::code_player_static,right_direction);
		}
	}
	// 设置当前章节的ID
	m_nCurrentChapter = nChapterID;

	

	// 先让玩家停止
	

	// 暂停游戏
	SuspendGame();

	// 移除地图上所有的怪物 
	Game()->GetMonsterManager()->RemoveAllMonster();					

	// 移除地图上所有的装备
	Game()->GetEquipmentManager()->RemoveAllEquipment();			

	// 当前选中的怪物置为空
	m_pCurrentSelectedMonster = 0;														

	// 新建一个boss(每个章节的Boss都不一样)
	m_pBoss = Game()->GetMonsterManager()->CreateBoss();				

	// 场景转换
	Game()->GetSceneManager()->ChangeScene(nChapterID);				

	// 继续游戏
	ContinueGame();
}
开发者ID:mobinsheng,项目名称:RPG_01,代码行数:47,代码来源:Controller.cpp

示例2: GameServer

bool CGameWindow::KeyPress(int c)
{
	if (BaseClass::KeyPress(c))
		return true;

	if (GameServer() && GameServer()->GetCamera())
		GameServer()->GetCamera()->KeyDown(c);

	if (Game())
	{
		for (size_t i = 0; i < Game()->GetNumLocalPlayers(); i++)
		{
			CPlayer* pPlayer = Game()->GetLocalPlayer(i);
			pPlayer->KeyPress(c);
		}
	}

	return false;
}
开发者ID:dfk789,项目名称:CodenameInfinite,代码行数:19,代码来源:gamewindow.cpp

示例3: Game

void CGameServer::SetClientNickname(int iClient, const tstring& sNickname)
{
	if (iClient == GetClientIndex() && Game()->GetNumLocalPlayers())
	{
		Game()->GetLocalPlayer(0)->SetPlayerName(sNickname);
		return;
	}

	for (size_t i = 0; i < Game()->GetNumPlayers(); i++)
	{
		if (Game()->GetPlayer(i)->GetClient() == iClient)
		{
			Game()->GetPlayer(i)->SetPlayerName(sNickname);
			return;
		}
	}

	TMsg(sprintf(tstring("Can't find client %d to give nickname %s.\n"), iClient, sNickname.c_str()));
}
开发者ID:BSVino,项目名称:LunarWorkshop,代码行数:19,代码来源:gameserver.cpp

示例4: SetLoading

void CGameServer::RestartLevel()
{
	SetLoading(false);
	AllowPrecaches();
	DestroyAllEntities(tvector<tstring>(), true);
	m_bRestartLevel = true;
	Game()->SetupGame(CVar::GetCVarValue("game_mode"));
	m_bRestartLevel = false;
	SetLoading(false);
}
开发者ID:BSVino,项目名称:LunarWorkshop,代码行数:10,代码来源:gameserver.cpp

示例5: GetRenderer

void CGame::Load()
{
	m_iMonsterTexture = GetRenderer()->LoadTextureIntoGL("monster.png");
	m_iCrateTexture = GetRenderer()->LoadTextureIntoGL("crate.png");
	m_iNormalTexture = GetRenderer()->LoadTextureIntoGL("normal.png");

	GraphReset();

	m_projectile_initial_time = Game()->GetTime();
	m_projectile_initial_position = Vector(2, 1, 2);
	m_projectile_initial_velocity = Vector(-1, 3, -1) * 5;
	m_projectile_gravity = Vector(0, -5, 0);
	m_projectile_break_time = Game()->GetTime() + PredictProjectileMaximumHeightTime(m_projectile_initial_velocity, m_projectile_gravity);
	m_projectile_number = 1;

	// Fire the first one
	m_projectile_position[0] = m_projectile_initial_position;
	m_projectile_velocity[0] = m_projectile_initial_velocity;
}
开发者ID:Lynear24,项目名称:MathForGameDevelopers,代码行数:19,代码来源:game.cpp

示例6: SKGraph

Game RoxdokuGame::createGame(int difficulty, int symmetry) {
	if(!m_graph) {
		m_graph = new SKGraph(m_order, TypeRoxdoku);
		m_graph->initRoxdoku();
	}

	Puzzle* puzzle = new Puzzle(m_graph, true);
	puzzle->init(difficulty, symmetry);

	return Game(puzzle);
}
开发者ID:KDE,项目名称:ksudoku,代码行数:11,代码来源:gamevariants.cpp

示例7: GameServer

bool CGameServer::LoadFromFile(const tchar* pFileName)
{
	if (!GameServer())
		return false;

	GameServer()->Initialize();

	// Erase all existing entites. We're going to load in new ones!
	GameServer()->DestroyAllEntities();

	std::ifstream i;
	i.open(pFileName, std::ios_base::binary|std::ios_base::in);

	char szTag[8];
	i.read(szTag, 8);
	if (strncmp(szTag, "GameSave", 8) != 0)
		return false;

	CGameServer* pGameServer = GameServer();

	size_t iLoadCRC;
	i.read((char*)&iLoadCRC, sizeof(iLoadCRC));

	if (iLoadCRC != pGameServer->m_iSaveCRC)
		return false;

	i.read((char*)&pGameServer->m_flGameTime, sizeof(pGameServer->m_flGameTime));

	size_t iEntities;
	i.read((char*)&iEntities, sizeof(iEntities));

	for (size_t j = 0; j < iEntities; j++)
	{
		if (!CBaseEntity::UnserializeEntity(i))
			return false;
	}

	for (size_t i = 0; i < GameServer()->GetMaxEntities(); i++)
	{
		if (!CBaseEntity::GetEntity(i))
			continue;

		CBaseEntity::GetEntity(i)->ClientEnterGame();
	}

	Game()->EnterGame();

	if (GameServer()->GetWorkListener())
		GameServer()->GetWorkListener()->SetAction("Encountering resistance", 0);

	GameServer()->SetLoading(false);

	return true;
}
开发者ID:BSVino,项目名称:LunarWorkshop,代码行数:54,代码来源:gameserver.cpp

示例8: getGameInfo

void COverlappedWindow::startNewGame() {
	getGameInfo().isFirstNextStep = true;

	setWindowSize();

	game = Game(getGameInfo().widthGridNumber, getGameInfo().heightGridNumber);
	isGameStarted = true;
	isDoneFirstStep = false;

	::InvalidateRect(handle, 0, 0);
}
开发者ID:IvanShafran,项目名称:winapi-game-points,代码行数:11,代码来源:COverlappedWindow.cpp

示例9: DeleteHelperItems

void CUIMpTradeWnd::OnBtnOkClicked(CUIWindow* w, void* d)
{
	DeleteHelperItems();
	CheckDragItemToDestroy				();
	StorePreset							(_preset_idx_last, true, false, false);
	HideDialog							();
	game_cl_mp* clgame					= smart_cast<game_cl_mp*>(&(Game()));
	VERIFY(clgame);
	clgame->OnBuyMenu_Ok					();
//.	StorePreset							(_preset_idx_last, true, true);
}
开发者ID:AntonioModer,项目名称:xray-16,代码行数:11,代码来源:UIMpTradeWnd.cpp

示例10: CanAccelerate

bool CActor::CanSprint			()
{
	bool can_Sprint = CanAccelerate() && !conditions().IsCantSprint() &&
						Game().PlayerCanSprint(this)
						&& CanRun()
						&& !(mstate_real&mcLStrafe || mstate_real&mcRStrafe)
						&& InventoryAllowSprint()
						;

	return can_Sprint;
}
开发者ID:NeoAnomaly,项目名称:xray,代码行数:11,代码来源:Actor_Movement.cpp

示例11:

int game_cl_Deathmatch::GetPlayersPlace			(game_PlayerState* ps)
{
	if (!ps) return -1;
	game_cl_GameState::PLAYERS_MAP_IT I=Game().players.begin();
	game_cl_GameState::PLAYERS_MAP_IT E=Game().players.end();

	// create temporary map (sort by kills)
	xr_vector<game_PlayerState*>	Players;
	for (;I!=E;++I)		Players.push_back(I->second);
	std::sort			(Players.begin(),Players.end(),DM_Compare_Players);

	int Place = 1;
	for (u32 i=0; i<Players.size(); i++)
	{
		if (Players[i] == ps)
			return Place;
		Place++;
	};
	return -1;
}
开发者ID:BeaconDev,项目名称:xray-16,代码行数:20,代码来源:game_cl_deathmatch.cpp

示例12: Game

s32 UITeamState::GetSummaryFrags() const
{
	typedef game_cl_GameState::PLAYERS_MAP::const_iterator PlCIter;
	game_cl_GameState::PLAYERS_MAP & playersMap = Game().players;
	
	s32		sum = 0;
	PlCIter	eiter = playersMap.end();

	for (PlCIter i = playersMap.begin(); i != eiter; ++i)
	{
		game_PlayerState*	ps = i->second;
		if (!ps)
			continue;
		game_cl_mp* tempGame = smart_cast<game_cl_mp*>(&Game());
		R_ASSERT(tempGame);
		if (static_cast<ETeam>(tempGame->ModifyTeam(ps->team)) == myTeam)
			sum = sum + ps->m_iRivalKills;
	}
	return sum;
}
开发者ID:AntonioModer,项目名称:xray-16,代码行数:20,代码来源:UITeamState.cpp

示例13: Game

/*
===============
idCommonLocal::NetReceiveUsercmds
===============
*/
void idCommonLocal::NetReceiveUsercmds( int peer, idBitMsg& msg )
{
	int clientNum = Game()->MapPeerToClient( peer );
	if( clientNum == -1 )
	{
		idLib::Warning( "NetReceiveUsercmds: Could not find client for peer %d", peer );
		return;
	}
	
	NetReadUsercmds( clientNum, msg );
}
开发者ID:BielBdeLuna,项目名称:RBDoom3BFG-mirrored,代码行数:16,代码来源:Common_network.cpp

示例14: WinMain

int CALLBACK WinMain( HINSTANCE /*hInstance*/, HINSTANCE /*hPrevInstance*/, LPSTR /*lpCmdLine*/, int /*nCmdShow*/ )
{
	#ifndef NDEBUG
		int flag = _CrtSetDbgFlag( _CRTDBG_REPORT_FLAG ); /* Get current flag */
		flag ^= _CRTDBG_LEAK_CHECK_DF; /* Turn on leak-checking bit */
		_CrtSetDbgFlag( flag ); /* Set flag to the new value */
	#endif

    Game();

	return 0;
}
开发者ID:prokura,项目名称:bahamut-engine,代码行数:12,代码来源:main.cpp

示例15: ShowStatus

void ShowStatus(class CCommand* pCommand, tvector<tstring>& asTokens, const tstring& sCommand)
{
	TMsg(tstring("Level: ") + CVar::GetCVarValue("game_level") + "\n");
	TMsg(sprintf(tstring("Clients: %d Entities: %d/%d\n"), GameNetwork()->GetClientsConnected(), CBaseEntity::GetNumEntities(), GameServer()->GetMaxEntities()));

	for (size_t i = 0; i < Game()->GetNumPlayers(); i++)
	{
		const CPlayer* pPlayer = Game()->GetPlayer(i);
		if (!pPlayer)
			continue;

		if (pPlayer->GetClient() < 0)
			TMsg("Local: ");
		else
			TMsg(sprintf(tstring("%d: "), pPlayer->GetClient()));

		TMsg(pPlayer->GetPlayerName());

		TMsg("\n");
	}
}
开发者ID:BSVino,项目名称:LunarWorkshop,代码行数:21,代码来源:gameserver.cpp


注:本文中的Game函数示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。