• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    公众号

C++ GetActor函数代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

本文整理汇总了C++中GetActor函数的典型用法代码示例。如果您正苦于以下问题:C++ GetActor函数的具体用法?C++ GetActor怎么用?C++ GetActor使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。



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

示例1: Terminate

void study::Handle()
{
  item* Literature = game::SearchItem(LiteratureID);

  if(!Literature || !Literature->Exists() || !Actor->IsOver(Literature))
  {
    Terminate(false);
    return;
  }

  if(GetActor()->GetLSquareUnder()->IsDark() && !game::GetSeeWholeMapCheatMode())
  {
    ADD_MESSAGE("It is too dark to read now.");
    Terminate(false);
    return;
  }

  if(game::CompareLightToInt(GetActor()->GetLSquareUnder()->GetLuminance(), 115) < 0)
    GetActor()->EditExperience(PERCEPTION, -50, 1 << 1);

  if(!Counter)
  {
    Terminate(true);
    return;
  }

  if(GetActor()->GetAttribute(INTELLIGENCE) >= Counter)
    Counter = 0;
  else
    Counter -= GetActor()->GetAttribute(INTELLIGENCE);
}
开发者ID:harmonise,项目名称:ivan-f,代码行数:31,代码来源:actions.cpp


示例2: GetItem

//------------------------------------------------------------------------
int CScriptBind_Item::OnUsed(IFunctionHandler *pH, ScriptHandle userId)
{
	CItem *pItem = GetItem(pH);
	if (!pItem)
		return pH->EndFunction();

	if (pItem->CanUse((EntityId)userId.n))
	{
		CActor *pActor=GetActor((EntityId)userId.n);
		if (pActor)
		{
			pActor->UseItem(pItem->GetEntityId());
			return pH->EndFunction(true);
		}
	}
	else if (pItem->CanPickUp((EntityId)userId.n))
	{
		CActor *pActor=GetActor((EntityId)userId.n);
		if (pActor)
		{
			pActor->PickUpItem(pItem->GetEntityId(), true);
			return pH->EndFunction(true);
		}
	}

	return pH->EndFunction();
}
开发者ID:AiYong,项目名称:CryGame,代码行数:28,代码来源:ScriptBind_Item.cpp


示例3: GetLastItem

//------------------------------------------------------------------------
void CInventory::HolsterItem(bool holster)
{
	//CryLogAlways("%s::HolsterItem(%s)", GetEntity()->GetName(), holster?"true":"false");

	if (!holster)
	{
		if (m_stats.holsteredItemId)
		{
			IItem* pItem = m_pGameFrameWork->GetIItemSystem()->GetItem(m_stats.holsteredItemId);

			if(pItem && pItem->CanSelect())
			{
				m_pGameFrameWork->GetIItemSystem()->SetActorItem(GetActor(), m_stats.holsteredItemId, false);
			}
			else 
			{
				m_pGameFrameWork->GetIItemSystem()->SetActorItem(GetActor(), GetLastItem(), false);
			}
		}

		m_stats.holsteredItemId = 0;
	}
	else if (m_stats.currentItemId && (!m_stats.holsteredItemId || m_stats.holsteredItemId == m_stats.currentItemId))
	{
		m_stats.holsteredItemId = m_stats.currentItemId;
		m_pGameFrameWork->GetIItemSystem()->SetActorItem(GetActor(), (EntityId)0, false);
	}
}
开发者ID:NightOwlsEntertainment,项目名称:PetBox_A_Journey_to_Conquer_Elementary_Algebra,代码行数:29,代码来源:Inventory.cpp


示例4: GetActor

bool Client::Disconnect()
{
    // Make sure the advisor system knows this client is gone.
    if ( isAdvisor )
    {
        psserver->GetAdviceManager()->RemoveAdvisor( this->GetClientNum(), 0);
    }

    if (GetActor() && GetActor()->InGroup())
    {
        GetActor()->RemoveFromGroup();
    }

    // Only save if an account has been found for this client.
    if (accountID.IsValid())
    {
        SaveAccountData();
    }

    /*we have to clear the challenges else the other players will be stuck
     in challenge mode */
    if(GetDuelClientCount())
    {
        ClearAllDuelClients();
    }

    return true;
}
开发者ID:garinh,项目名称:planeshift,代码行数:28,代码来源:client.cpp


示例5: GetActor

void AIBrain::Update(float dt)
{
	if( _brainStateTable.size() == 0 )
	{
		GetActor()->InitializeBrain();
		GetActor()->StartBrain();
	}
	if( _current == _brainStateTable.end() )
		return;

	(*_current).second->Update(dt);

}
开发者ID:CmPons,项目名称:angel2d,代码行数:13,代码来源:Brain.cpp


示例6: ADD_MESSAGE

void unconsciousness::Terminate(bool Finished)
{
  if(Flags & TERMINATING)
    return;

  Flags |= TERMINATING;

  if(GetActor()->IsPlayer())
    ADD_MESSAGE("You wake up.");
  else if(GetActor()->CanBeSeenByPlayer())
    ADD_MESSAGE("%s wakes up.", GetActor()->CHAR_NAME(DEFINITE));

  action::Terminate(Finished);
}
开发者ID:harmonise,项目名称:ivan-f,代码行数:14,代码来源:actions.cpp


示例7: PickUp

//------------------------------------------------------------------
void CLam::PickUp(EntityId pickerId, bool sound, bool select, bool keepHistory, const char *setup)
{
    if(gEnv->bServer && m_lamparams.giveExtraAccessory)
    {
        CActor *pActor=GetActor(pickerId);
        if (pActor && pActor->IsPlayer())
        {
            IInventory *pInventory=GetActorInventory(pActor);
            if (pInventory)
            {
                if (!m_lamparams.isLamRifle	&& !pInventory->HasAccessory(CItem::sLAMFlashLight) && gEnv->bMultiplayer)
                    m_pItemSystem->GiveItem(pActor, m_lamparams.extraAccessoryName.c_str(), false, false, false);
                else if(m_lamparams.isLamRifle	&& !pInventory->HasAccessory(CItem::sLAMRifleFlashLight) && gEnv->bMultiplayer)
                    m_pItemSystem->GiveItem(pActor, m_lamparams.extraAccessoryName.c_str(), false, false, false);
            }
        }
    }

    //FIX-ME!!
    //Scout beam needs to go into the inventory like a normal item, not accessory
    static IEntityClass* pBeamClass = gEnv->pEntitySystem->GetClassRegistry()->FindClass("ScoutSearchBeam");

    if(GetEntity()->GetClass()==pBeamClass)
        CItem::PickUp(pickerId,sound,select,keepHistory,setup);
    else
        CAccessory::PickUp(pickerId,sound,select,keepHistory,setup);

}
开发者ID:j30206868,项目名称:NetWars_cpp,代码行数:29,代码来源:Lam.cpp


示例8: GetActor

//------------------------------------------------------------------------
int CScriptBind_Actor::SetInventoryAmmo(IFunctionHandler *pH, const char *ammo, int amount)
{
	CActor * pActor = GetActor(pH);
	if (!pActor)
		return pH->EndFunction();

	IInventory *pInventory=pActor->GetInventory();
	if (!pInventory)
		return pH->EndFunction();

	IEntityClass* pClass = gEnv->pEntitySystem->GetClassRegistry()->FindClass(ammo);
	assert(pClass);

	int capacity = pInventory->GetAmmoCapacity(pClass);
	int current = pInventory->GetAmmoCount(pClass);
	if((!gEnv->IsEditor()) && (amount > capacity))
	{
		//If still there's some place, full inventory to maximum...
		if(current<capacity)
		{
			pInventory->SetAmmoCount(pClass,capacity);
			if (gEnv->bServer)
				pActor->GetGameObject()->InvokeRMI(CActor::ClSetAmmo(), CActor::AmmoParams(ammo, amount), eRMI_ToRemoteClients);
		}
	}
	else
	{
		pInventory->SetAmmoCount(pClass, amount);
		if (gEnv->bServer)
			pActor->GetGameObject()->InvokeRMI(CActor::ClSetAmmo(), CActor::AmmoParams(ammo, amount), eRMI_ToRemoteClients);
	}

	return pH->EndFunction();
}
开发者ID:kitnet,项目名称:crynegine,代码行数:35,代码来源:ScriptBind_Actor.cpp


示例9: GetWeaponPos

//------------------------------------------------------------------------
bool CGunTurret::IsTargetShootable(IEntity *pTarget)
{
	// raycast shootability check
	Vec3 pos = m_fireHelper.empty() ? GetWeaponPos() : GetSlotHelperPos(eIGS_ThirdPerson, m_fireHelper.c_str(), true);
	Vec3 tpos = GetTargetPos(pTarget);
	Vec3 dir = tpos - pos;

	bool shootable = RayCheck(pTarget, pos, dir);

	if(!shootable)
	{
		// fallback for actors
		// todo: also use this for shooting pos!
		CActor *pActor = GetActor(pTarget->GetId());

		if(pActor && pActor->GetMovementController())
		{
			SMovementState state;
			pActor->GetMovementController()->GetMovementState(state);
			dir = state.eyePosition - pos;
			shootable = RayCheck(pTarget, pos, dir);
		}
	}

	return shootable;
}
开发者ID:super-nova,项目名称:NovaRepo,代码行数:27,代码来源:GunTurret.cpp


示例10: GetActor

bool CHeavyWeapon::CanUse(EntityId userId) const
{
#if USE_PC_PREMATCH
    if(CGameRules * pGameRules = g_pGame->GetGameRules())
        {
            if(pGameRules->GetPrematchState() != CGameRules::ePS_Match)
                {
                    return false;
                }
        }
#endif //USE_PC_PREMATCH

    EntityId ownerId = m_owner.GetId();

    if (ownerId == 0)
        {
            CActor* pActor = GetActor(userId);
            if (pActor && pActor->IsSwimming())
                return false;
            if (pActor && pActor->IsPlayer() && !pActor->IsSwimming())
                {
                    bool alreadyCarringHeavyWeapon = static_cast<CPlayer*>(pActor)->HasHeavyWeaponEquipped();
                    if (alreadyCarringHeavyWeapon)
                        return false;
                }
        }

    return m_sharedparams->params.usable && m_properties.usable;
}
开发者ID:eBunny,项目名称:EmberProject,代码行数:29,代码来源:HeavyWeapon.cpp


示例11: GetTargetClass

//------------------------------------------------------------------------
CGunTurret::ETargetClass CGunTurret::GetTargetClass(IEntity *pTarget)const
{
	IActor *pActor=GetActor(pTarget->GetId());

	if(!pActor)
	{
		if(IsTACBullet(pTarget))
			return eTC_TACProjectile;

		return eTC_NotATarget;
	}

	if(IsTargetDead(pActor))
		return eTC_NotATarget;

	if(!IsTargetHostile(pActor))
		return eTC_NotATarget;

	if(IsTargetSpectating(pActor))
		return eTC_NotATarget;

	bool vehicle = pActor->GetLinkedVehicle()!=0;

	//Vehicles only check
	if(m_turretparams.vehicles_only && !vehicle)
		return eTC_NotATarget;

	if(vehicle)
		return eTC_Vehicle;

	if(IsTargetCloaked(pActor))
		return eTC_NotATarget;

	return eTC_Player;
}
开发者ID:super-nova,项目名称:NovaRepo,代码行数:36,代码来源:GunTurret.cpp


示例12: ProcessEvent

	void ProcessEvent( EFlowEvent event, SActivationInfo *pActInfo )
	{
		if(eFE_Activate == event)
		{
			const bool bAttach = IsPortActive(pActInfo, EIP_ATTACH);
			const bool bDetach = IsPortActive(pActInfo, EIP_DETACH);
			if (!bAttach && !bDetach)
				return;

			IActor* pActor = GetActor(pActInfo);
			if (pActor == 0)
				return;

			const string& className = GetPortString(pActInfo, EIP_WEAPON);

			CWeapon* pWeapon = static_cast<CWeapon*> ( className.empty() ? GetWeapon(pActor) : GetWeapon(pActor, className.c_str()) );
			if (pWeapon != 0)
			{
				ItemString acc = ItemString(GetPortString(pActInfo, EIP_ACCESSORY));
				if (bAttach && pWeapon->GetAccessory(acc) == 0)
				{
					pWeapon->SwitchAccessory(acc);
					ActivateOutput(pActInfo, EOP_ATTACHED, true);
				}
				else if (bDetach && pWeapon->GetAccessory(acc) != 0)
				{
					pWeapon->SwitchAccessory(acc);
					ActivateOutput(pActInfo, EOP_DETACHED, true);
				}
			}
		}
	}
开发者ID:RenEvo,项目名称:dead6,代码行数:32,代码来源:WeaponNodes.cpp


示例13: GetEntity

//------------------------------------------------------------------------
bool CGunTurret::RayCheck(IEntity *pTarget, const Vec3 &pos, const Vec3 &dir) const
{
	ray_hit rayhit;
	IPhysicalEntity *pSkipEnts[1];
	pSkipEnts[0] = GetEntity()->GetPhysics();
	int nSkip = 1;
	//make sure you are not inside geometry when casting
	Vec3 newPos = pos + 0.3f*dir;

	if(gEnv->pPhysicalWorld->RayWorldIntersection(newPos, dir, ent_all, rwi_stop_at_pierceable|rwi_colltype_any, &rayhit, 1, pSkipEnts, nSkip))
	{
		if(rayhit.pCollider)
		{
			IEntity *pEntity = (IEntity *)rayhit.pCollider->GetForeignData(PHYS_FOREIGN_ID_ENTITY);

			if(pEntity==pTarget)
				return true;
			else if(CActor *pActor = GetActor(pTarget->GetId()))
			{
				IVehicle *pLinkedVehicle=pActor->GetLinkedVehicle();

				if(pLinkedVehicle && pLinkedVehicle->GetEntity()==pEntity)
					return true;
			}
		}

		return false;
	}

	return true;
}
开发者ID:super-nova,项目名称:NovaRepo,代码行数:32,代码来源:GunTurret.cpp


示例14: GetActor

bool CJaw::CanPickUp(EntityId userId) const
{
	CActor *pActor = GetActor(userId);
	IInventory *pInventory=GetActorInventory(pActor);

	if (m_sharedparams->params.pickable && m_stats.pickable && !m_stats.flying && (!m_owner.GetId() || m_owner.GetId()==userId) && !m_stats.selected && !GetEntity()->IsHidden())
	{
		if (pInventory && pInventory->FindItem(GetEntityId())!=-1)
			return false;
	}
	else
		return false;

	if(GetAmmoCount(m_fm->GetAmmoType())<=0)
	{
		return false;
	}

	uint8 uniqueId = m_pItemSystem->GetItemUniqueId(GetEntity()->GetClass()->GetName());

	int maxNumRockets = GetWeaponSharedParams()->ammoParams.capacityAmmo[0].count;

	if(pInventory && (pInventory->GetCountOfUniqueId(uniqueId)>=maxNumRockets))
	{
		if(pActor->IsClient())
		{
			SHUDEventWrapper::DisplayInfo(eInfo_Warning, 0.5f, "@mp_CannotCarryMoreLAW");
		}
		return false;
	}

	return true;
		
}
开发者ID:amrhead,项目名称:eaascode,代码行数:34,代码来源:JAW.cpp


示例15: GetActor

//------------------------------------------------------------------------
int CScriptBind_Actor::CheckVirtualInventoryRestrictions(IFunctionHandler *pH, SmartScriptTable inventory, const char *itemClassName)
{
	CActor *pActor = GetActor(pH);
	if (!pActor)
		return pH->EndFunction();

	static std::vector<string> virtualInventory;
	virtualInventory.reserve(inventory->Count());

	IScriptTable::Iterator it=inventory->BeginIteration();
	while(inventory->MoveNext(it))
	{
		const char *itemClass=0;
		it.value.CopyTo(itemClass);

		if (itemClass && itemClass[0])
			virtualInventory.push_back(itemClass);
	}

	inventory->EndIteration(it);

	bool result=pActor->CheckVirtualInventoryRestrictions(virtualInventory, itemClassName);
	virtualInventory.resize(0);

	if (result)
		return pH->EndFunction(1);

	return pH->EndFunction();
}
开发者ID:mrwonko,项目名称:CrysisVR,代码行数:30,代码来源:ScriptBind_Actor.cpp


示例16: GetActor

int NFCAsyMysqlClusterModule::ApplyRequest(NF_SHARE_PTR<SMysqlParam> pParam)
{
    NFIActorManager* pActorManager = pPluginManager->GetActorManager();
    if (NULL == pActorManager)
    {
        return -1;
    }

    int nAcotrID = GetActor();
    if (nAcotrID <= 0)
    {
        return -2;
    }

    std::string arg;
    const int nEvetID = ACOTERMYSQLEVENT_USEDB;

    if (!pParam->PackParam(arg))
    {
        return -3;
    }

    if (!mReqList.AddElement(pParam->nReqID, pParam))
    {
        return -4;
    }

    if (!pActorManager->SendMsgToActor(nAcotrID, pParam->self, nEvetID, arg))
    {
        mReqList.RemoveElement(pParam->nReqID);
        return -5;
    }

    return 0;
}
开发者ID:715703148,项目名称:NoahGameFrame,代码行数:35,代码来源:NFCAsyMysqlClusterModule.cpp


示例17: GetActor

//=========================================
bool CRocketLauncher::CanPickUp(EntityId userId) const
{
	CActor *pActor = GetActor(userId);
	IInventory *pInventory=GetActorInventory(pActor);

	if (m_sharedparams->params.pickable && m_stats.pickable && !m_stats.flying && !m_frozen &&(!m_ownerId || m_ownerId==userId) && !m_stats.selected && !GetEntity()->IsHidden())
	{
		if (pInventory && pInventory->FindItem(GetEntityId())!=-1)
			return false;
	}
	else
		return false;

	uint8 uniqueId = m_pItemSystem->GetItemUniqueId(GetEntity()->GetClass()->GetName());

	//Can not pick up a LAW while I have one already 
	if(pInventory && (pInventory->GetCountOfUniqueId(uniqueId)>0))
	{
		if(pActor->IsClient())
			g_pGame->GetGameRules()->OnTextMessage(eTextMessageCenter, "@mp_CannotCarryMoreLAW");
		return false;
	}

	return true;
		
}
开发者ID:nhnam,项目名称:Seasons,代码行数:27,代码来源:RocketLauncher.cpp


示例18: IMPLEMENT_RMI

// RMI receiver in the server to remove all items from the inventory. changes are automatically propagated to the clients
IMPLEMENT_RMI(CInventory, SvReq_RemoveAllItems)
{
  IItemSystem* pItemSystem = CCryAction::GetCryAction()->GetIItemSystem();
  
  IItem* pItem = pItemSystem->GetItem( GetCurrentItem() );
  if (pItem) 
  {
    pItem->Select(false);
    pItemSystem->SetActorItem( GetActor(), (EntityId)0, false );
  }

	Destroy();

	if (gEnv->bMultiplayer)
	{
		TRMIInventory_Dummy Info;
		GetGameObject()->InvokeRMI( Cl_RemoveAllAmmo(), Info, eRMI_ToAllClients);
	}
	else
	{
		ResetAmmo();
	}

	return true;
}
开发者ID:NightOwlsEntertainment,项目名称:PetBox_A_Journey_to_Conquer_Elementary_Algebra,代码行数:26,代码来源:Inventory.cpp


示例19: GetActor

bool CHeavyMountedWeapon::CanUse(EntityId userId) const
{
	EntityId ownerId = m_owner.GetId();

	if (m_rippedOff)
	{
		CActor* pActor = GetActor(userId);
		if (pActor && pActor->IsSwimming())
			return false;

		if (ownerId == 0 || ownerId == userId)
			return true;
	}
	else if(IActor* pActor = gEnv->pGame->GetIGameFramework()->GetIActorSystem()->GetActor(userId))
	{
		IItem* pItem = pActor->GetCurrentItem(false);
		if(pItem)
		{
			if(pItem->IsBusy())
			{
				return false;
			}
			if(IWeapon* pWeapon = pItem->GetIWeapon())
			{
				if(pWeapon->IsReloading())
				{
					return false;
				}
			}
		}
	}

	return BaseClass::CanUse(userId);
}
开发者ID:Xydrel,项目名称:Infected,代码行数:34,代码来源:HeavyMountedWeapon.cpp


示例20: GetActor

void WindowGlobalChild::HandleAsyncMessage(const nsString& aActorName,
                                           const nsString& aMessageName,
                                           StructuredCloneData& aData) {
  if (NS_WARN_IF(mIPCClosed)) {
    return;
  }

  // Force creation of the actor if it hasn't been created yet.
  IgnoredErrorResult rv;
  RefPtr<JSWindowActorChild> actor = GetActor(aActorName, rv);
  if (NS_WARN_IF(rv.Failed())) {
    return;
  }

  // Get the JSObject for the named actor.
  JS::RootedObject obj(RootingCx(), actor->GetWrapper());
  if (NS_WARN_IF(!obj)) {
    // If we don't have a preserved wrapper, there won't be any receiver
    // method to call.
    return;
  }

  RefPtr<JSWindowActorService> actorSvc = JSWindowActorService::GetSingleton();
  if (NS_WARN_IF(!actorSvc)) {
    return;
  }

  actorSvc->ReceiveMessage(actor, obj, aMessageName, aData);
}
开发者ID:jasonLaster,项目名称:gecko-dev,代码行数:29,代码来源:WindowGlobalChild.cpp



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


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
C++ GetActorForwardVector函数代码示例发布时间:2022-05-30
下一篇:
C++ GetActivity函数代码示例发布时间:2022-05-30
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap