class ApplyEffectorEffector extends Effector
{
	var m_target : EntityID;
	var m_applicationTarget : CName;
	var m_effectorToApply : TweakDBID;

	protected export override function Initialize( record : TweakDBID, game : GameInstance, parentRecord : TweakDBID )
	{
		m_effectorToApply = TweakDBInterface.GetApplyEffectorEffectorRecord( record ).EffectorToApply().GetID();
		m_applicationTarget = TweakDBInterface.GetCName( record + T".applicationTarget", '' );
	}

	protected export override function ActionOn( owner : GameObject )
	{
		var es : EffectorSystem;
		if( !( GetApplicationTarget( owner, m_applicationTarget, m_target ) ) )
		{
			return;
		}
		es = GameInstance.GetEffectorSystem( owner.GetGame() );
		es.ApplyEffector( m_target, owner, m_effectorToApply );
	}

	protected export override function ActionOff( owner : GameObject )
	{
		Uninitialize( owner.GetGame() );
	}

	protected export override function Uninitialize( game : GameInstance )
	{
		var es : EffectorSystem;
		if( !( EntityID.IsDefined( m_target ) ) )
		{
			return;
		}
		es = GameInstance.GetEffectorSystem( game );
		es.RemoveEffector( m_target, m_effectorToApply );
	}

}

