// 建立Enemy
        public override IEnemy CreateEnemy(ENUM_Enemy emEnemy, ENUM_Weapon emWeapon, Vector3 SpawnPosition, Vector3 AttackPosition)
        {
            // 產生對應的Character
            ICharacter theEnemy = null;

            switch (emEnemy)
            {
            case ENUM_Enemy.Elf:
                theEnemy = new EnemyElf();
                break;

            case ENUM_Enemy.Troll:
                theEnemy = new EnemyTroll();
                break;

            case ENUM_Enemy.Ogre:
                theEnemy = new EnemyOgre();
                break;

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

            // 增加角色功能
            AddCharacterFuncs(theEnemy, emWeapon, 0);

            // 加入管理器
            //PBaseDefenseGame.Instance.AddEnemy( theEnemy as IEnemy);

            return(theEnemy as IEnemy);
        }
        // 加入Troll單位
        public IEnemy AddTroll(ENUM_Weapon emWeapon)
        {
            // 產生物件
            EnemyTroll theEnmey = new EnemyTroll();

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

            tmpGameObject.gameObject.name = "EnemyTroll";
            theEnmey.SetGameObject(tmpGameObject);

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

            theEnmey.SetWeapon(Weapon);

            // 取得Soldier的數值,設定給角色
            EnemyAttr theEnemyAttr = CreateEnemyAttr(3);

            theEnmey.SetCharacterAttr(theEnemyAttr);

            // 加入AI
            EnemyAI theAI = CreateEnemyAI();

            theEnmey.SetAI(theAI);

            // 加入管理器
            //PBaseDefenseGame.Instance.AddEnemy( theEnmey as IEnemy );

            return(theEnmey as IEnemy);
        }
Esempio n. 3
0
    public ICharacter CreateCharacter(string characterName)
    {
        IEnemy enemy     = null;
        string assetName = "";

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

        case "Ogre":
            assetName = "Ogre";
            break;

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

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

        switch (characterName)
        {
        case "Elf":
            enemy = new EnemyElf();
            break;

        case "Ogre":
            enemy = new EnemyOgre();
            break;

        case "Troll":
            enemy = new EnemyTroll();
            break;
        }

        return(enemy);
    }
 public virtual void VisitEnemyTroll(EnemyTroll Troll)
 {
     VisitEnemy(Troll);
 }
	public virtual void VisitEnemyTroll(EnemyTroll Troll)
	{
		VisitEnemy( Troll );
	}
Esempio n. 6
0
 public override void VisitEnemyTroll(EnemyTroll Troll)
 {
     base.VisitEnemyTroll(Troll);
     EnemyTrollCount++;
 }
	public override void VisitEnemyTroll		(EnemyTroll Troll)
	{
		base.VisitEnemyTroll(Troll);
		EnemyTrollCount++;
	}
		// 加入Troll單位
		public IEnemy AddTroll(ENUM_Weapon emWeapon)
		{
			// 產生物件
			EnemyTroll theEnmey = new EnemyTroll();
			
			// 設定模型
			GameObject tmpGameObject = CreateGameObject("TrollGameObjectName");
			tmpGameObject.gameObject.name = "EnemyTroll";
			theEnmey.SetGameObject( tmpGameObject );
			
			// 加入武器
			IWeapon Weapon = CreateWeapon(emWeapon);
			theEnmey.SetWeapon( Weapon );
			
			// 取得Soldier的數值,設定給角色
			EnemyAttr theEnemyAttr = CreateEnemyAttr(3);
			theEnmey.SetCharacterAttr(theEnemyAttr);
			
			// 加入AI
			EnemyAI theAI = CreateEnemyAI();
			theEnmey.SetAI( theAI );
			
			// 加入管理器
			//PBaseDefenseGame.Instance.AddEnemy( theEnmey as IEnemy );
			
			return theEnmey as IEnemy;
		}
		// 建立Enemy
		public override IEnemy CreateEnemy( ENUM_Enemy emEnemy, ENUM_Weapon emWeapon, Vector3 SpawnPosition, Vector3 AttackPosition)
		{
			
			// 產生對應的Character
			ICharacter  theEnemy =null;
			switch( emEnemy)
			{
			case ENUM_Enemy.Elf:
				theEnemy = new EnemyElf();
				break;
			case ENUM_Enemy.Troll:
				theEnemy = new EnemyTroll();
				break;
			case ENUM_Enemy.Ogre:
				theEnemy = new EnemyOgre();
				break;
			default:
				Debug.LogWarning("無法建立["+emEnemy+"]");
				return null;
			}

			// 增加角色功能
			AddCharacterFuncs( theEnemy, emWeapon, 0);

			// 加入管理器
			//PBaseDefenseGame.Instance.AddEnemy( theEnemy as IEnemy);		

			return theEnemy as IEnemy;
		}