Exemple #1
0
    //敵がスポーン位置から出現
    IEnumerator Monstar_Spawn()
    {
        //PLSenserにプレイヤーが入ったら
        while (PLSenser.GetPL_Search())
        {
            int a    = 0;
            int Rand = Random.Range(0, SpawnPosList.Count);
            //スポーン位置に敵がいたら
            if (SpawnPosList[Rand].GetComponent <EnemySpawnArea>().inArea)
            {
                if (a <= 50)
                {
                    a++;
                    yield return(null);

                    continue;
                }
            }

            //敵の数(MonsterAmount)が現在の表示している数より少ない時
            if (EnemyList.Count < MonsterAmount)
            {
                GameObject PopEnemy = Instantiate(Enemy.GetValue(), SpawnPosList[Rand].transform.position, Quaternion.identity);
                EnemyList.Add(PopEnemy);
                PopEnemy.GetComponent <EnemyController>().SetOnDest(EnemyListDest);
                SEManager.SetSE(spawnSE);
                for (int i = 0; i < effectCount; i++)
                {
                    GameObject effect = Instantiate(spawnEffect);
                    Vector3    pos    = PopEnemy.transform.position;
                    pos.y -= 0.5f;
                    effect.transform.position = pos;
                    Destroy(effect, effectTime);
                }
                //Debug.Log("a");
            }
            yield return(new WaitForSeconds(SpawnTime));
        }
        SpawnStart = false;
    }