class AttachCapsuleVisionBlockerEffector extends Effector
{
	private var m_visionBlockerRegistrar : VisionBlockersRegistrar;
	private var m_visionBlockerType : EVisionBlockerType;
	private var m_visionBlockerId : Uint32;
	private var m_visionBlockerOffset : Vector3;
	private var m_visionBlockerRadius : Float;
	private var m_visionBlockerHeight : Float;
	private var m_visionBlockerDetectionModifier : Float;
	private var m_visionBlockerTBHModifier : Float;
	private var m_isBlockingCompletely : Bool;
	private var m_blocksParent : Bool;

	protected override function Initialize( record : TweakDBID, game : GameInstance, parentRecord : TweakDBID )
	{
		var visionBlockerTypeName : CName;
		visionBlockerTypeName = TweakDBInterface.GetCName( record + T".visionBlockerTypeName", '' );
		m_visionBlockerType = ( ( EVisionBlockerType )( ( ( Int32 )( EnumValueFromName( 'EVisionBlockerType', visionBlockerTypeName ) ) ) ) );
		m_visionBlockerOffset = TweakDBInterface.GetVector3( record + T".visionBlockerOffset", Vector3() );
		m_visionBlockerRadius = TweakDBInterface.GetFloat( record + T".visionBlockerRadius", 0.0 );
		m_visionBlockerHeight = TweakDBInterface.GetFloat( record + T".visionBlockerHeight", 0.0 );
		m_visionBlockerDetectionModifier = TweakDBInterface.GetFloat( record + T".visionBlockerDetectionModifier", 1.0 );
		m_visionBlockerTBHModifier = TweakDBInterface.GetFloat( record + T".visionBlockerTBHModifier", 1.0 );
		m_isBlockingCompletely = TweakDBInterface.GetBool( record + T".isBlockingCompletely", false );
		m_blocksParent = TweakDBInterface.GetBool( record + T".blocksParent", true );
		m_visionBlockerId = GetInvalidVisionBlockerID();
		m_visionBlockerRegistrar = GameInstance.GetSenseManager( game ).GetVisionBlockersRegistrar();
	}

	protected override function ActionOn( owner : GameObject )
	{
		var visionBlockerShape : VisionBlockerShape_BasicCapsule;
		visionBlockerShape = VisionBlockerShape_BasicCapsule.Create( owner.GetWorldPosition(), m_visionBlockerRadius, m_visionBlockerHeight );
		m_visionBlockerId = m_visionBlockerRegistrar.RegisterVisionBlocker( visionBlockerShape, m_visionBlockerType, m_visionBlockerDetectionModifier, m_visionBlockerTBHModifier, m_isBlockingCompletely, m_blocksParent );
		m_visionBlockerRegistrar.AttachToParent( m_visionBlockerId, owner, Vector4.Vector3To4( m_visionBlockerOffset ) );
	}

	protected override function ActionOff( owner : GameObject )
	{
		UnregisterVisionBlocker();
	}

	protected override function Uninitialize( game : GameInstance )
	{
		UnregisterVisionBlocker();
	}

	private function UnregisterVisionBlocker()
	{
		m_visionBlockerRegistrar.UnregisterVisionBlocker( m_visionBlockerId );
	}

	public function SetBlockingCompletely( blockingCompletely : Bool )
	{
		m_isBlockingCompletely = blockingCompletely;
		m_visionBlockerRegistrar.SetIsBlockingCompletely( m_visionBlockerId, blockingCompletely );
	}

}

class AttachOpticalCamoVisionBlockerEffector extends AttachCapsuleVisionBlockerEffector
{
}

