class CrosshairGameController_Smart_Rifl extends gameuiCrosshairBaseGameController
{
	protected editable var m_txtAccuracy : inkTextRef;
	protected editable var m_txtTargetsCount : inkTextRef;
	protected editable var m_txtFluffStatus : inkTextRef;
	protected editable var m_leftPart : inkImageRef;
	protected editable var m_rightPart : inkImageRef;
	protected editable var m_leftPartExtra : inkImageRef;
	protected editable var m_rightPartExtra : inkImageRef;
	private var offsetLeftRight : Float;
	default offsetLeftRight = .8;
	private var offsetLeftRightExtra : Float;
	default offsetLeftRightExtra = 1.2;
	private var latchVertical : Float;
	default latchVertical = 40.0;
	protected editable var m_topPart : inkImageRef;
	protected editable var m_bottomPart : inkImageRef;
	protected editable var m_horiPart : inkWidgetRef;
	protected editable var m_vertPart : inkWidgetRef;
	protected editable var m_targetWidgetLibraryName : CName;
	default m_targetWidgetLibraryName = 'bucket';
	protected editable var m_targetsPullSize : Int32;
	default m_targetsPullSize = 10;
	protected editable var m_targetColorChange : inkWidgetRef;
	protected editable var m_targetingFrame : inkWidgetRef;
	protected editable var m_reticleFrame : inkWidgetRef;
	protected editable var m_bufferFrame : inkWidgetRef;
	protected editable var m_targetHolder : inkCompoundRef;
	protected editable var m_lockHolder : inkCompoundRef;
	protected editable var m_reloadIndicator : inkCompoundRef;
	protected editable var m_reloadIndicatorInv : inkCompoundRef;
	protected editable var m_smartLinkDot : inkCompoundRef;
	protected editable var m_smartLinkFrame : inkCompoundRef;
	protected editable var m_smartLinkFluff : inkCompoundRef;
	protected editable var m_smartLinkFirmwareOnline : inkCompoundRef;
	protected editable var m_smartLinkFirmwareOffline : inkCompoundRef;
	private var m_hasSmartLink : Bool;
	private var m_weaponBlackboard : weak< IBlackboard >;
	private var m_weaponParamsListenerId : CallbackHandle;
	private var m_smartData : smartGunUIParameters;
	private var m_targetsPool : array< weak< inkWidget > >;
	private var m_targets : array< weak< inkWidget > >;
	private var m_isBlocked : Bool;
	private var m_isAimDownSights : Bool;
	private var m_bufferedSpread : Vector2;
	private var m_reloadAnimationProxy : inkAnimProxy;
	var m_prevTargetedEntityIDs : array< EntityID >;
	var m_currTargetedEntityIDs : array< EntityID >;
	var m_numLockedTargets : Int32;
	private var m_playerDevelopmentData : weak< PlayerDevelopmentData >;

	protected event OnInitialize()
	{
		super.OnInitialize();
		SetupLayout();
	}

	protected event OnPlayerAttach( playerPuppet : GameObject )
	{
		super.OnPlayerAttach( playerPuppet );
		m_playerDevelopmentData = PlayerDevelopmentSystem.GetData( playerPuppet );
	}

	protected event OnPreIntro()
	{
		m_weaponBlackboard = GetBlackboardSystem().Get( GetAllBlackboardDefs().UI_ActiveWeaponData );
		m_weaponParamsListenerId = m_weaponBlackboard.RegisterDelayedListenerVariant( GetAllBlackboardDefs().UI_ActiveWeaponData.SmartGunParams, this, 'OnSmartGunParams' );
		super.OnPreIntro();
	}

	protected event OnPreOutro()
	{
		m_weaponBlackboard.UnregisterDelayedListener( GetAllBlackboardDefs().UI_ActiveWeaponData.SmartGunParams, m_weaponParamsListenerId );
		super.OnPreOutro();
	}

	private function SetupLayout()
	{
		var newTarget : weak< inkWidget >;
		var i : Int32;
		for( i = 0; i < m_targetsPullSize; i += 1 )
		{
			newTarget = SpawnFromLocal( inkCompoundRef.Get( m_targetHolder ), m_targetWidgetLibraryName );
			newTarget.SetVisible( false );
			m_targetsPool.PushBack( newTarget );
		}
		inkCompoundRef.SetVisible( m_reloadIndicator, false );
		inkCompoundRef.SetVisible( m_reloadIndicatorInv, true );
	}

	protected event OnSmartGunParams( argParams : Variant )
	{
		var smartData : smartGunUIParameters;
		var bufferValue : Vector2;
		var targetableRegionSize : Vector2;
		var reticleSize : Vector2;
		var shouldIgnoreUI : Bool;
		shouldIgnoreUI = GameInstance.GetStatsSystem( GetGame() ).GetStatBoolValue( GetWeaponItemObject().GetEntityID(), gamedataStatType.ShouldIgnoreSmartUI );
		if( !( shouldIgnoreUI ) )
		{
			smartData = ( ( smartGunUIParameters )argParams );
			targetableRegionSize = smartData.sight.targetableRegionSize;
			reticleSize = smartData.sight.reticleSize;
			CheckIfRectangleNeedsToBeResized( targetableRegionSize, reticleSize );
			inkWidgetRef.SetSize( m_targetingFrame, targetableRegionSize );
			inkWidgetRef.SetSize( m_reticleFrame, reticleSize );
			bufferValue.Y = ( targetableRegionSize.Y - reticleSize.Y ) / 2.0;
			inkWidgetRef.SetSize( m_bufferFrame, 100.0, bufferValue.Y );
			m_hasSmartLink = smartData.hasRequiredCyberware;
			inkCompoundRef.SetVisible( m_smartLinkDot, false );
			inkCompoundRef.SetVisible( m_smartLinkFrame, true );
			inkCompoundRef.SetVisible( m_smartLinkFluff, true );
			inkCompoundRef.SetVisible( m_smartLinkFirmwareOffline, !( m_hasSmartLink ) );
			inkCompoundRef.SetVisible( m_smartLinkFirmwareOnline, m_hasSmartLink );
			ProcessParams( smartData );
		}
		else
		{
			inkCompoundRef.SetVisible( m_smartLinkFirmwareOffline, true );
			inkCompoundRef.SetVisible( m_smartLinkFirmwareOnline, false );
			ReturnAllTargetsToPool();
		}
	}

	public function CheckIfRectangleNeedsToBeResized( out targetableRegionSize : Vector2, out reticleSize : Vector2 )
	{
		var smartGunTargetingRectangleSizeIncrease : Float;
		smartGunTargetingRectangleSizeIncrease = GameInstance.GetStatsSystem( GetGame() ).GetStatValue( m_playerPuppet.GetEntityID(), gamedataStatType.SmartGunTargetingRectangleSizeIncrease );
		if( smartGunTargetingRectangleSizeIncrease > 0.0 )
		{
			targetableRegionSize.X *= ( 1.0 + ( smartGunTargetingRectangleSizeIncrease / 100.0 ) );
			targetableRegionSize.Y *= ( 1.0 + ( smartGunTargetingRectangleSizeIncrease / 100.0 ) );
			reticleSize.X *= ( 1.0 + ( smartGunTargetingRectangleSizeIncrease / 100.0 ) );
			reticleSize.Y *= ( 1.0 + ( smartGunTargetingRectangleSizeIncrease / 100.0 ) );
		}
	}

	public function ProcessParams( smartData : smartGunUIParameters )
	{
		var i, count : Int32;
		var targetData : smartGunUITargetParameters;
		var newTargets : array< weak< inkWidget > >;
		m_smartData = smartData;
		m_numLockedTargets = 0;
		m_prevTargetedEntityIDs = m_currTargetedEntityIDs;
		m_currTargetedEntityIDs.Clear();
		count = m_smartData.targets.Size();
		for( i = 0; i < count; i += 1 )
		{
			targetData = m_smartData.targets[ i ];
			if( !( LookupCurrentTargets( targetData, newTargets ) ) )
			{
				AllocateNewTarget( targetData, newTargets );
			}
		}
		m_smartData = NULL;
		ReturnAllTargetsToPool();
		if( newTargets.Size() )
		{
			m_targets = newTargets;
		}
	}

	public function LookupCurrentTargets( const data : ref< smartGunUITargetParameters >, newTargets : ref< array< weak< inkWidget > > > ) : Bool
	{
		var i, count : Int32;
		var currWidget : weak< inkWidget >;
		var currController : weak< Crosshair_Smart_Rifl_Bucket >;
		count = m_targets.Size();
		for( i = 0; i < count; i += 1 )
		{
			currWidget = ( ( inkWidget )( m_targets[ i ] ) );
			currController = ( ( Crosshair_Smart_Rifl_Bucket )( currWidget.GetController() ) );
			if( currController.MatchData( data ) )
			{
				m_targets.EraseFast( i );
				newTargets.PushBack( currWidget );
				ProcessData( data, currWidget, currController );
				return true;
			}
		}
		return false;
	}

	public override function HandleDeadEye()
	{
		var animOptions : inkAnimOptions;
		var i, count : Int32;
		var currWidget : weak< inkWidget >;
		var currController : weak< Crosshair_Smart_Rifl_Bucket >;
		var newHasDeadEye : Bool;
		newHasDeadEye = StatusEffectSystem.ObjectHasStatusEffectWithTag( m_playerPuppet, 'DeadeyeSE' );
		if( m_hasDeadEye == newHasDeadEye )
		{
			return;
		}
		m_hasDeadEye = newHasDeadEye;
		if( m_hasSmartLink )
		{
			count = m_targets.Size();
			for( i = 0; i < count; i += 1 )
			{
				currWidget = ( ( inkWidget )( m_targets[ i ] ) );
				currController = ( ( Crosshair_Smart_Rifl_Bucket )( currWidget.GetController() ) );
				currController.HandleDeadEyeInTargetBrackets( m_hasDeadEye );
			}
		}
		else
		{
			if( !( m_hasDeadEye ) )
			{
				animOptions.customTimeDilation = 2.0;
				animOptions.applyCustomTimeDilation = true;
				animOptions.playReversed = true;
				m_deadEyeAnimProxy = PlayLibraryAnimation( 'deadeye_anim', animOptions );
				if( ( m_deadEyeAnimProxy && m_deadEyeAnimProxy.IsValid() ) && m_deadEyeAnimProxy.IsPlaying() )
				{
					m_deadEyeAnimProxy.RegisterToCallback( inkanimEventType.OnFinish, this, 'OnDeadEyeAnimFinished' );
				}
				else
				{
					inkWidgetRef.SetVisible( m_deadEyeWidget, false );
				}
			}
			else
			{
				animOptions.customTimeDilation = 1.5;
				animOptions.applyCustomTimeDilation = true;
				animOptions.playReversed = false;
				inkWidgetRef.SetVisible( m_deadEyeWidget, true );
				m_deadEyeAnimProxy = PlayLibraryAnimation( 'deadeye_anim', animOptions );
			}
		}
	}

	protected event OnDeadEyeAnimFinished( anim : inkAnimProxy )
	{
		inkWidgetRef.SetVisible( m_deadEyeWidget, false );
	}

	public function AllocateNewTarget( const data : ref< smartGunUITargetParameters >, newTargets : ref< array< weak< inkWidget > > > )
	{
		var currWidget : weak< inkWidget >;
		var currController : weak< Crosshair_Smart_Rifl_Bucket >;
		currWidget = m_targetsPool.PopBack();
		currController = ( ( Crosshair_Smart_Rifl_Bucket )( currWidget.GetController() ) );
		newTargets.PushBack( currWidget );
		ProcessData( data, currWidget, currController );
	}

	public function ProcessData( const data : ref< smartGunUITargetParameters >, currWidget : weak< inkWidget >, currController : weak< Crosshair_Smart_Rifl_Bucket > )
	{
		currWidget.SetVisible( true );
		currWidget.SetMargin( inkMargin( data.pos.X * 0.5, data.pos.Y * 0.5, 0.0, 0.0 ) );
		if( data.state == gamesmartGunTargetState.Locked || data.state == gamesmartGunTargetState.Unlocking )
		{
			currWidget.Reparent( ( ( inkCompoundWidget )( inkCompoundRef.Get( m_lockHolder ) ) ) );
		}
		else
		{
			currWidget.Reparent( ( ( inkCompoundWidget )( inkCompoundRef.Get( m_targetHolder ) ) ) );
		}
		currController.SetData( data, m_smartData, m_playerPuppet, m_hasDeadEye );
		if( data.state == gamesmartGunTargetState.Locked && !( m_currTargetedEntityIDs.Contains( data.entityID ) ) )
		{
			m_currTargetedEntityIDs.PushBack( data.entityID );
			if( !( m_prevTargetedEntityIDs.Contains( data.entityID ) ) )
			{
				m_numLockedTargets = m_numLockedTargets + 1;
			}
		}
	}

	public function ReturnAllTargetsToPool()
	{
		var i, count : Int32;
		var currWidget : weak< inkWidget >;
		var currController : weak< Crosshair_Smart_Rifl_Bucket >;
		count = m_targets.Size();
		for( i = 0; i < count; i += 1 )
		{
			currWidget = ( ( inkWidget )( m_targets[ i ] ) );
			currController = ( ( Crosshair_Smart_Rifl_Bucket )( currWidget.GetController() ) );
			currWidget.SetVisible( false );
			currController.ResetData( m_playerPuppet );
			m_targetsPool.PushBack( currWidget );
		}
		m_targets.Clear();
	}

	protected override function ApplyCrosshairGUIState( state : CName, aimedAtEntity : Entity )
	{
		inkWidgetRef.SetState( m_targetColorChange, state );
	}

	public export override function GetIntroAnimation( firstEquip : Bool ) : inkAnimProxy
	{
		var anim : inkAnimDef;
		var alphaInterpolator : inkAnimTransparency;
		anim = new inkAnimDef;
		alphaInterpolator = new inkAnimTransparency;
		alphaInterpolator.SetStartTransparency( 0.0 );
		alphaInterpolator.SetEndTransparency( 1.0 );
		alphaInterpolator.SetDuration( 0.25 );
		alphaInterpolator.SetType( inkanimInterpolationType.Linear );
		alphaInterpolator.SetMode( inkanimInterpolationMode.EasyIn );
		anim.AddInterpolator( alphaInterpolator );
		return m_rootWidget.PlayAnimation( anim );
	}

	public export override function GetOutroAnimation() : inkAnimProxy
	{
		var anim : inkAnimDef;
		var alphaInterpolator : inkAnimTransparency;
		anim = new inkAnimDef;
		alphaInterpolator = new inkAnimTransparency;
		alphaInterpolator.SetStartTransparency( 1.0 );
		alphaInterpolator.SetEndTransparency( 0.0 );
		alphaInterpolator.SetDuration( 0.25 );
		alphaInterpolator.SetType( inkanimInterpolationType.Linear );
		alphaInterpolator.SetMode( inkanimInterpolationMode.EasyIn );
		anim.AddInterpolator( alphaInterpolator );
		return m_rootWidget.PlayAnimation( anim );
	}

	protected override function OnCrosshairStateChange( oldState : gamePSMCrosshairStates, newState : gamePSMCrosshairStates )
	{
		var playbackOptions : inkAnimOptions;
		super.OnCrosshairStateChange( oldState, newState );
		if( newState == gamePSMCrosshairStates.Reload )
		{
			playbackOptions.loopInfinite = true;
			playbackOptions.loopType = inkanimLoopType.Cycle;
			m_reloadAnimationProxy = PlayLibraryAnimation( 'reloading', playbackOptions );
			inkCompoundRef.SetVisible( m_reloadIndicator, true );
			inkCompoundRef.SetVisible( m_reloadIndicatorInv, false );
		}
		else if( m_reloadAnimationProxy )
		{
			inkCompoundRef.SetVisible( m_reloadIndicator, false );
			inkCompoundRef.SetVisible( m_reloadIndicatorInv, true );
			m_reloadAnimationProxy.Stop();
			m_reloadAnimationProxy = NULL;
		}
	}

	protected event OnBulletSpreadChanged( spread : Vector2 )
	{
		super.OnBulletSpreadChanged( spread );
		m_bufferedSpread = spread;
		inkImageRef.SetMargin( m_leftPart, inkMargin( -( spread.X ) * offsetLeftRight, 0.0, 0.0, 0.0 ) );
		inkImageRef.SetMargin( m_rightPart, inkMargin( spread.X * offsetLeftRight, 0.0, 0.0, 0.0 ) );
		inkImageRef.SetMargin( m_leftPartExtra, inkMargin( -( spread.X ) / 2.0, 0.0, 0.0, 0.0 ) );
		inkImageRef.SetMargin( m_rightPartExtra, inkMargin( spread.X / 2.0, 0.0, 0.0, 0.0 ) );
		inkWidgetRef.SetSize( m_vertPart, 3.0, ( spread.Y * 2.0 ) + latchVertical );
		inkWidgetRef.SetSize( m_horiPart, spread.X, 3.0 );
		inkImageRef.SetMargin( m_topPart, inkMargin( 0.0, -( spread.Y ), 0.0, 0.0 ) );
		inkImageRef.SetMargin( m_bottomPart, inkMargin( 0.0, spread.Y, 0.0, 0.0 ) );
	}

	protected override function OnState_HipFire()
	{
		super.OnState_HipFire();
		m_isAimDownSights = false;
		m_isBlocked = false;
	}

	protected override function OnState_Aim()
	{
		m_isAimDownSights = true;
		m_isBlocked = false;
	}

	protected override function OnState_Reload()
	{
		super.OnState_Reload();
		m_isBlocked = true;
	}

	protected override function OnState_Sprint()
	{
		super.OnState_Sprint();
		m_isBlocked = true;
	}

	protected override function OnState_GrenadeCharging()
	{
		super.OnState_GrenadeCharging();
		m_isBlocked = true;
	}

	protected override function OnState_Scanning()
	{
		super.OnState_Scanning();
		m_isBlocked = true;
	}

	protected override function OnState_Safe()
	{
		super.OnState_Safe();
		m_isBlocked = true;
	}

}

class DelayedSmartGunUISoundClue extends DelayCallback
{
	private var m_puppet : weak< GameObject >;
	private var m_audioEventName : CName;

	public static function Create( puppet : GameObject, audioEventName : CName ) : DelayedSmartGunUISoundClue
	{
		var callback : DelayedSmartGunUISoundClue;
		callback = new DelayedSmartGunUISoundClue;
		callback.m_puppet = puppet;
		callback.m_audioEventName = audioEventName;
		return callback;
	}

	public override function Call()
	{
		GameObject.PlaySound( m_puppet, m_audioEventName );
	}

}

class Crosshair_Smart_Rifl_Bucket extends inkLogicController
{
	editable var m_lockingAnimationLength : Float;
	default m_lockingAnimationLength = 1.0f;
	editable var m_unlockingAnimationLength : Float;
	default m_unlockingAnimationLength = 1.0f;
	editable var m_deadEyeWidget : inkWidgetRef;
	var m_data : smartGunUITargetParameters;
	var m_lockingAnimationProxy : inkAnimProxy;
	var m_unlockingAnimationProxy : inkAnimProxy;
	var m_activeCallbacks : array< DelayID >;
	var m_hasDeadEye : Bool;
	var m_deadEyeAnimProxy : inkAnimProxy;

	protected event OnInitialize() {}

	public function MatchData( const data : ref< smartGunUITargetParameters > ) : Bool
	{
		return ( m_data.entityID == data.entityID ) && m_data.attachedBoneName == data.attachedBoneName;
	}

	public function ResetData( playerPuppet : GameObject )
	{
		if( m_lockingAnimationProxy )
		{
			m_lockingAnimationProxy.GotoStartAndStop();
			m_lockingAnimationProxy = NULL;
			ClearCallbacks( GameInstance.GetDelaySystem( playerPuppet.GetGame() ) );
		}
		if( m_unlockingAnimationProxy )
		{
			m_unlockingAnimationProxy.GotoStartAndStop();
			m_unlockingAnimationProxy = NULL;
		}
		m_data.entityID = EMPTY_ENTITY_ID();
		m_data.attachedBoneName = '';
	}

	public function SetData( const data : ref< smartGunUITargetParameters >, params : smartGunUIParameters, playerPuppet : GameObject, newHasDeadEye : Bool )
	{
		var playbackOptions : inkAnimOptions;
		switch( data.state )
		{
			case gamesmartGunTargetState.Visible:
			case gamesmartGunTargetState.Targetable:
				break;
			case gamesmartGunTargetState.Locking:
				if( m_unlockingAnimationProxy )
				{
					m_unlockingAnimationProxy.Stop();
					m_unlockingAnimationProxy = NULL;
				}
			if( !( m_lockingAnimationProxy ) )
			{
				HandleDeadEyeInTargetBrackets( newHasDeadEye );
				StartLocking( data, params, playerPuppet, true );
			}
			break;
			case gamesmartGunTargetState.Locked:
				if( m_unlockingAnimationProxy )
				{
					m_unlockingAnimationProxy.GotoStartAndStop();
					m_unlockingAnimationProxy = NULL;
				}
				else if( m_lockingAnimationProxy )
				{
					m_unlockingAnimationProxy.GotoEndAndStop();
					m_unlockingAnimationProxy = NULL;
				}
				else
				{
					m_lockingAnimationProxy = PlayLibraryAnimation( 'locking', playbackOptions );
					m_lockingAnimationProxy.GotoEndAndStop();
					m_lockingAnimationProxy = NULL;
				}
			break;
			case gamesmartGunTargetState.Unlocking:
				if( m_lockingAnimationProxy )
				{
					m_lockingAnimationProxy.Stop();
					m_lockingAnimationProxy = NULL;
				}
			if( !( m_unlockingAnimationProxy ) )
			{
				playbackOptions.playReversed = true;
				playbackOptions.applyCustomTimeDilation = true;
				playbackOptions.customTimeDilation = ( ( params.timeToUnlock < 0.30000001 ) ? ( m_unlockingAnimationLength ) : ( m_unlockingAnimationLength / params.timeToUnlock ) );
				m_unlockingAnimationProxy = PlayLibraryAnimation( 'locking', playbackOptions );
			}
			else if( m_data.timeUnlocking > data.timeUnlocking )
			{
				m_unlockingAnimationProxy.Stop();
				playbackOptions.playReversed = true;
				playbackOptions.applyCustomTimeDilation = true;
				playbackOptions.customTimeDilation = ( ( params.timeToUnlock < 0.30000001 ) ? ( m_unlockingAnimationLength ) : ( m_unlockingAnimationLength / params.timeToUnlock ) );
				m_unlockingAnimationProxy = PlayLibraryAnimation( 'locking', playbackOptions );
			}
			break;
		}
		m_data = data;
	}

	private function StartLocking( const data : ref< smartGunUITargetParameters >, params : smartGunUIParameters, playerPuppet : GameObject, scheduleSFX : Bool )
	{
		var customTimeDilation : Float;
		var playbackOptions : inkAnimOptions;
		var delayedSoundClue : DelayedSmartGunUISoundClue;
		var i : Int32;
		customTimeDilation = ( ( params.timeToLock < 0.30000001 ) ? ( m_lockingAnimationLength ) : ( m_lockingAnimationLength / params.timeToLock ) );
		customTimeDilation *= 0.74000001;
		playbackOptions.applyCustomTimeDilation = true;
		playbackOptions.customTimeDilation = customTimeDilation;
		m_lockingAnimationProxy = PlayLibraryAnimation( 'locking', playbackOptions );
		if( scheduleSFX )
		{
			m_activeCallbacks.Clear();
			for( i = 0; i < params.smartAudioEvents.Size(); i += 1 )
			{
				delayedSoundClue = DelayedSmartGunUISoundClue.Create( playerPuppet, params.smartAudioEvents[ i ] );
				m_activeCallbacks.PushBack( GameInstance.GetDelaySystem( playerPuppet.GetGame() ).DelayCallback( delayedSoundClue, params.smartAudioEventsDelays[ i ] * params.timeToLock, true ) );
			}
		}
	}

	private function ClearCallbacks( delaySystem : DelaySystem )
	{
		var i : Int32;
		for( i = 0; i < m_activeCallbacks.Size(); i += 1 )
		{
			delaySystem.CancelCallback( m_activeCallbacks[ i ] );
		}
		m_activeCallbacks.Clear();
	}

	public function HandleDeadEyeInTargetBrackets( newHasDeadEye : Bool )
	{
		var animOptions : inkAnimOptions;
		if( m_hasDeadEye == newHasDeadEye )
		{
			return;
		}
		m_hasDeadEye = newHasDeadEye;
		if( m_deadEyeAnimProxy.IsPlaying() )
		{
			m_deadEyeAnimProxy.Stop();
		}
		if( !( m_hasDeadEye ) )
		{
			animOptions.customTimeDilation = 2.0;
			animOptions.applyCustomTimeDilation = true;
			animOptions.playReversed = true;
			m_deadEyeAnimProxy = PlayLibraryAnimation( 'intro_deadeye', animOptions );
			if( ( m_deadEyeAnimProxy && m_deadEyeAnimProxy.IsValid() ) && m_deadEyeAnimProxy.IsPlaying() )
			{
				m_deadEyeAnimProxy.RegisterToCallback( inkanimEventType.OnFinish, this, 'OnDeadEyeAnimFinished' );
			}
			else
			{
				inkWidgetRef.SetVisible( m_deadEyeWidget, false );
			}
		}
		else
		{
			animOptions.customTimeDilation = 1.5;
			animOptions.applyCustomTimeDilation = true;
			animOptions.playReversed = false;
			inkWidgetRef.SetVisible( m_deadEyeWidget, true );
			m_deadEyeAnimProxy = PlayLibraryAnimation( 'intro_deadeye', animOptions );
		}
	}

	protected event OnDeadEyeAnimFinished( anim : inkAnimProxy )
	{
		inkWidgetRef.SetVisible( m_deadEyeWidget, false );
	}

}

