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


C++ GetActor函数代码示例

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


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


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