예제 #1
0
    void Start()
    {
        gameMaster = FindObjectOfType <GameMasterScript>();
        //今回のえねみーを指定
        enemyTag     = gameMaster.GetTag();
        enemyLV      = gameMaster.GetLV();
        createAmount = gameMaster.GetKillAmount();

        switch (enemyTag)
        {
        case WARG:
            enemyPrefab      = enemyPref[0];
            unremoveEnemyNum = 0;
            break;

        case DRAGON:
            enemyPrefab      = enemyPref[1];
            unremoveEnemyNum = 1;
            break;

        case CYCLOPS:
            enemyPrefab      = enemyPref[2];
            unremoveEnemyNum = 2;
            break;

        case GOLEM:
            enemyPrefab      = enemyPref[3];
            unremoveEnemyNum = 3;
            break;

        case SKYDRAGON:
            enemyPrefab      = enemyPref[4];
            unremoveEnemyNum = 4;
            break;

        case SKELTON:
            enemyPrefab      = enemyPref[5];
            unremoveEnemyNum = 5;
            break;

        case ROBOT:
            enemyPrefab      = enemyPref[6];
            unremoveEnemyNum = 6;
            break;

        case TROLL:
            enemyPrefab      = enemyPref[7];
            unremoveEnemyNum = 7;
            break;
        }

        // 配列確保
        existEnemys = new GameObject[maxEnemy];
        // 周期的に実行したい場合はコルーチンを使うと簡単に実装できます。
        StartCoroutine(Exec());
        //いらない奴らは消す
        // RemovePref();
    }