class TriggerContinuousAttackEffector extends ContinuousEffector
{
	var m_owner : weak< GameObject >;
	var m_attackTDBID : TweakDBID;
	var m_attack : Attack_GameEffect;
	var m_delayTime : Float;
	var m_timeDilationDriver : gamedataEffectorTimeDilationDriver;

	protected export override function Initialize( record : TweakDBID, game : GameInstance, parentRecord : TweakDBID )
	{
		var effectorRecord : ContinuousAttackEffector_Record;
		effectorRecord = TweakDBInterface.GetContinuousAttackEffectorRecord( record );
		m_attackTDBID = effectorRecord.AttackRecord().GetID();
		m_delayTime = effectorRecord.DelayTime();
		m_timeDilationDriver = effectorRecord.TimeDilationDriver().Type();
	}

	protected export override function Uninitialize( game : GameInstance )
	{
		if( m_attack )
		{
			m_attack.StopAttack();
			m_attack = NULL;
		}
	}

	protected export override function ContinuousAction( owner : GameObject, instigator : GameObject )
	{
		var i : Int32;
		var tempArr : array< String >;
		var flag : SHitFlag;
		var hitFlags : array< SHitFlag >;
		var sourceObject : weak< GameObject >;
		if( !( m_attack ) )
		{
			tempArr = TweakDBInterface.GetAttackRecord( m_attackTDBID ).HitFlags();
			for( i = 0; i < tempArr.Size(); i += 1 )
			{
				flag.flag = ( ( hitFlag )( ( ( Int32 )( EnumValueFromString( "hitFlag", tempArr[ i ] ) ) ) ) );
				flag.source = 'Attack';
				hitFlags.PushBack( flag );
			}
			sourceObject = instigator;
			m_attack = RPGManager.PrepareGameEffectAttack( owner.GetGame(), instigator, sourceObject, m_attackTDBID, owner.GetWorldPosition(), hitFlags, owner, m_delayTime );
			switch( m_timeDilationDriver )
			{
				case gamedataEffectorTimeDilationDriver.Source:
					m_attack.OverrideTimeDilationDriver( ( ( TimeDilatable )( instigator ) ) );
				break;
				case gamedataEffectorTimeDilationDriver.Target:
					m_attack.OverrideTimeDilationDriver( ( ( TimeDilatable )( owner ) ) );
				break;
				default:
					m_attack.OverrideTimeDilationDriver( NULL );
				break;
			}
			m_attack.StartAttackContinous();
		}
		else
		{
			m_attack.SetAttackPosition( owner.GetWorldPosition() );
		}
	}

}

