class AOEEffector extends ActivatedDeviceTransfromAnim
{

	protected event OnRequestComponents( ri : EntityRequestComponentsInterface )
	{
		super.OnRequestComponents( ri );
	}

	protected event OnTakeControl( ri : EntityResolveComponentsInterface )
	{
		super.OnTakeControl( ri );
		m_controller = ( ( AOEEffectorController )( EntityResolveComponentsInterface.GetComponent( ri, 'controller' ) ) );
	}

	protected event OnGameAttached()
	{
		super.OnGameAttached();
		if( GetDeviceState() == EDeviceStatus.ON )
		{
			StartEffects();
		}
		else
		{
			BreakEffects();
		}
	}

	protected const override function GetController() : AOEEffectorController
	{
		return ( ( AOEEffectorController )( m_controller ) );
	}

	public const override function GetDevicePS() : AOEEffectorControllerPS
	{
		return GetController().GetPS();
	}

	protected override function PushPersistentData()
	{
		super.PushPersistentData();
	}

	protected event OnToggleAOEEffect( evt : ToggleAOEEffect )
	{
		if( GetDeviceState() == EDeviceStatus.ON )
		{
			StartEffects();
		}
		else
		{
			BreakEffects();
		}
		SetGameplayRoleToNone();
	}

	protected function StartEffects()
	{
		var effects : array< CName >;
		var i : Int32;
		effects = GetDevicePS().GetEffectsToPlay();
		for( i = 0; i < effects.Size(); i += 1 )
		{
			StartReplicatedEffectEvent( this, effects[ i ] );
		}
	}

	protected function BreakEffects()
	{
		var effects : array< CName >;
		var i : Int32;
		effects = GetDevicePS().GetEffectsToPlay();
		for( i = 0; i < effects.Size(); i += 1 )
		{
			BreakReplicatedEffectLoopEvent( this, effects[ i ] );
		}
	}

	public const override function DeterminGameplayRole() : EGameplayRole
	{
		return EGameplayRole.SpreadGas;
	}

	public const override function IsGameplayRelevant() : Bool
	{
		return true;
	}

}

