class MuteArm extends WeaponObject
{
	private editable var m_gameEffectRef : EffectRef;
	private var gameEffectInstance : EffectInstance;

	protected event OnChargeStartedEvent( evt : ChargeStartedEvent )
	{
		var player : PlayerPuppet;
		SetUpMuteArmBlackboard( true );
		player = GetPlayer( GetGame() );
		gameEffectInstance = GameInstance.GetGameEffectSystem( GetGame() ).CreateEffect( m_gameEffectRef, player, this );
		EffectData.SetFloat( gameEffectInstance.GetSharedData(), GetAllBlackboardDefs().EffectSharedData.radius, 4.0 );
		gameEffectInstance.AttachToEntity( player, GetAllBlackboardDefs().EffectSharedData.position );
		gameEffectInstance.Run();
		ChangeAppearance( 'green' );
	}

	protected event OnChargeEndedEvent( evt : ChargeEndedEvent )
	{
		if( gameEffectInstance )
		{
			gameEffectInstance.Terminate();
			ChangeAppearance( 'default' );
		}
	}

	protected function ChangeAppearance( newAppearance : CName )
	{
		var evt : entAppearanceEvent;
		evt = new entAppearanceEvent;
		evt.appearanceName = newAppearance;
		this.QueueEvent( evt );
	}

	protected function SetUpMuteArmBlackboard( enabled : Bool )
	{
		var blackboardSystem : BlackboardSystem;
		var blackboard : IBlackboard;
		blackboardSystem = GameInstance.GetBlackboardSystem( GetGame() );
		blackboard = blackboardSystem.Get( GetAllBlackboardDefs().CW_MuteArm );
		if( enabled )
		{
			blackboard.SetBool( GetAllBlackboardDefs().CW_MuteArm.MuteArmActive, true, true );
			blackboard.SetFloat( GetAllBlackboardDefs().CW_MuteArm.MuteArmRadius, 4.0, true );
		}
		else
		{
			blackboard.SetBool( GetAllBlackboardDefs().CW_MuteArm.MuteArmActive, false, true );
			blackboard.SetFloat( GetAllBlackboardDefs().CW_MuteArm.MuteArmRadius, 0.0, true );
		}
	}

}

