// 建立Soldier
        public override ISoldier CreateSoldier(ENUM_Soldier emSoldier, ENUM_Weapon emWeapon, int Lv, Vector3 SpawnPosition)
        {
            // 產生對應的Character
            ICharacter theSoldier = null;

            switch (emSoldier)
            {
            case ENUM_Soldier.Rookie:
                theSoldier = new SoldierRookie();
                break;

            case ENUM_Soldier.Sergeant:
                theSoldier = new SoldierSergeant();
                break;

            case ENUM_Soldier.Captain:
                theSoldier = new SoldierCaptain();
                break;

            default:
                Debug.LogWarning("CreateSoldier:無法建立[" + emSoldier + "]");
                return(null);
            }

            // 增加角色功能
            AddCharacterFuncs(theSoldier, emWeapon, Lv);

            // 加入管理器
            //PBaseDefenseGame.Instance.AddSoldier( theSoldier as ISoldier);
            return(theSoldier as ISoldier);
        }
        // 訓練Sergeant單位
        public ISoldier TrainSergeant(ENUM_Weapon emWeapon, int Lv)
        {
            // 產生物件
            SoldierSergeant theSoldier = new SoldierSergeant();

            // 設定模型
            GameObject tmpGameObject = CreateGameObject("SergeantGameObjectName");

            tmpGameObject.gameObject.name = "SoldierSergeant";
            theSoldier.SetGameObject(tmpGameObject);

            // 加入武器
            IWeapon Weapon = CreateWeapon(emWeapon);

            theSoldier.SetWeapon(Weapon);

            // 取得Soldier的數值,設定給角色
            SoldierAttr theSoldierAttr = CreateSoliderAttr(2);

            theSoldierAttr.SetSoldierLv(Lv);
            theSoldier.SetCharacterAttr(theSoldierAttr);

            // 加入AI
            SoldierAI theAI = CreateSoldierAI();

            theSoldier.SetAI(theAI);

            // 加入管理器
            //PBaseDefenseGame.Instance.AddSoldier( theSoldier as ISoldier );

            return(theSoldier as ISoldier);
        }
Esempio n. 3
0
    public ICharacter CreateCharacter(string characterName)
    {
        ISoldier soldier   = null;
        string   assetName = "";

        switch (characterName)
        {
        case "Captain":
            assetName = "Captain";
            break;

        case "Captive":
            assetName = "Captive";
            break;

        case "Rookie":
            assetName = "Rookie";
            break;

        case "Sergeant":
            assetName = "Sergeant";
            break;
        }

        IAssetsFactory resoureLoadFactory = new ResouresLoadFactory();
        GameObject     GO = resoureLoadFactory.LoadSoldier(assetName);

        switch (characterName)
        {
        case "Captain":
            soldier = new SoldierCaptain();
            break;

        case "Captive":
            soldier = new SoldierCaptive();
            break;

        case "Rookie":
            soldier = new SoldierRookie();
            break;

        case "Sergeant":
            soldier = new SoldierSergeant();
            break;
        }

        return(soldier);
    }
 public virtual void VisitSoldierSergeant(SoldierSergeant Sergeant)
 {
     VisitSoldier(Sergeant);
 }
	public virtual void VisitSoldierSergeant(SoldierSergeant Sergeant)
	{
		VisitSoldier( Sergeant );
	}
Esempio n. 6
0
 public override void VisitSoldierSergeant(SoldierSergeant Sergeant)
 {
     base.VisitSoldierSergeant(Sergeant);
     SoldierSergeantCount++;
 }
	public override void VisitSoldierSergeant(SoldierSergeant Sergeant)
	{
		base.VisitSoldierSergeant(Sergeant);
		SoldierSergeantCount++;
	}
		// 訓練Sergeant單位
		public ISoldier TrainSergeant(ENUM_Weapon emWeapon,int Lv)
		{
			// 產生物件
			SoldierSergeant theSoldier = new SoldierSergeant();
			
			// 設定模型
			GameObject tmpGameObject = CreateGameObject("SergeantGameObjectName");
			tmpGameObject.gameObject.name = "SoldierSergeant";
			theSoldier.SetGameObject( tmpGameObject );
			
			// 加入武器
			IWeapon Weapon = CreateWeapon(emWeapon);
			theSoldier.SetWeapon( Weapon );
			
			// 取得Soldier的數值,設定給角色
			SoldierAttr theSoldierAttr = CreateSoliderAttr(2);
			theSoldierAttr.SetSoldierLv(Lv);
			theSoldier.SetCharacterAttr(theSoldierAttr);
			
			// 加入AI
			SoldierAI theAI = CreateSoldierAI();
			theSoldier.SetAI( theAI );
			
			// 加入管理器
			//PBaseDefenseGame.Instance.AddSoldier( theSoldier as ISoldier );
			
			return theSoldier as ISoldier;
		}
		// 建立Soldier
		public override ISoldier CreateSoldier( ENUM_Soldier emSoldier, ENUM_Weapon emWeapon, int Lv,Vector3 SpawnPosition)
		{		
			// 產生對應的Character
			ICharacter theSoldier = null;
			switch( emSoldier)
			{
			case ENUM_Soldier.Rookie:
				theSoldier = new SoldierRookie();
				break;
			case ENUM_Soldier.Sergeant:
				theSoldier = new SoldierSergeant();
				break;
			case ENUM_Soldier.Captain:
				theSoldier = new SoldierCaptain();
				break;
			default:
				Debug.LogWarning("CreateSoldier:無法建立[" + emSoldier + "]");
				return null;
			}

			// 增加角色功能
			AddCharacterFuncs( theSoldier, emWeapon, Lv);

			// 加入管理器
			//PBaseDefenseGame.Instance.AddSoldier( theSoldier as ISoldier);				
			return theSoldier as ISoldier;
		}