地铁功能初步

This commit is contained in:
2024-11-28 14:20:06 +08:00
parent 41943add67
commit 5ea68a092d
19 changed files with 2121 additions and 900 deletions
@@ -0,0 +1,35 @@
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));
// }
// }
// }
}