VOID CObjectCommand_MagicSend::CleanUp(VOID) { m_nMagicID = INVALID_ID; m_nTargetObjID = INVALID_ID; m_posTarget = WORLD_POS(-1.f, -1.f); m_fTargetDir = -1.f; CObjectCommand_Logic::CleanUp(); }
VOID CObjectCommand_MagicChannel::CleanUp(VOID) { m_nMagicID = INVALID_ID; m_nTargetObjID = INVALID_ID; m_posTarget = WORLD_POS(-1.f, -1.f); m_fTargetDir = -1.f; m_uTotalTime = UINT_MAX; m_uEndTime = UINT_MAX; CObjectCommand_Logic::CleanUp(); }
VOID CObject_Character::Initial( VOID* pParam ) { //AxProfile::AxProfile_PopNode("ObjInit"); CObject_Phy::Initial(pParam); m_bAnimationEnd = FALSE; m_uFightStateTime = 0; SetCurrentLogicCommand(NULL); m_fLogic_Speed = 1.f; SetMapPosition( fVector2( GetPosition().x, GetPosition().z ) ); //创建逻辑信息 m_pCharacterData = CDataPool::GetMe()->CharacterData_Create(this); //创建信息板 //AxProfile::AxProfile_PushNode("ObjInit_CreateBoard"); if(!GetFakeObjectFlag()&& CGameProcedure::s_pUISystem) { m_pInfoBoard = CGameProcedure::s_pUISystem->CreateCreatureBoard(); m_pInfoBoard->SetElement_ObjId(this->GetServerID()); m_pInfoBoard->SetElement_LeaderFlag(FALSE); m_pInfoBoard->SetElement_Name(""); m_pInfoBoard->SetElement_SaleSign(FALSE); SetElement_Title("",_TITLE::NO_TITLE); m_pInfoBoard->Show(FALSE); } //AxProfile::AxProfile_PopNode("ObjInit_CreateBoard"); m_uTime_LogicEventListTick = CGameProcedure::s_pTimeSystem->GetTimeNow(); Enable(OSF_VISIABLE); Disalbe(OSF_OUT_VISUAL_FIELD); m_bDropBox_HaveData = FALSE; m_nDropBox_ItemBoxID = INVALID_ID; m_DropBox_OwnerGUID = INVALID_ID; m_posDropBox_CreatePos = WORLD_POS(-1.f, -1.f); m_bHideWeapon = FALSE; UpdateCharRace(); UpdateCharModel(); UpdateMountModel(); SObjectInit *pCharacterInit = (SObjectInit*)pParam; if ( pCharacterInit != NULL ) { // 状态信息 RemoveAllImpact(); Start_Idle(); } }
CObject_Character::CObject_Character() { m_pTheAI = NULL; m_pInfoBoard = NULL; m_pCharacterData = NULL; m_uTime_LogicEventListTick = 0; m_bJumping = FALSE; m_pCurrentLogicCommand = NULL; m_paramLogic_MagicSend.m_nSaveMagicID = -1; m_paramLogic_MagicSend.m_bBeAttackEffectShowed = FALSE; m_paramLogic_MagicSend.m_nActionIndex = -1; //m_nIdleIntervalTime = (UINT)-1; //m_nLastIdleMotionTime = 0; m_bAnimationEnd = FALSE; m_uFightStateTime = 0; m_fLogic_Speed = 1.f; m_pMountRenderInterface = NULL; m_pCharActionSetFile = NULL; m_pMountActionSetFile = NULL; m_nCharModelID = INVALID_ID; m_nMountModelID = INVALID_ID; m_fMountAddHeight = 0.0F; m_bHideWeapon = FALSE; m_pWlakSound = 0; m_pLifeAbilitySound = 0; m_bIsChatMoodPlaying = FALSE; m_bNeedStandUp = FALSE; m_bStanding = FALSE; m_bDropBox_HaveData = FALSE; m_nDropBox_ItemBoxID = INVALID_ID; m_DropBox_OwnerGUID = INVALID_ID; m_posDropBox_CreatePos = WORLD_POS(-1.f, -1.f); }
VOID CObjectCommand_StopMove::CleanUp(VOID) { m_nEndNodeIndex = -1; m_posEndPos = WORLD_POS(-1.f, -1.f); CObjectCommand_StopLogic::CleanUp(); }
void Object::tick_Moving(float fElapsTime) { if(m_vMovePath.empty()) { setLogicMode(LM_IDLE); return; } //current path MovePath& currentPath = *(m_vMovePath.begin()); //send move msg if(currentPath.state == 0) { //processing currentPath.state = 1; CGCharMove msg; msg.setObjID(m_nServerID); msg.setHandleID(currentPath.id); msg.setWorldPos(WORLD_POS(currentPath.fStartX, currentPath.fStartZ)); float x, z; MovePathList::iterator it; for(it=m_vMovePath.begin(); it!=m_vMovePath.end(); it++) { WORLD_POS posTarget; x = posTarget.m_fX = it->fEndX; z = posTarget.m_fZ = it->fEndZ; msg.addTargetPos(&posTarget); } m_pAgent->getNetManager()->sendPacket(&msg); } //Move distance float fMoveDist = m_fSpeed*fElapsTime/1000.0f; float fMoveDistSq = fMoveDist*fMoveDist; //distance of currentpos and target float fDistSq = (currentPath.fEndX-m_fX)*(currentPath.fEndX-m_fX) + (currentPath.fEndZ-m_fZ)*(currentPath.fEndZ-m_fZ); // need move if(fDistSq > fMoveDistSq) { float fTarDist = ::sqrt(fDistSq) ; float fDistX = (fMoveDist*(currentPath.fEndX-m_fX))/fTarDist; float fDistZ = (fMoveDist*(currentPath.fEndZ-m_fZ))/fTarDist; float fvNextPosX = m_fX + fDistX; float fvNextPosZ = m_fZ + fDistZ; //set new position this->setPosition(fvNextPosX, fvNextPosZ); } else { //to next this->setPosition(currentPath.fEndX, currentPath.fEndZ); m_vMovePath.erase(m_vMovePath.begin()); } }
VOID CObject_Character::Release(VOID) { DeleteObjectCommand(m_pCurrentLogicCommand); m_pCurrentLogicCommand = NULL; CleanupLogicCommandList(); if ( !m_mapImpactEffect.empty() ) { SImpactEffect *pImpactEffect; CImpactEffectMap::iterator itCur, itEnd; itEnd = m_mapImpactEffect.end(); for ( itCur = m_mapImpactEffect.begin(); itCur != itEnd; itCur++ ) { pImpactEffect = (itCur->second); if ( pImpactEffect != NULL ) { delete pImpactEffect; } } m_mapImpactEffect.erase( m_mapImpactEffect.begin(), itEnd ); } //删除逻辑信息 CDataPool::GetMe()->CharacterData_Destroy(this); m_pCharacterData = NULL; //从加载队列中清除 CObjectManager::GetMe()->GetLoadQueue()->ClearTask(GetID()); ReleaseRenderInterface(); ReleaseMountRenderInterface(); if(m_pInfoBoard && CGameProcedure::s_pUISystem) { m_pInfoBoard->Destroy(); m_pInfoBoard = NULL; } m_uTime_LogicEventListTick = 0; //释放声音资源 CGameProcedure::s_pSoundSystem->Source_Destroy(m_pWlakSound); m_pWlakSound = 0; CGameProcedure::s_pSoundSystem->Source_Destroy(m_pLifeAbilitySound); m_pLifeAbilitySound = 0; Disalbe(OSF_RAY_QUERY); m_pCharActionSetFile = NULL; m_pMountActionSetFile = NULL; m_nCharModelID = INVALID_ID; m_nMountModelID = INVALID_ID; m_fMountAddHeight = 0.0F; m_uFightStateTime = 0; m_bDropBox_HaveData = FALSE; m_nDropBox_ItemBoxID = INVALID_ID; m_DropBox_OwnerGUID = INVALID_ID; m_posDropBox_CreatePos = WORLD_POS(-1.f, -1.f); CObject_Dynamic::Release(); }