一些修复和优化
This commit is contained in:
@@ -60,6 +60,13 @@ public class groundParticularController : MonoBehaviour
|
||||
[SerializeField] private float speedMultiplier = 0.1f;
|
||||
[Tooltip("发射速度倍增器")]
|
||||
[SerializeField] private float emissionSpeedMultiplier = 1f;
|
||||
[SerializeField] private float perFrameMoveMultiplier = 0.01f;
|
||||
|
||||
[Header("Rotation Randomness")]
|
||||
[Tooltip("If enabled, each spawned particle gets a random initial rotation offset.")]
|
||||
[SerializeField] private bool enableRandomRotation = false;
|
||||
[Tooltip("Random initial rotation range in degrees. Each axis is offset from -range to +range.")]
|
||||
[SerializeField] private float randomRotationRangeDegrees = 0f;
|
||||
|
||||
[Tooltip("起点缩放抖动强度 (基于音频电平)")]
|
||||
[SerializeField] private float shakeIntensity = 0.1f;
|
||||
@@ -214,7 +221,7 @@ public class groundParticularController : MonoBehaviour
|
||||
Random.Range(-spawnOffsetY, spawnOffsetY)
|
||||
);
|
||||
particle.transform.position = startPoint.TransformPoint(finalLocalPos);
|
||||
particle.transform.rotation = startPoint.rotation;
|
||||
particle.transform.rotation = GetSpawnRotation();
|
||||
|
||||
// 5. 材质均衡选取逻辑
|
||||
MaterialConfig? selectedConfig = GetBalancedMaterialConfig();
|
||||
@@ -251,6 +258,24 @@ public class groundParticularController : MonoBehaviour
|
||||
/// <summary>
|
||||
/// 轮询式均衡选取材质,确保每种材质数量大致相同
|
||||
/// </summary>
|
||||
|
||||
private Quaternion GetSpawnRotation()
|
||||
{
|
||||
if (!enableRandomRotation || randomRotationRangeDegrees <= 0f || startPoint == null)
|
||||
{
|
||||
return startPoint != null ? startPoint.rotation : Quaternion.identity;
|
||||
}
|
||||
|
||||
float range = Mathf.Abs(randomRotationRangeDegrees);
|
||||
Vector3 randomEuler = new Vector3(
|
||||
Random.Range(-range, range),
|
||||
Random.Range(-range, range),
|
||||
Random.Range(-range, range)
|
||||
);
|
||||
|
||||
return startPoint.rotation * Quaternion.Euler(randomEuler);
|
||||
}
|
||||
|
||||
private MaterialConfig? GetBalancedMaterialConfig()
|
||||
{
|
||||
if (particleMaterials == null || particleMaterials.Count == 0) return null;
|
||||
@@ -301,13 +326,13 @@ public class groundParticularController : MonoBehaviour
|
||||
float noteSpawnerSpeedMultiplier = 1.0f;
|
||||
if (beatmapManager != null && beatmapManager.noteSpawner != null)
|
||||
{
|
||||
noteSpawnerSpeedMultiplier = beatmapManager.noteSpawner.speedMultiplier;
|
||||
noteSpawnerSpeedMultiplier = beatmapManager.noteSpawner.EffectiveSpeedMultiplier;
|
||||
}
|
||||
|
||||
float effectiveBPM = Mathf.Max(currentBPM, 60f);
|
||||
float noteSpeed = (totalDist * effectiveBPM * noteSpawnerSpeedMultiplier) / 240f;
|
||||
|
||||
float step = noteSpeed * speedMultiplier * emissionSpeedMultiplier * Time.deltaTime;
|
||||
float step = noteSpeed * speedMultiplier * emissionSpeedMultiplier * perFrameMoveMultiplier * Time.deltaTime;
|
||||
if (step <= 0) step = 0.01f;
|
||||
|
||||
traveledDist += step;
|
||||
|
||||
Reference in New Issue
Block a user