using System.Collections; using System.Collections.Generic; using UnityEngine; [System.Serializable] public class ParallaxObjectCategoryConfig { public string categoryName; // 物体类别名称(例如:云、房子等) public GameObject[] objects; // 配置数组,包含该类别下的所有物体预制体 //public int initialPoolSize; public float generationThreshold; // 按照这个阈值来决定是否生成新物体 public bool useIntervalGeneration; // 是否使用时间间隔来生成 public float spawnInterval; // 时间间隔生成物体的时间间隔(如果使用此方式) public float speed; // 最大滚动速度 public float xSpawnRange; // X轴生成范围 // 自定义生成逻辑:按距离生成或按时间生成 // public void SpawnObjects(ParallaxManager manager) // { // foreach (var prefab in objects) // { // if (useIntervalGeneration) // { // manager.StartCoroutine(manager.ManageObjectGeneration(this)); // } // else // { // // 按照距离生成 // manager.StartCoroutine(manager.ManageObjectGenerationByDistance(this)); // } // } // } }