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


C++ CEntityAlive::g_Alive方法代码示例

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


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

示例1: feel_vision_isRelevant

BOOL CAI_Rat::feel_vision_isRelevant(CObject* O)
{
    CEntityAlive* E = smart_cast<CEntityAlive*> (O);
    if (!E) return FALSE;
    if ((E->g_Team() == g_Team()) && (E->g_Alive())) return FALSE;
    return TRUE;
}
开发者ID:2asoft,项目名称:xray,代码行数:7,代码来源:ai_rat_feel.cpp

示例2: feel_touch_contact

BOOL CBastArtefact::feel_touch_contact(CObject* O) 
{
    CEntityAlive* pEntityAlive = smart_cast<CEntityAlive*>(O);

    if(pEntityAlive && pEntityAlive->g_Alive()) 
        return TRUE;
    else
        return FALSE;
}
开发者ID:OLR-xray,项目名称:OLR-3.0,代码行数:9,代码来源:BastArtifact.cpp

示例3: feel_touch_new

void CBastArtefact::feel_touch_new(CObject* O) 
{
    CEntityAlive* pEntityAlive = smart_cast<CEntityAlive*>(O);

    if(pEntityAlive && pEntityAlive->g_Alive()) 
    {
        m_AliveList.push_back(pEntityAlive);
    }
}
开发者ID:OLR-xray,项目名称:OLR-3.0,代码行数:9,代码来源:BastArtifact.cpp

示例4: Actor

void CCameraLook2::Update(Fvector& point, Fvector&)
{
    if(!m_locked_enemy)
    {//autoaim
        if( pInput->iGetAsyncKeyState(cam_dik) )
        {
            const CVisualMemoryManager::VISIBLES& vVisibles = Actor()->memory().visual().objects();
            CVisualMemoryManager::VISIBLES::const_iterator v_it = vVisibles.begin();
            float _nearest_dst	= flt_max;

            for (; v_it!=vVisibles.end(); ++v_it)
            {
                const CObject*	_object_			= (*v_it).m_object;
                if (!Actor()->memory().visual().visible_now(smart_cast<const CGameObject*>(_object_)))	continue;

                CObject* object_ = const_cast<CObject*>(_object_);
                

                CEntityAlive*	EA					= smart_cast<CEntityAlive*>(object_);
                if(!EA || !EA->g_Alive())			continue;
                
                float d = object_->Position().distance_to_xz(Actor()->Position());
                if( !m_locked_enemy || d<_nearest_dst)
                {
                    m_locked_enemy	= object_;
                    _nearest_dst	= d;
                }
            }
//.			if(m_locked_enemy) Msg("enemy is %s", *m_locked_enemy->cNameSect() );
        }
    }else
    {
        if( !pInput->iGetAsyncKeyState(cam_dik) ){
            m_locked_enemy	= NULL;
//.			Msg				("enemy is NILL");
        }
    }

    if(m_locked_enemy)
        UpdateAutoAim	();


    Fmatrix mR;
    mR.setHPB						(-yaw,-pitch,-roll);

    vDirection.set					(mR.k);
    vNormal.set						(mR.j);

    Fmatrix							a_xform;
    a_xform.setXYZ					(0, -yaw, 0);
    a_xform.translate_over			(point);
    Fvector _off					= m_cam_offset;
    a_xform.transform_tiny			(_off);
    vPosition.set					(_off);
}
开发者ID:2asoft,项目名称:xray,代码行数:55,代码来源:cameralook.cpp

示例5: OfferTalk

//нам предлагают поговорить,
//проверяем наше отношение 
//и если не враг начинаем разговор
bool CInventoryOwner::OfferTalk(CInventoryOwner* talk_partner)
{
    if(!IsTalkEnabled()) return false;

    //проверить отношение к собеседнику
    CEntityAlive* pOurEntityAlive = smart_cast<CEntityAlive*>(this);
    R_ASSERT(pOurEntityAlive);

    CEntityAlive* pPartnerEntityAlive = smart_cast<CEntityAlive*>(talk_partner);
    R_ASSERT(pPartnerEntityAlive);
    
//	ALife::ERelationType relation = RELATION_REGISTRY().GetRelationType(this, talk_partner);
//	if(relation == ALife::eRelationTypeEnemy) return false;

    if(!pOurEntityAlive->g_Alive() || !pPartnerEntityAlive->g_Alive()) return false;

    StartTalk(talk_partner);

    return true;
}
开发者ID:,项目名称:,代码行数:23,代码来源:

示例6: AffectPull

void CBaseGraviZone::AffectPull(CPhysicsShellHolder* GO,const Fvector& throw_in_dir,float dist)
{
    CEntityAlive* EA = smart_cast<CEntityAlive*>(GO);	
    if(EA && EA->g_Alive())
    {
        AffectPullAlife(EA,throw_in_dir,dist);
    }
    else if(GO && GO->PPhysicsShell())
    {
        AffectPullDead(GO,throw_in_dir,dist);
    }
}
开发者ID:zcaliptium,项目名称:xray-16,代码行数:12,代码来源:ZoneGravi.cpp

示例7:

void CPda::UpdateActiveContacts	()
{
    m_active_contacts.clear_not_free();
    xr_vector<CObject*>::iterator it= feel_touch.begin();
    for(;it!=feel_touch.end();++it){
        CEntityAlive* pEA = smart_cast<CEntityAlive*>(*it);
        if(!!pEA->g_Alive() && !pEA->cast_base_monster())
        {
            m_active_contacts.push_back(*it);
        }
    }
}
开发者ID:AntonioModer,项目名称:xray-16,代码行数:12,代码来源:PDA.cpp

示例8: bfAssignMonsterAction

bool CBaseMonster::bfAssignMonsterAction(CScriptEntityAction *tpEntityAction)
{
    if (!inherited::bfAssignMonsterAction(tpEntityAction)) return false;
    
    CScriptMonsterAction	&l_tAction = tpEntityAction->m_tMonsterAction;	
    if (l_tAction.completed()) return false;

    CEntityAlive *pE = smart_cast<CEntityAlive *>(l_tAction.m_tObject);

    switch(l_tAction.m_tAction) {
        case eGA_Rest:		
            StateMan->force_script_state(eStateRest);	
            break;
        case eGA_Eat:		
            if (pE && !pE->getDestroy() && !pE->g_Alive()){
                CorpseMan.force_corpse(pE);
                StateMan->force_script_state(eStateEat);	
            } else StateMan->force_script_state(eStateRest);	

            break;
        case eGA_Attack:
            if (pE && !pE->getDestroy() && pE->g_Alive()){
                EnemyMan.force_enemy(pE);
                StateMan->force_script_state(eStateAttack);
            } else StateMan->force_script_state(eStateRest);

            break;
        case eGA_Panic:		
            if (pE && !pE->getDestroy() && pE->g_Alive()){
                EnemyMan.force_enemy			(pE);
                StateMan->force_script_state	(eStatePanic);
            } else StateMan->force_script_state	(eStateRest);	
            break;
    }

    m_script_state_must_execute = true;
    return (!l_tAction.m_bCompleted);
}
开发者ID:AntonioModer,项目名称:xray-16,代码行数:38,代码来源:base_monster_script.cpp

示例9: UpdateInventoryOwner

void CInventoryOwner::UpdateInventoryOwner(u32 deltaT)
{
    inventory().Update();
    if ( m_pTrade )
    {
        m_pTrade->UpdateTrade();
    }
    if ( IsTrading() )
    {
        //если мы умерли, то нет "trade"
        CEntityAlive* pOurEntityAlive = smart_cast<CEntityAlive*>(this);
        R_ASSERT(pOurEntityAlive);
        if ( !pOurEntityAlive->g_Alive() )
        {
            StopTrading();
        }
    }

    if ( IsTalking() )
    {
        //если наш собеседник перестал говорить с нами,
        //то и нам нечего ждать.
        if ( !m_pTalkPartner->IsTalking() )
        {
            StopTalk();
        }

        //если мы умерли, то тоже не говорить
        CEntityAlive* pOurEntityAlive = smart_cast<CEntityAlive*>(this);
        R_ASSERT(pOurEntityAlive);
        if ( !pOurEntityAlive->g_Alive() )
        {
            StopTalk();
        }
    }
}
开发者ID:vasilenkomike,项目名称:xray,代码行数:36,代码来源:InventoryOwner.cpp

示例10: VERIFY

void CInventoryOwner::SetCommunity	(CHARACTER_COMMUNITY_INDEX new_community)
{
    CEntityAlive* EA					= smart_cast<CEntityAlive*>(this);
    VERIFY(EA);

    CSE_Abstract* e_entity				= ai().alife().objects().object(EA->ID(), false);
    if(!e_entity) return;

    CharacterInfo().SetCommunity( new_community );
    if( EA->g_Alive() )
    {
        EA->ChangeTeam(CharacterInfo().Community().team(), EA->g_Squad(), EA->g_Group());
    }

    CSE_ALifeTraderAbstract* trader		= smart_cast<CSE_ALifeTraderAbstract*>(e_entity);
    if(!trader) return;
//	EA->id_Team = CharacterInfo().Community().team();
    trader->m_community_index  = new_community;
}
开发者ID:vasilenkomike,项目名称:xray,代码行数:19,代码来源:InventoryOwner.cpp

示例11: shedule_Update

void CPda::shedule_Update(u32 dt)	
{
    inherited::shedule_Update	(dt);

    if(!H_Parent()) return;
    Position().set	(H_Parent()->Position());

    if( IsOn() && Level().CurrentEntity() && Level().CurrentEntity()->ID()==H_Parent()->ID() )
    {
        CEntityAlive* EA = smart_cast<CEntityAlive*>(H_Parent());
        if(!EA || !EA->g_Alive())
        {
            TurnOff();
            return;
        }

        feel_touch_update(Position(),m_fRadius);
        UpdateActiveContacts	();
    }
}
开发者ID:AntonioModer,项目名称:xray-16,代码行数:20,代码来源:PDA.cpp

示例12: feel_vision_isRelevant

BOOL  CBaseMonster::feel_vision_isRelevant(CObject* O)
{
    if (!g_Alive())					return FALSE;
    if (0==smart_cast<CEntity*>(O))	return FALSE;
    
    if ((O->spatial.type & STYPE_VISIBLEFORAI) != STYPE_VISIBLEFORAI) return FALSE;
    
    // если спит, то ничего не видит
    if (m_bSleep) return FALSE;
    
    // если не враг - не видит
    CEntityAlive* entity = smart_cast<CEntityAlive*> (O);
    if (entity && entity->g_Alive()) {
        if (!EnemyMan.is_enemy(entity)) {
            // если видит друга - проверить наличие у него врагов
            CBaseMonster *monster = smart_cast<CBaseMonster *>(entity);
            if (monster && !m_skip_transfer_enemy) EnemyMan.transfer_enemy(monster);
            return FALSE;
        }
    }

    return TRUE;
}
开发者ID:BeaconDev,项目名称:xray-16,代码行数:23,代码来源:base_monster_feel.cpp

示例13:

void CCustomZone::feel_touch_new	(CObject* O) 
{
//	if(smart_cast<CActor*>(O) && O == Level().CurrentEntity())
//					m_pLocalActor	= smart_cast<CActor*>(O);

    CGameObject*	pGameObject		= smart_cast<CGameObject*>(O);
    CEntityAlive*	pEntityAlive	= smart_cast<CEntityAlive*>(pGameObject);
    CArtefact*		pArtefact		= smart_cast<CArtefact*>(pGameObject);
    
    SZoneObjectInfo object_info		;
    object_info.object = pGameObject;

    if(pEntityAlive && pEntityAlive->g_Alive())
        object_info.nonalive_object = false;
    else
        object_info.nonalive_object = true;

    if(pGameObject->Radius()<SMALL_OBJECT_RADIUS)
        object_info.small_object = true;
    else
        object_info.small_object = false;

    if((object_info.small_object && m_zone_flags.test(eIgnoreSmall)) ||
        (object_info.nonalive_object && m_zone_flags.test(eIgnoreNonAlive)) || 
        (pArtefact && m_zone_flags.test(eIgnoreArtefact)))
        object_info.zone_ignore = true;
    else
        object_info.zone_ignore = false;
    enter_Zone(object_info);
    m_ObjectInfoMap.push_back(object_info);
    
    if (IsEnabled())
    {
        PlayEntranceParticles(pGameObject);
        PlayObjectIdleParticles(pGameObject);
    }
};
开发者ID:AntonioModer,项目名称:xray-16,代码行数:37,代码来源:CustomZone.cpp

示例14: Render

void CHUDTarget::Render()
{
    VERIFY		(g_bRendering);

    CObject*	O		= Level().CurrentEntity();
    if (0==O)	return;
    CEntity*	E		= smart_cast<CEntity*>(O);
    if (0==E)	return;

    Fvector p1				= Device.vCameraPosition;
    Fvector dir				= Device.vCameraDirection;
    
    // Render cursor
    u32 C				= C_DEFAULT;
    
    FVF::TL				PT;
    Fvector				p2;
    p2.mad				(p1,dir,RQ.range);
    PT.transform		(p2,Device.mFullTransform);
    float				di_size = C_SIZE/powf(PT.p.w,.2f);

    CGameFont* F		= HUD().Font().pFontGraffiti19Russian;
    F->SetAligment		(CGameFont::alCenter);
    F->OutSetI			(0.f,0.05f);

    if (psHUD_Flags.test(HUD_CROSSHAIR_DIST)){
        F->SetColor		(C);
        F->OutNext		("%4.1f",RQ.range);
    }

    if (psHUD_Flags.test(HUD_INFO)){ 
        if (RQ.O){
            CEntityAlive*	E		= smart_cast<CEntityAlive*>	(RQ.O);
            CEntityAlive*	pCurEnt = smart_cast<CEntityAlive*>	(Level().CurrentEntity());
            PIItem			l_pI	= smart_cast<PIItem>		(RQ.O);

            if (IsGameTypeSingle())
            {
                CInventoryOwner* our_inv_owner		= smart_cast<CInventoryOwner*>(pCurEnt);
                if (E && E->g_Alive() && !E->cast_base_monster())
                {
//.					CInventoryOwner* our_inv_owner		= smart_cast<CInventoryOwner*>(pCurEnt);
                    CInventoryOwner* others_inv_owner	= smart_cast<CInventoryOwner*>(E);

                    if(our_inv_owner && others_inv_owner){

                        switch(RELATION_REGISTRY().GetRelationType(others_inv_owner, our_inv_owner))
                        {
                        case ALife::eRelationTypeEnemy:
                            C = C_ON_ENEMY; break;
                        case ALife::eRelationTypeNeutral:
                            C = C_ON_NEUTRAL; break;
                        case ALife::eRelationTypeFriend:
                            C = C_ON_FRIEND; break;
                        }

                    if (fuzzyShowInfo>0.5f){
                        CStringTable	strtbl		;
                        F->SetColor	(subst_alpha(C,u8(iFloor(255.f*(fuzzyShowInfo-0.5f)*2.f))));
                        F->OutNext	("%s", *strtbl.translate(others_inv_owner->Name()) );
                        F->OutNext	("%s", *strtbl.translate(others_inv_owner->CharacterInfo().Community().id()) );
                    }
                    }

                    fuzzyShowInfo += SHOW_INFO_SPEED*Device.fTimeDelta;
                }
                else 
                    if (l_pI && our_inv_owner && RQ.range < 2.0f*our_inv_owner->inventory().GetTakeDist())
                    {
                        if (fuzzyShowInfo>0.5f){
                            F->SetColor	(subst_alpha(C,u8(iFloor(255.f*(fuzzyShowInfo-0.5f)*2.f))));
                            F->OutNext	("%s",l_pI->Name/*Complex*/());
                        }
                        fuzzyShowInfo += SHOW_INFO_SPEED*Device.fTimeDelta;
                    }
            }
            else
            {
                if (E && (E->GetfHealth()>0))
                {
                    if (pCurEnt && GameID() == GAME_SINGLE){	
                        if (GameID() == GAME_DEATHMATCH)			C = C_ON_ENEMY;
                        else{	
                            if (E->g_Team() != pCurEnt->g_Team())	C = C_ON_ENEMY;
                            else									C = C_ON_FRIEND;
                        };
                        if (RQ.range >= recon_mindist() && RQ.range <= recon_maxdist()){
                            float ddist = (RQ.range - recon_mindist())/(recon_maxdist() - recon_mindist());
                            float dspeed = recon_minspeed() + (recon_maxspeed() - recon_minspeed())*ddist;
                            fuzzyShowInfo += Device.fTimeDelta/dspeed;
                        }else{
                            if (RQ.range < recon_mindist()) fuzzyShowInfo += recon_minspeed()*Device.fTimeDelta;
                            else fuzzyShowInfo = 0;
                        };

                        if (fuzzyShowInfo>0.5f){
                            clamp(fuzzyShowInfo,0.f,1.f);
                            int alpha_C = iFloor(255.f*(fuzzyShowInfo-0.5f)*2.f);
                            u8 alpha_b	= u8(alpha_C & 0x00ff);
                            F->SetColor	(subst_alpha(C,alpha_b));
//.........这里部分代码省略.........
开发者ID:OLR-xray,项目名称:XRay-NEW,代码行数:101,代码来源:HUDTarget.cpp

示例15: ActorUse

void CActor::ActorUse()
{
    //mstate_real = 0;
    PickupModeOn();

        
    if (m_holder)
    {
        CGameObject*	GO			= smart_cast<CGameObject*>(m_holder);
        NET_Packet		P;
        CGameObject::u_EventGen		(P, GEG_PLAYER_DETACH_HOLDER, ID());
        P.w_u32						(GO->ID());
        CGameObject::u_EventSend	(P);
        return;
    }
                
    if(character_physics_support()->movement()->PHCapture())
        character_physics_support()->movement()->PHReleaseObject();

    

    if(m_pUsableObject)m_pUsableObject->use(this);
    
    if(m_pInvBoxWeLookingAt && m_pInvBoxWeLookingAt->nonscript_usable())
    {
        CUIGameSP* pGameSP = smart_cast<CUIGameSP*>(HUD().GetUI()->UIGame());
        if(pGameSP) pGameSP->StartCarBody(this, m_pInvBoxWeLookingAt );
        return;
    }

    if(!m_pUsableObject||m_pUsableObject->nonscript_usable())
    {
        if(m_pPersonWeLookingAt)
        {
            CEntityAlive* pEntityAliveWeLookingAt = 
                smart_cast<CEntityAlive*>(m_pPersonWeLookingAt);

            VERIFY(pEntityAliveWeLookingAt);

            if (GameID()==GAME_SINGLE)
            {			
                if(pEntityAliveWeLookingAt->g_Alive())
                {
                    TryToTalk();
                }
                //обыск трупа
                else  if(!Level().IR_GetKeyState(DIK_LSHIFT))
                {
                    //только если находимся в режиме single
                    CUIGameSP* pGameSP = smart_cast<CUIGameSP*>(HUD().GetUI()->UIGame());
                    if(pGameSP)pGameSP->StartCarBody(this, m_pPersonWeLookingAt );
                }
            }
        }

        collide::rq_result& RQ = HUD().GetCurrentRayQuery();
        CPhysicsShellHolder* object = smart_cast<CPhysicsShellHolder*>(RQ.O);
        u16 element = BI_NONE;
        if(object) 
            element = (u16)RQ.element;

        if(object && Level().IR_GetKeyState(DIK_LSHIFT))
        {
            bool b_allow = !!pSettings->line_exist("ph_capture_visuals",object->cNameVisual());
            if(b_allow && !character_physics_support()->movement()->PHCapture())
            {
                character_physics_support()->movement()->PHCaptureObject(object,element);

            }

        }
        else
        {
            if (object && smart_cast<CHolderCustom*>(object))
            {
                    NET_Packet		P;
                    CGameObject::u_EventGen		(P, GEG_PLAYER_ATTACH_HOLDER, ID());
                    P.w_u32						(object->ID());
                    CGameObject::u_EventSend	(P);
                    return;
            }

        }
    }


}
开发者ID:NeoAnomaly,项目名称:xray,代码行数:87,代码来源:ActorInput.cpp


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