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


C++ COperator::GetHitPoint方法代码示例

本文整理汇总了C++中COperator::GetHitPoint方法的典型用法代码示例。如果您正苦于以下问题:C++ COperator::GetHitPoint方法的具体用法?C++ COperator::GetHitPoint怎么用?C++ COperator::GetHitPoint使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在COperator的用法示例。


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

示例1: OnEvent

	void CToolMainPlayer::OnEvent(const CMsg& msg)
	{
		COperator * pOperator = CMapEditApp::GetInst()->GetOperator();
		CTerrainMesh * pTerrainMesh = CMapEditApp::GetInst()->GetEditingMesh();

		switch ( msg.msgSource )
		{
		case MGS_MOUSEMSG:
			{
				if( msg.msgType.key_type == MGT_MOUSE_LBNDOWN )
				{
					if ( m_ani != "" && m_ani != "run01" )
					{
						if( !m_pMainPlayer->SetNextAnimation("run01",FramePair(0,-1),true,200,1.0f) )
						{
							if( m_pMainPlayer->SetNextAnimation("run01_y",FramePair(0,-1),true,200,1.0f) )
								m_ani = "run01_y";
						}
						else
							m_ani = "run01";
					}
					else
					{
						m_pMainPlayer->SetNextAnimation("stand01",FramePair(0,-1),true,200,1.0f) ;
					}

					if (  pTerrainMesh->IsValid(pOperator->GetGridIndexHot()) )
					{
						m_bStop = false;

						m_vEnd = pOperator->GetHitPoint();

						//实时更新区域值
						CSceneRegionMgr::GetInst()->CalcRegionLightByRegionDistance(m_vEnd);

						m_vStart = m_vPos;

						m_fRoad = (m_vEnd-m_vStart).Mag();

						m_vDir = m_vEnd - m_vPos;
						m_vDir.y = 0.0f;

						m_vDir.normalize();

						m_mat._11 = m_vDir.z;
						m_mat._13 = -m_vDir.x;

						m_mat._31 = m_vDir.x;
						m_mat._33 = m_vDir.z;
					}
				}
			}
			break;
		}
	}
开发者ID:LaoZhongGu,项目名称:RushGame,代码行数:55,代码来源:ToolMainPlayer.cpp

示例2: OnEvent

	void CAnimCamera::OnEvent(InputEvent & event)
	{
		COperator *pOperator = NULL;
		pOperator = CMapEditApp::GetInst()->GetOperator();
		if ( pOperator == NULL || !m_bActive )
		{
			return;
		}

		CVector3f vecVector;
		CVector3f hitpoint = pOperator->GetHitPoint();
		switch ( event.eType )
		{
		case EIET_KB_KEYDOWN :
			{
				// handle keyboard
				if ( m_bMovable )
				{
					// left
					if ( event.dwData == DIK_A )
					{
						vecVector	= -m_pCamEx->getRIGHT();
						vecVector.y = 0;
						vecVector.normalize();
						vecVector   *= MOVE_SPEED_RATIO;
						MoveRTS(vecVector) ;
						hitpoint.x	+= vecVector.x;
						hitpoint.z	+= vecVector.z;
						pOperator->SetHitPoint(hitpoint);
						m_bResetVS  = true;
					}

					// right
					if ( event.dwData == DIK_D )
					{
						vecVector	= m_pCamEx->getRIGHT();
						vecVector.y = 0;
						vecVector.normalize();
						vecVector   *= MOVE_SPEED_RATIO;
						MoveRTS(vecVector) ;
						hitpoint.x	+= vecVector.x;
						hitpoint.z	+= vecVector.z;
						pOperator->SetHitPoint(hitpoint);
						m_bResetVS  = true;
					}

					// up
					if ( event.dwData == DIK_W )
					{
						vecVector	= m_pCamEx->getDIRECTION();
						vecVector.y	= 0;
						vecVector.normalize();
						vecVector	*= MOVE_SPEED_RATIO;
						MoveRTS(vecVector);
						hitpoint.x	+= vecVector.x;
						hitpoint.z	+= vecVector.z;
						pOperator->SetHitPoint(hitpoint);
						m_bResetVS  = true;
					}

					// down
					if ( event.dwData == DIK_S )
					{
						vecVector	= -m_pCamEx->getDIRECTION();
						vecVector.y	= 0;
						vecVector.normalize();
						vecVector	*= MOVE_SPEED_RATIO;
						MoveRTS(vecVector);
						hitpoint.x	+= vecVector.x;
						hitpoint.z	+= vecVector.z;
						pOperator->SetHitPoint(hitpoint);
						m_bResetVS = true;
					}


					// up another type
					if ( event.dwData == DIK_Q )
					{
						vecVector	= m_pCamEx->getDIRECTION();
						vecVector   *= MOVE_SPEED_RATIO;
						MoveRTS(vecVector);
						hitpoint.x	+= m_pCamEx->getDIRECTION().x;
						hitpoint.y	+= m_pCamEx->getDIRECTION().y;
						pOperator->SetHitPoint(hitpoint);
						m_bResetVS = true;
						CMapEditApp::GetInst()->GetOperator()->SetGPushed(false);
					}

					// down another type
					if ( event.dwData == DIK_E )
					{
						vecVector	= -m_pCamEx->getDIRECTION();
						vecVector   *= MOVE_SPEED_RATIO;
						MoveRTS(vecVector);
						hitpoint.x	-= m_pCamEx->getDIRECTION().x;
						hitpoint.y	-= m_pCamEx->getDIRECTION().y;
						pOperator->SetHitPoint(hitpoint);
						m_bResetVS = true;
						CMapEditApp::GetInst()->GetOperator()->SetGPushed(false);
					}
//.........这里部分代码省略.........
开发者ID:LaoZhongGu,项目名称:RushGame,代码行数:101,代码来源:AnimCamera.cpp


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