Пример #1
0
//------------------------------------------------------------------------
void CParachute::Close(bool drop/*=false*/)
{
    // not used any more
    return;

    CryLog("Closing Parachute..");

    if (m_actorId)
    {
        IEntity* pEnt = m_pEntitySystem->GetEntity(m_actorId);
        if (pEnt && pEnt->GetParent()->GetId() == m_canvasId)
        {
            pEnt->DetachThis();
        }
        m_actorId = 0;
    }

    CActor* pActor = GetOwnerActor();
    if (pActor)
    {
        pActor->LinkToVehicle(0);
        if (IsOpened())
        {
            if (drop)
                pActor->DropItem(GetEntity()->GetId(), 1.0f, false);
        }
    }

    m_isOpened = false;
}
Пример #2
0
//------------------------------------------------------------------------
void CVehiclePartEntityAttachment::DetachAttachment()
{
	if (m_attachmentId)
		m_pVehicle->SetObjectUpdate(this, IVehicle::eVOU_NoUpdate);

	IEntity* pEntity = GetAttachmentEntity();

	if (pEntity)
	{
		pEntity->DetachThis();
	}

	m_attachmentId = 0;
}
void CLaserBeam::SetLaserEntitySlots(bool freeSlots)
{
	if(m_pLaserParams)
	{
		IEntity* pLaserEntity = GetLaserEntity();
		if(pLaserEntity)
		{
			if(freeSlots)
			{
				if(m_laserDotSlot != -1)
					pLaserEntity->FreeSlot(m_laserDotSlot);
				if(m_laserGeometrySlot != -1)
					pLaserEntity->FreeSlot(m_laserGeometrySlot);

				m_laserDotSlot = m_laserGeometrySlot = -1;

				pLaserEntity->DetachThis();

				if(m_usingEntityAttachment)
				{
					if(IAttachmentManager* pAttachmentManager = GetLaserCharacterAttachmentManager())
					{
						if(IAttachment* pAttachment = pAttachmentManager->GetInterfaceByName(LASER_ATTACH_NAME))
						{
							pAttachment->ClearBinding();
						}
					}
				}
			}
			else
			{
				m_laserGeometrySlot = pLaserEntity->LoadGeometry(-1, m_pLaserParams->laser_geometry_tp.c_str());
				pLaserEntity->SetSlotFlags(m_laserGeometrySlot, pLaserEntity->GetSlotFlags(m_laserGeometrySlot)|ENTITY_SLOT_RENDER);
				if (m_pLaserParams->show_dot)
				{
					IParticleEffect* pEffect = gEnv->pParticleManager->FindEffect(m_pLaserParams->laser_dot[GetIndexFromGeometrySlot()].c_str());
					if(pEffect)
						m_laserDotSlot = pLaserEntity->LoadParticleEmitter(-1,pEffect);
				}

				FixAttachment(pLaserEntity);
			}
		}
	}
	else
	{
		GameWarning("LASER PARAMS: Item of type CLaser is missing it's laser params!");
	}
}