示例#1
0
	// 取得場景中的俘兵營
	private CaptiveCamp CaptiveCampFactory( ENUM_Enemy emEnemy )
	{
		string GameObjectName = "CaptiveCamp_";
		float CoolDown = 0;
		string CampName = "";
		string IconSprite = "";
		switch( emEnemy )
		{
		case ENUM_Enemy.Elf :
			GameObjectName += "Elf";
			CoolDown = 3;
			CampName = "精靈俘兵營";
			IconSprite = "CaptiveCamp";
			break;		
		default:
			Debug.Log("沒有指定["+emEnemy+"]要取得的場景物件名稱");
			break;				
		}

		// 取得物件
		GameObject theGameObject = UnityTool.FindGameObject( GameObjectName );
				
		// 取得集合點
		Vector3 TrainPoint = GetTrainPoint( GameObjectName );

		// 產生兵營
		CaptiveCamp NewCamp = new CaptiveCamp(theGameObject, emEnemy, CampName, IconSprite, CoolDown, TrainPoint); 
		NewCamp.SetPBaseDefenseGame( m_PBDGame );

		// 設定兵營使用的Script
		AddCampScript( theGameObject, NewCamp);
		// 先隱藏
		NewCamp.SetVisible(false);

		// 回傳
		return NewCamp;
	}
	void UnitTest_Camp()
	{
		theSoldierCamp = new SoldierCamp(null, ENUM_Soldier.Rookie, "測試", "", 2, Vector3.zero); 
		theCaptiveCamp = new CaptiveCamp(null, ENUM_Enemy.Elf, "測試", "", 3, Vector3.zero); 

		//  執行訓練
		theSoldierCamp.Train();
		theSoldierCamp.Train();
		theSoldierCamp.Train();

		theCaptiveCamp.Train();
		theCaptiveCamp.Train();
		theCaptiveCamp.Train();
	}