コード例 #1
0
	// 建立Soldier
	public override ISoldier CreateSoldier( ENUM_Soldier emSoldier, ENUM_Weapon emWeapon, int Lv, Vector3 SpawnPosition)
	{
		// 產生Soldier的參數
		SoldierBuildParam SoldierParam = new SoldierBuildParam();

		// 產生對應的Character
		switch( emSoldier)
		{
		case ENUM_Soldier.Rookie:
			SoldierParam.NewCharacter = new SoldierRookie();
			break;
		case ENUM_Soldier.Sergeant:
			SoldierParam.NewCharacter = new SoldierSergeant();
			break;
		case ENUM_Soldier.Captain:
			SoldierParam.NewCharacter = new SoldierCaptain();
			break;
		default:
            Debug.LogWarning("CreateSoldier:無法建立[" + emSoldier + "]");
			return null;
		}

		if( SoldierParam.NewCharacter == null)
			return null;

		// 設定共用參數
		SoldierParam.emWeapon = emWeapon;
		SoldierParam.SpawnPosition = SpawnPosition;
		SoldierParam.Lv		  = Lv;

		//  產生對應的Builder及設定參數
		SoldierBuilder theSoldierBuilder = new SoldierBuilder();
		theSoldierBuilder.SetBuildParam( SoldierParam ); 
		
		// 產生
		m_BuilderDirector.Construct( theSoldierBuilder );
		return SoldierParam.NewCharacter  as ISoldier;
	}
コード例 #2
0
	public override void SetBuildParam( ICharacterBuildParam theParam )
	{
		m_BuildParam = theParam as SoldierBuildParam;	
	}