class SetTimeDilationEffector extends Effector
{
	var m_owner : weak< GameObject >;
	var m_reason : CName;
	var m_easeInCurve : CName;
	var m_easeOutCurve : CName;
	var m_dilation : Float;
	var m_duration : Float;
	var m_affectsPlayer : Bool;

	protected override function Initialize( record : TweakDBID, game : GameInstance, parentRecord : TweakDBID )
	{
		m_reason = TDB.GetCName( record + T".reason" );
		m_dilation = TDB.GetFloat( record + T".dilation" );
		m_duration = TDB.GetFloat( record + T".duration" );
		m_easeInCurve = TDB.GetCName( record + T".easeInCurve" );
		m_easeOutCurve = TDB.GetCName( record + T".easeOutCurve" );
		m_affectsPlayer = TDB.GetBool( record + T".affectsPlayer" );
	}

	protected override function ActionOn( owner : GameObject )
	{
		var timeSystem : TimeSystem;
		if( timeSystem.IsTimeDilationActive() || ( m_duration == 0.0 ) )
		{
			return;
		}
		m_owner = owner;
		timeSystem = GameInstance.GetTimeSystem( m_owner.GetGame() );
		if( m_owner && timeSystem )
		{
			if( !( m_affectsPlayer ) )
			{
				timeSystem.SetIgnoreTimeDilationOnLocalPlayerZero( true );
			}
			timeSystem.SetTimeDilation( m_reason, m_dilation, m_duration, m_easeInCurve, m_easeOutCurve );
		}
	}

	protected override function ActionOff( owner : GameObject )
	{
		var timeSystem : TimeSystem;
		if( m_owner && ( m_duration > 0.0 ) )
		{
			timeSystem = GameInstance.GetTimeSystem( m_owner.GetGame() );
			if( timeSystem )
			{
				timeSystem.UnsetTimeDilation( m_reason, ( ( m_reason == 'berserk' ) ? ( '' ) : ( m_easeOutCurve ) ) );
			}
		}
	}

}

