class AppearanceRandomizerComponent extends ScriptableComponent
{
	const editable var m_appearances : array< CName >;
	editable var m_isEnabled : Bool;

	private function OnGameAttach()
	{
		var appearance : CName;
		if( m_isEnabled )
		{
			appearance = PickAppearance();
			ApplyAppearance( appearance );
		}
	}

	private function ApplyAppearance( appearance : CName )
	{
		var evt : entAppearanceEvent;
		evt = new entAppearanceEvent;
		evt.appearanceName = appearance;
		GetOwner().QueueEvent( evt );
	}

	private function PickAppearance() : CName
	{
		var maxValue : Int32;
		var index : Int32;
		maxValue = m_appearances.Size();
		index = RandRange( 0, maxValue );
		return m_appearances[ index ];
	}

}

