void CBaseGolem::HandleEvent( Event* _toHandle ) { //include all the events all the golems respond to if( _toHandle->GetEventID() == "ATTRACTORPLACED" ) { CAttractor* placedAttr = (CAttractor*)_toHandle->GetParam() ; if( placedAttr->GetElemType() == this->GetGolemType() ) { if(this->GetLayerLocation() != placedAttr->GetLayerLocation()) return; //start moving toward our target SetTargetPos( placedAttr->GetIndexPosX() , placedAttr->GetIndexPosY() ) ; SetMoveType(TARGET_MOVE); } } else if( _toHandle->GetEventID() == "ATTRACTORREMOVED" ) { CAttractor* attr = (CAttractor*)_toHandle->GetParam() ; if( !attr ) return; // ATTRACTOR REMOVED ON DIFFERENT LEVEL? if( GetTargetPosX() == attr->GetIndexPosX() && GetTargetPosY() == attr->GetIndexPosY() ) { ClearTarget(); } } }
void RenderTargetTexture::Activate() { glDepthFunc(GL_LEQUAL); CHECK_GL_ERROR(L"Can't set depth func to GL_EQUAL"); glBindFramebuffer(GL_FRAMEBUFFER, m_fb); CHECK_GL_ERROR(L"Can't bind frame buffer"); ClearTarget(); }
void DxRenderTarget::CopyTextures(ID3D11DeviceContext* context) { assert(m_readWrite); for (unsigned int i = 0; i < m_textures.size(); ++i) { context->CopyResource(m_copiedTextures[i], m_textures[i]); } ClearTarget(context); }
void KAIBase::OnAlert(void) { KCharacter* pTarget = NULL; BOOL bRetCode = FALSE; bRetCode = m_pSelf->m_SelectTarget.GetTarget(&pTarget); KG_PROCESS_ERROR(bRetCode && pTarget); if (pTarget) { //目标超出范围 int nDistance2 = g_GetDistance2(m_pSelf->m_nX, m_pSelf->m_nY, pTarget->m_nX, pTarget->m_nY); //按等级修正距离 int nCheckDistance2 = (int)(m_pAIParam->nAlertRange * m_pAIParam->nAlertRange); KG_PROCESS_ERROR(nDistance2 <= nCheckDistance2); //朝向目标 int nDirection = g_GetDirection(m_pSelf->m_nX, m_pSelf->m_nY, pTarget->m_nX, pTarget->m_nY); if (m_pSelf->m_nFaceDirection != nDirection) { m_pSelf->Turn(nDirection, true, true); } //目标未丢失, 看是否超时 if (g_pSO3World->m_nGameLoop > m_AlertData.nAlartFrame) { //超时,进行攻击 m_pSelf->m_ThreatList.ModifyThreat(pTarget, 0); TurnToFight(); return; } } bRetCode = CheckTargetInAttackRange(); KG_PROCESS_SUCCESS(bRetCode); return; Exit0: bRetCode = CheckTargetInAttackRange(); KG_PROCESS_SUCCESS(bRetCode); //什么都没有了,出警戒状态,开始发呆 ClearTarget(); DoIdle(1); return; Exit1: return; }
void DxRenderTarget::SetActive(ID3D11DeviceContext* context) { if (m_isBackBuffer) { context->OMSetRenderTargets(m_count, &m_targets[0], nullptr); } else { context->OMSetRenderTargets(m_count, &m_targets[0], m_depthBuffer); } ClearTarget(context); }
CBaseGolem::CBaseGolem(void) { CBaseEntity::CBaseEntity(); fCollectedTime = 0.0f; m_nType = ENT_GOLEM; ClearTarget(); SetGolemType(-1); SetMoveType(TARGET_MOVE); m_nEatSoundID = CSGD_FModManager::GetInstance()->LoadSound("resource/Sounds/creature_snarl1.mp3" ) ; m_nStepSoundID = CSGD_FModManager::GetInstance()->LoadSound("resource/Sounds/footstepsGolem.mp3" ) ; //adjust the sounds to match configurations COptionsState* Opt = COptionsState::GetInstance(); Opt->AdjustSound(m_nEatSoundID, true); Opt->AdjustSound(m_nStepSoundID, true); }
ECode StateListAnimator::SetTarget( /* [in] */ IView* view) { AutoPtr<IView> current; GetTarget((IView**)¤t); if (current.Get() == view) { return NOERROR; } if (current != NULL) { ClearTarget(); } if (view != NULL) { mViewRef = NULL; IWeakReferenceSource::Probe(view)->GetWeakReference((IWeakReference**)&mViewRef); } return NOERROR; }
void DigitalBrain::Sleep(void) { SetLeader (NULL); ClearTarget(); // NOTE: This is only legal if the platorms target list is already cleared. // Currently, SimVehicle::Sleep call SimMover::Sleep which clears the list, // then it calls theBrain::Sleep. As long as this doesn't change this will // not cause a leak. if (groundTargetPtr){ #ifdef DEBUG if (groundTargetPtr->prev || groundTargetPtr->next){ MonoPrint ("Ground target still in list at sleep\n"); } #endif groundTargetPtr->prev = NULL; groundTargetPtr->next = NULL; } SetGroundTarget( NULL ); }
void HeliBrain::TargetSelection( void ) { UnitClass *campUnit = (UnitClass *)self->GetCampaignObject(); FalconEntity *target; int i, numComponents; SimBaseClass *simTarg; int campTactic; // sanity check if ( !campUnit ) return; // check to see if our current ground target is a sim and exploding or // dead, if so let's get a new target from the campaign if ( targetPtr && targetPtr->BaseData()->IsSim() && ( targetPtr->BaseData()->IsExploding() || !((SimBaseClass *)targetPtr->BaseData())->IsAwake() ) ) { ClearTarget( ); } // see if we've already got a target if ( targetPtr ) { target = targetPtr->BaseData(); // is it a campaign object? if not we can return.... if (target->IsSim() ) { return; } // itsa campaign object. Check to see if its deagg'd if (((CampBaseClass*)target)->IsAggregate() ) { // still aggregated, return return; } // the campaign object is now deaggregated, choose a sim entity // to target on it numComponents = ((CampBaseClass*)target)->NumberOfComponents(); for ( i = 0; i < numComponents; i++ ) { simTarg = ((CampBaseClass*)target)->GetComponentEntity( rand() % numComponents ); if ( !simTarg ) //sanity check continue; // don't target runways (yet) if ( // !simTarg->IsSetCampaignFlag (FEAT_FLAT_CONTAINER) && !simTarg->IsExploding() && !simTarg->IsDead() && simTarg->pctStrength > 0.0f ) { SetTargetEntity( simTarg ); break; } } // end for # components return; } // end if already targetPtr // at this point we have no target, we're going to ask the campaign // to find out what we're supposed to hit // tell unit we haven't done any checking on it yet campUnit->UnsetChecked(); // choose target. I assume if this returns 0, no target.... if ( !campUnit->ChooseTarget() ) { ClearTarget(); // alternately try and choose the waypoint's target // SettargetPtr( self->curWaypoint->GetWPTarget() ); return; } // get the target target = campUnit->GetTarget(); // get tactic -- not doing anything with it now campUnit->ChooseTactic(); campTactic = campUnit->GetUnitTactic(); // sanity check and make sure its on ground, what to do if not?!... if ( !target || campTactic == ATACTIC_RETROGRADE || campTactic == ATACTIC_IGNORE || campTactic == ATACTIC_AVOID || campTactic == ATACTIC_ABORT || campTactic == ATACTIC_REFUEL ) { ClearTarget(); return; } // set it as our target SetTargetEntity( target ); }
void ds::Render::ClearTarget( ) { ClearTarget( CL_Black ); }