本文整理汇总了C++中CObjectManager类的典型用法代码示例。如果您正苦于以下问题:C++ CObjectManager类的具体用法?C++ CObjectManager怎么用?C++ CObjectManager使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。
在下文中一共展示了CObjectManager类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: Execute
UINT GCSpecialObj_ActNowHandler::Execute( GCSpecialObj_ActNow* pPacket, Player* pPlayer )
{
//__ENTER_FUNCTION
if(CGameProcedure::GetActiveProcedure() == (CGameProcedure*)CGameProcedure::s_pProcMain)
{
CObjectManager* pObjectManager = CObjectManager::GetMe();
CObject* pObj = (CObject*)(pObjectManager->FindServerObject( (INT)pPacket->GetObjID() ));
if ( pObj == NULL )
return PACKET_EXE_CONTINUE;
const ObjID_List &listObjID = pPacket->GetTargetList();
SCommand_Object cmdTemp;
cmdTemp.m_wID = OC_SPECIAL_OBJ_TRIGGER;
cmdTemp.m_anParam[0] = pPacket->GetLogicCount();
cmdTemp.m_anParam[1] = listObjID.m_nCount;
cmdTemp.m_apParam[2] = (VOID*)(listObjID.m_aIDs);
pObj->PushCommand(&cmdTemp );
pObj->PushDebugString("GCSpecialObj_ActNowHandler");
pObj->SetMsgTime(CGameProcedure::s_pTimeSystem->GetTimeNow());
}
return PACKET_EXE_CONTINUE ;
//__LEAVE_FUNCTION
return PACKET_EXE_ERROR ;
}
示例2: Execute
uint GCNotifyTeamInfoHandler::Execute( GCNotifyTeamInfo* pPacket, Player* pPlayer )
{
//__ENTER_FUNCTION
if(CGameProcedure::GetActiveProcedure() == (CGameProcedure*)CGameProcedure::s_pProcMain)
{
CObjectManager* pObjectManager = CObjectManager::GetMe();
CObject* pObj = (CObject*)(pObjectManager->FindServerObject( (INT)pPacket->GetObjID() ));
if ( pObj == NULL )
return PACKET_EXE_CONTINUE;
SCommand_Object cmdTemp;
cmdTemp.m_wID = OC_UPDATE_TEAM_FLAG;
cmdTemp.m_abParam[0] = pPacket->GetHaveTeamFlag();
cmdTemp.m_abParam[1] = pPacket->GetTeamLeaderFlag();
cmdTemp.m_abParam[2] = pPacket->GetTeamFullFlag();
// cmdTemp.m_abParam[3] = pPacket->GetTeamFollowFlag();
pObj->PushCommand( &cmdTemp );
// CGameProcedure::s_pEventSystem->PushEvent( GE_NEW_DEBUGMESSAGE, "GCNotifyTeamInfo Received." );
}
return PACKET_EXE_CONTINUE ;
//__LEAVE_FUNCTION
return PACKET_EXE_ERROR ;
}
示例3: m_bUpdateGoalLinks
/**
* CAIManager::CAIManager
* @date Modified March 30, 2006
*/
CAIManager::CAIManager(void) : m_bUpdateGoalLinks(true), m_bSkipCurrentObjective(false)
{
// go to the object manager and get the players and create nodes for them
CObjectManager* poObjectManager = CObjectManager::getInstancePtr();
CObjectManager::ObjectList loPlayers;
poObjectManager->getObjects(OBJ_PLAYER, &loPlayers);
CObjectManager::ObjectList::iterator oPlayerIter = loPlayers.begin();
while (oPlayerIter != loPlayers.end())
{
CAINode* newNode = new CAINode;
newNode->setPosition(ACTOR_PTR(oPlayerIter)->getBV().centerPt);
newNode->setRadius(1.0f);
m_loGoals.push_back(newNode);
oPlayerIter++;
}
m_oLeaderTimer.setInterval(0.1f);
m_oObjectiveTimer.setInterval(0.15f);
m_poCurrentObjective = NULL;
m_poObjectiveEmitter = (CParticleEmitter*)CObjectManager::getInstance().createObject(OBJ_PARTICLE_EMITTER);
m_poObjectiveEmitter->setSystem((CParticleSystem*)CResourceManager::getInstance().loadResource(RES_PARTICLEEMITTER, "objective.xml"));
}
示例4: InitObject
void CGUIContainer::InitObject(const char * strObjectName, const char * alignment, int x, int y, int width, int height)
{
CObjectManager *pOm = &CSingleton<CObjectManager>::Instance();
if (!pOm->IsExist("default_CGUIContainer")) {
CGUIContainer::StaticInit();
}
pOm->CloneObject("default_CGUIContainer", this);
CGUIBase::InitObject(strObjectName, alignment, x, y, width, height);
//initialize scrollbars
string str;
str = GetName() + ".vscrollbar";
// Modified 2007.4.10 LiXizhi, alignment type is changed.
//m_VScroll->InitObject(str.c_str(),"_rt",-m_nSBWidth-m_nBorder,m_nBorder,m_nSBWidth,RectHeight(m_objResource->GetDrawingRects(0)));
m_VScroll->InitObject(str.c_str(), "_mr", m_nBorder, m_nBorder, m_nSBWidth, m_nBorder);
m_VScroll->m_parent = this;
m_VScroll->SetLinkedObject(this);
// m_VScroll->UpdateRects();
str = GetName() + ".hscrollbar";
//m_HScroll->InitObject(str.c_str(),"_lb",m_nBorder,-m_nSBWidth-m_nBorder,RectWidth(m_objResource->GetDrawingRects(0)),m_nSBWidth);
m_HScroll->InitObject(str.c_str(), "_mb", m_nBorder, m_nBorder, m_nBorder + m_nSBWidth, m_nSBWidth);
m_HScroll->m_parent = this;
m_HScroll->SetLinkedObject(this);
// m_HScroll->UpdateRects();
SetSize(width, height);
}
示例5: ObjectDestroy
void ObjectDestroy(RakNet::BitStream *bitStream, Packet *packet)
{
CObjectManager *pObjectManager = pNetowkManager->GetObjectManager();
EntityId objId=0;
bitStream->Read(objId);
pObjectManager->Delete(objId);
}
示例6: DebugLayout
void DebugLayout()
{
float y_offset = 100;
CPlayer* LocalPlayer;
if (NetworkManager)
{
LocalPlayer = NetworkManager->GetLocalPlayer();
Render::DrawText(20, y_offset, color_white, DT_LEFT, "R3DNetwork: %x", NetworkManager);
y_offset += 15;
}
CObjectManager* ObjectManager = CObjectManager::Get();
if (ObjectManager)
{
Render::DrawText(20, y_offset, color_white, DT_LEFT, "ObjectManager: %x", ObjectManager);
y_offset += 15;
//Finds LocalPlayer in the main menu (For the shooting range)
if (!LocalPlayer)
{
CGameObject* Object = ObjectManager->GetFirst();
for (CGameObject* Object = ObjectManager->GetFirst(); Object && Object->GetNext(); Object = Object->GetNext())
{
if (Object->GetObjectInfo()->m_id == OBJECT_AI_PLAYER)
{
LocalPlayer = (CPlayer*)Object;
break;
}
}
}
}
if (LocalPlayer)
{
Render::DrawText(20, y_offset, color_white, DT_LEFT, "LocalPlayer: %x [0x%x]", LocalPlayer, LocalPlayer->GetObjectInfo());
y_offset += 15;
for (int slot = 0; slot < SLOT_MAX; slot++)
{
Weapon* pWeapon = LocalPlayer->m_weaponSlots[slot];
if (!pWeapon)
continue;
Render::DrawText(40, y_offset, color_white, DT_LEFT, "Slot Weapon %i: %x (CWeaponConfig: %x)", slot, pWeapon, pWeapon->GetWeaponConfig());
y_offset += 15;
}
Render::DrawTextA(20, y_offset, color_white, DT_LEFT, "Health: %f", LocalPlayer->GetHealth());
}
}
示例7: ObjectSpawn
void ObjectSpawn(RakNet::BitStream *bitStream, Packet *packet)
{
CObjectManager *pObjectManager = pNetowkManager->GetObjectManager();
EntityId ObjectID=0;
int iModel;
Vector3 vecPos, vecRot;
bitStream->Read(ObjectID);
bitStream->Read(iModel);
bitStream->Read(vecPos);
bitStream->Read(vecRot);
pObjectManager->New(ObjectID, iModel, vecPos, vecRot);
}
示例8: memset
/**
* CAIManager::getDistanceToObjective
* @date Modified June 2, 2006
*/
float CAIManager::getDistanceToObjective(D3DXVECTOR3* vDirection)
{
if (m_poCurrentObjective == NULL)
{
memset(vDirection, 0, sizeof(D3DXVECTOR3));
return 0.0f;
}
CObjectManager* poObjectManager = CObjectManager::getInstancePtr();
CObjectManager::ObjectList loPlayers;
poObjectManager->getObjects(OBJ_PLAYER, &loPlayers);
D3DXVec3Subtract(vDirection, &m_poCurrentObjective->getPosition(), &((CPlayer*)loPlayers.front())->getPosition());
vDirection->y = 0.0f;
float fLength = 0.0f;
D3DXVec3Normalize(&fLength, vDirection, vDirection);
return fLength;
}
示例9: CheckObjectTransparent
// 检测是否要透明
void CEngineInterface::CheckObjectTransparent()
{
if(!m_pFairySystem)
return ;
CObjectManager* objMng = CObjectManager::GetMe();
fVector3 fvPos;
if( objMng->GetMySelf()->GetRenderInterface() )
{
objMng->GetMySelf()->GetRenderInterface()->Actor_GetLocator( GetCharaLocatorName(LOCATOR_CHAR_ATTACK), fvPos ); // 取人物绑定点的位置, 判断起来比较合理 "人物身体受击点"
}
Axis_Trans(tGfxSystem::AX_GAME, fvPos, tGfxSystem::AX_GFX, fvPos);
Ogre::Camera* pOgreCamera = m_pFairySystem->getCamera();
Ogre::Vector3 origin = pOgreCamera->getPosition();
// 屏掉下边这句了by czg 200911-30
m_pFairySystem->makeObjectTransparent(origin, Ogre::Vector3(fvPos.x, fvPos.y, fvPos.z), 0.8, 1, NULL);
}
示例10: InitObject
void CGUIListBox::InitObject(const char * strObjectName, const char * alignment, int x, int y, int width, int height)
{
CObjectManager *pOm = &CSingleton<CObjectManager>::Instance();
if (!pOm->IsExist("default_CGUIListBox")) {
CGUIListBox::StaticInit();
}
pOm->CloneObject("default_CGUIListBox", this);
CGUIBase::InitObject(strObjectName, alignment, x, y, width, height);
//initialize scrollbars
string str;
str = GetName() + ".vscrollbar";
m_VScroll->InitObject(str.c_str(), "_rt", -m_nSBWidth - m_nBorder, m_nBorder, m_nSBWidth, RectHeight(m_objResource->GetDrawingRects(0)));
m_VScroll->SetParent(this);
m_VScroll->SetLinkedObject(this);
m_VScroll->UpdateRects();
// str=GetName()+".hscrollbar";
// m_HScroll->InitObject(str.c_str(),"_lb",m_nBorder,-m_nSBWidth-m_nBorder,RectWidth(m_objResource->GetDrawingRects(0)),m_nSBWidth);
// m_HScroll->m_parent=this;
// m_HScroll->SetLinkedObject(this);
// m_HScroll->UpdateRects();
}
示例11: while
/**
* CAIManager::updateSpawnTriggers
* @date Modified May 9, 2006
*/
void CAIManager::updateSpawnTriggers(void)
{
CObjectManager* poObjectManager = CObjectManager::getInstancePtr();
CObjectManager::ObjectList loTriggers;
poObjectManager->getObjects(OBJ_AI_SPAWNTRIGGER, &loTriggers);
CObjectManager::ObjectList::iterator oTriggerIter = loTriggers.begin();
while (oTriggerIter != loTriggers.end())
{
((CActorSpawnTrigger*)(*oTriggerIter))->activateSpawns();
oTriggerIter++;
}
CObjectManager::ObjectList loSpawns;
poObjectManager->getObjects(OBJ_SPAWN, &loSpawns);
CObjectManager::ObjectList::iterator oSpawnIter = loSpawns.begin();
while (oSpawnIter != loSpawns.end())
{
((CActorSpawn*)(*oSpawnIter))->setUsed(false);
oSpawnIter++;
}
}
示例12: ci
CBomb::CBomb(Ogre::SceneNode *pParentNode, CObjectManager &objectManager, const Ogre::Vector3 &vPosition)
: CLiftableObject(pParentNode, objectManager, NULL, LOT_BOMB, false, UserData()), m_pListener(NULL) {
m_pSceneNode = pParentNode->createChildSceneNode();
m_pSceneNode->attachObject(pParentNode->getCreator()->createEntity(BOMB_MESH));
m_pSceneNode->setScale(Ogre::Vector3::UNIT_SCALE * CPerson::PERSON_SCALE);
m_fTimer = BOMB_TIMER;
btCollisionShape *pShape = new btSphereShape(BOMB_COL_RADIUS);
btRigidBody::btRigidBodyConstructionInfo ci(BOMB_MASS, new BtOgre::RigidBodyState(m_pSceneNode), pShape);
btRigidBody *pRB = new btRigidBody(ci);
objectManager.getMap().getPhysicsManager()->getWorld()->addRigidBody(pRB, COL_INTERACTIVE, MASK_STATIC_COLLIDES_WITH | COL_STATIC);
m_pCollisionObject = pRB;
setAsUserPointer(m_pCollisionObject);
pRB->getWorldTransform().setOrigin(BtOgre::Convert::toBullet(vPosition + Ogre::Vector3::UNIT_Y * BOMB_COL_RADIUS));
}
示例13: Exception
CChest::CChest(Ogre::SceneNode *pNode, CObjectManager &objectManager, btCollisionObject *pCollisionObject, EChestType eChestType, const Ogre::String &id)
: CObject(objectManager, CHEST_OBJECT, pCollisionObject, id), m_eChestType(eChestType) {
m_eChestState = CS_CLOSED;
//setInnerObject(&innerObject);
m_pInnerObject = NULL;
m_pLidSceneNode = objectManager.getMap().getRootSceneNode()->createChildSceneNode();
m_pLidSceneNode->setPosition(pNode->getPosition());
m_pLidSceneNode->setOrientation(pNode->getOrientation());
m_pLidSceneNode->setScale(pNode->getScale());
m_vInnerObjectPos = m_pLidSceneNode->getPosition();
btCollisionShape *pColShape(0);
switch (m_eChestType) {
case CT_SMALL:
m_pLidSceneNode->attachObject(pNode->getCreator()->createEntity("Chest.Small.Upper.mesh"));
m_pLidSceneNode->translate(0, 0.37465f, -0.30862f, Ogre::Node::TS_LOCAL);
m_vInnerObjectPos += m_pLidSceneNode->getOrientation() * Ogre::Vector3(0, 0.15f, 0);
pColShape = new btBoxShape(btVector3(0.3f, 0.08f, 0.2f));
m_vPhysicsOffset = Ogre::Vector3(0, 0.15f, 0.25f);
break;
default:
throw Ogre::Exception(0, "Unknown chest type", __FILE__);
break;
}
m_pLidPhysics = new btRigidBody(0, new btDefaultMotionState(), pColShape);
m_pLidPhysics->getWorldTransform().setOrigin(BtOgre::Convert::toBullet(m_pLidSceneNode->getPosition() + m_pLidSceneNode->getOrientation() * m_vPhysicsOffset));
m_pLidPhysics->getWorldTransform().setRotation(BtOgre::Convert::toBullet(m_pLidSceneNode->getOrientation()));
m_ObjectManager.getMap().getPhysicsManager()->getWorld()->addRigidBody(m_pLidPhysics, COL_STATIC, MASK_STATIC_COLLIDES_WITH);
// check for safe state
if (id.length() > 0) {
EItemSaveState iss = CPlayerData::getSingleton().getMapItemState(m_ObjectManager.getMap().getName(), id, ISS_CLOSED);
if (iss == ISS_OPENED) {
// open chest as initial state
m_eChestState = CS_OPENED;
m_pLidSceneNode->pitch(Ogre::Radian(-CHEST_MAX_ANGLE));
m_pLidPhysics->getWorldTransform().setOrigin(BtOgre::Convert::toBullet(m_pLidSceneNode->getPosition() + m_pLidSceneNode->getOrientation() * m_vPhysicsOffset));
m_pLidPhysics->getWorldTransform().setRotation(BtOgre::Convert::toBullet(m_pLidSceneNode->getOrientation()));
}
}
}
示例14: ProcessInput
void ProcessInput()
{
static bool leftButtonDown = false;
static bool rightButtonDown = false;
static bool first = true;
// rotate through mouse cursors on mouseclicks or wheel movement
if (g_input.ButtonDown(0)){
leftButtonDown = true;
if(theObjects.lives_remaining >= 0) theObjects.fire(Timer.time());
}
if (g_input.ButtonDown(1)){
if(theObjects.lives_remaining >= 0) theObjects.fire(Timer.time());
rightButtonDown = true;
}
// update the mouse position
int dx, dy;
g_input.GetMouseMovement(dx, dy);
int scale = (dx < 0)? 2:4; //going up is faster than going down
theObjects.changedirection(dx * 3,dy/scale);
} // end ProcessInput()
示例15: FromHandle
CCardIssuer* CCardIssuer::FromHandle(ISSUERHANDLE hIssuer)
{
if ( _objmgr.IsExist( (void*) hIssuer ))
return (CCardIssuer*) hIssuer;
return NULL;
}