//------------------------------------------------------------------------- void CLam::AttachLAMLaser(bool attach, eGeometrySlot slot) { if(slot==eIGS_ThirdPerson) { if(attach) { CreateLaserEntity(); SetLaserGeometry(m_lamparams.laser_geometry_tp); UpdateLaserScale(1.0f,m_pEntitySystem->GetEntity(m_pLaserEntityId)); m_lastLaserHitPt.Set(0,0,0); m_lastLaserHitSolid = false; CreateLaserDot(m_lamparams.laser_dot[slot],slot); } else { DestroyLaserEntity(); } } else if(slot==eIGS_FirstPerson) { if(attach) { CreateLaserEntity(); CreateLaserDot(m_lamparams.laser_dot[slot],slot); } else { DestroyLaserEntity(); } } }
CLaserBeam::~CLaserBeam() { DestroyLaserEntity(); if (m_queuedRayId != 0) { g_pGame->GetRayCaster().Cancel(m_queuedRayId); m_queuedRayId = 0; } }
//------------------------------------------------------------------------- void CLam::Reset() { CAccessory::Reset(); ActivateLight(false); ActivateLaser(false); m_lightWasOn = false; m_laserWasOn = false; m_lastLaserHitPt.Set(0,0,0); m_lastLaserHitSolid = false; m_smoothLaserLength = -1.0f; m_allowUpdate = false; m_updateTime = 0.0f; DestroyLaserEntity(); m_laserHelperFP.clear(); }
//------------------------------------------------------------------ void CLam::FullSerialize(TSerialize ser) { CAccessory::FullSerialize(ser); if(ser.IsReading()) { ActivateLight(false); ActivateLaser(false); m_lastLaserHitPt.Set(0,0,0); m_lastLaserHitSolid = false; m_smoothLaserLength = -1.0f; DestroyLaserEntity(); m_laserHelperFP.clear(); m_allowUpdate = false; m_updateTime = 0.0f; } m_laserActiveSerialize = m_laserActivated; ser.Value("laserActivated", m_laserActiveSerialize); m_lightActiveSerialize = m_lightActivated; ser.Value("lightActivated", m_lightActiveSerialize); }