public void StartABattle( GameObject _LeftCharacter , UnitDataStruct _LeftUnitDataStruct, 
	                         GameObject _RightCharacter , UnitDataStruct _RightUnitDataStruct )
	{
		if( null == _LeftCharacter ||
		   null == _RightCharacter ||
		   null == _LeftUnitDataStruct ||
		   null == _RightUnitDataStruct )
		{
			Debug.LogWarning( "StartABattle() null" ) ;
			return ;
		}

		UnitData leftUnitData = _LeftCharacter.AddComponent<UnitData>() ;
		leftUnitData.m_UnitDataStruct = _LeftUnitDataStruct ;

		UnitData rightUnitData = _RightCharacter.AddComponent<UnitData>() ;
		rightUnitData.m_UnitDataStruct = _RightUnitDataStruct ;

		m_CharacterLeft = _LeftCharacter ;
		m_CharacterRight = _RightCharacter ;
		m_FightSystemState = FightSystemState.BattleInitialize ;
	}
	public void LoadLevel( string _LevelFilepath )
	{
		Dictionary<string,UnitDataSetting> unitDataSettingTable = GlobalSingleton.GetUnitDataSettingTable() ;
		Dictionary<string,UnitDataStruct> unitDataStructTable = GlobalSingleton.GetUnitDataStructTable() ;

		Debug.Log( "LoadLevel(), _LevelFilepath=" + _LevelFilepath ) ;
		if( 0 == _LevelFilepath.Length )
		{
			// warning
			Debug.LogWarning( "_LevelFilepath=" + _LevelFilepath ) ;
			return ;
		}

		TextAsset ta = Resources.Load<TextAsset>( _LevelFilepath );
		if( null == ta )
		{
			Debug.LogError( "LoadLevel() null == ta" ) ;
			return ;
		}
#if USE_XML
		XmlDocument doc = new XmlDocument() ;
		doc.LoadXml( ta.text ) ;
		XmlNode root = doc.FirstChild ;

		if( null == root )
		{
			Debug.LogError( "LoadLevel() : null == root" ) ;
			return ;
		}
		
		// string levelname = root.Attributes[ "name" ].Value ;
		if( false == root.HasChildNodes )
		{
			Debug.Log( "LoadLevel() : false == root.HasChildNodes" ) ;
			return ;			
		}
#endif // USE_XML

#if USE_XML
		for( int i = 0 ; i < root.ChildNodes.Count ; ++i )
		{
			XmlNode unitNode = root.ChildNodes[ i ] ;
#endif // USE_XML
			string unitName = "";
			string prefabTemplateName = "";
			string unitDataTemplateName = "";

			Vector3 position = Vector3.zero ;
			PosAnchor posAnchor = new PosAnchor() ;
			Quaternion orientation = new Quaternion() ;
			string textureName = "";
			Dictionary<string,StandardParameter> standardParamMap = new Dictionary<string, StandardParameter>();
			string defensePropertyStr = "" ;

			// Debug.Log( "LoadLevel() : unitNode.Name=" + unitNode.Name ) ;
			
			if( -1 != unitNode.Name.IndexOf( "comment" ) )
			{
				// comment
			}


			else if( true == ParseUtility.ParseUnit( unitNode,
			                                        ref unitName ,
				                                                ref prefabTemplateName , 
			                                        ref unitDataTemplateName ,
			                                        ref posAnchor , 
				                                                ref orientation ,
			                                        ref standardParamMap ) )
			{
				GameObject obj = PrefabInstantiate.CreateByInit( prefabTemplateName , 
				                                                unitName , 
				                                                posAnchor.GetPosition() , 
				                                                orientation ) ;

				UnitData unitData = null ;
				if( 0 != unitDataTemplateName.Length &&
				   true == unitDataSettingTable.ContainsKey( unitDataTemplateName ) )
				{
					// Debug.Log( "unitDataTemplateName=" + unitDataTemplateName ) ;
					unitData = obj.AddComponent<UnitData>() ;

					UnitDataStruct unitDataStruct = new UnitDataStruct() ;
					unitDataStructTable.Add( obj.name , unitDataStruct ) ;// 掛上 global singleton

					unitDataStruct.Import( unitDataSettingTable[ unitDataTemplateName ] ) ;// data setting 共用

					unitData.m_UnitDataStruct = unitDataStruct ;
				}

				if( null != unitData )
				{
					unitData.m_UnitDataStruct.ImportStandardParameter( standardParamMap ) ;
				}

//				Debug.Log( "ParseUtility.ParseUnit , unitData.m_UnitDataStruct.standardParameters.Count=" + unitData.m_UnitDataStruct.standardParameters.Count ) ;
//				foreach( string key in unitData.m_UnitDataStruct.standardParameters.Keys )
//				{
//					Debug.Log( "key=" + key ) ;
//				}

			}
			else if( true == ParseUtility.ParseStaticObject( unitNode,
			                                                 ref unitName ,
			                                                 ref prefabTemplateName , 
			                                                 ref position , 
			                                                 ref orientation  ) )
			{
				/*GameObject obj =*/ PrefabInstantiate.CreateByInit( prefabTemplateName , 
				                                                unitName , 
				                                                position , 
				                                                orientation ) ;
			}
			else if( true == ParseUtility.ParseMapZoneObject( unitNode,
		                                                     ref unitName ,
		                                                     ref prefabTemplateName , 
		                                                     ref position , 
		                                                     ref orientation , 
			                                                 ref textureName ) )
			{
				GameObject obj = PrefabInstantiate.CreateByInit( prefabTemplateName , 
				                                                unitName , 
				                                                position , 
				                                                orientation ) ;

				if( 0 != textureName.Length )
				{
					obj.GetComponent<Renderer>().material = new Material( obj.GetComponent<Renderer>().material ) ;
					Texture tex = ResourceLoad.LoadTexture( textureName ) ;
					if( null == tex )
					{

					}
					else
					{
						obj.GetComponent<Renderer>().material.mainTexture = tex ;
					}
				}
			}
			else if( true == ParseUtility.ParseExistUnit( unitNode,
			                                        ref unitName ,
			                                        ref unitDataTemplateName ) )
			{
				GameObject obj = GameObject.Find( unitName ) ;
				UnitData unitData = null ;
				if( null != obj &&
				   0 != unitDataTemplateName.Length &&
				   true == unitDataSettingTable.ContainsKey( unitDataTemplateName ) )
				{
					// Debug.Log( "unitDataTemplateName=" + unitDataTemplateName ) ;
					unitData = obj.AddComponent<UnitData>() ;
					
					UnitDataStruct unitDataStruct = new UnitDataStruct() ;
					unitDataStructTable.Add( obj.name , unitDataStruct ) ;// 掛上 global singleton
					
					unitDataStruct.Import( unitDataSettingTable[ unitDataTemplateName ] ) ;// data setting 共用
					
					unitData.m_UnitDataStruct = unitDataStruct ;
				}

				
				Debug.Log( "ParseUtility.ParseExistUnit , unitData.m_UnitDataStruct.standardParameters.Count=" + unitData.m_UnitDataStruct.standardParameters.Count ) ;
			}
			else if( true == ParseUtility.ParseUnitDataStruct( unitNode,
			                                             ref unitName ,
			                                             ref unitDataTemplateName ,
			                                             ref defensePropertyStr ) )
			{
				if( 0 != unitDataTemplateName.Length &&
				   true == unitDataSettingTable.ContainsKey( unitDataTemplateName ) )
				{
					Debug.Log( "LoadLevel(), UnitDataStruct=" + unitDataTemplateName ) ;
					UnitDataStruct unitDataStruct = new UnitDataStruct() ;
					unitDataStruct.Import( unitDataSettingTable[ unitDataTemplateName ] ) ;// data setting 共用
					
					Debug.Log( "LoadLevel(), UnitDataStruct defensePropertyStr=" + defensePropertyStr ) ;
					unitDataStruct.DefenseProperty.Parse( defensePropertyStr ) ;
					
					if( false == unitDataStructTable.ContainsKey( unitName ) )
					{
						unitDataStructTable.Add( unitName , unitDataStruct ) ;// 掛上 global singleton
					}
					else
					{
						unitDataStructTable[ unitName ] = unitDataStruct ;// 掛上 global singleton
					}
				}
			}
#if USE_XML
		}
#endif // USE_XML			

	}
	public void Import( UnitDataStruct _Src ) 
	{
		m_UnitDataSetting = _Src.m_UnitDataSetting ;// 共用
		ImportStandardParameter( _Src.m_UnitDataSetting.standardParameters ) ;// 自己複製一份
		m_UnitState = _Src.m_UnitState ;
		
	}