示例#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);
    }
示例#2
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;
	}