// 訓練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); }
// 訓練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; }