This commit is contained in:
SoulliesOfficial
2025-08-22 14:54:40 -04:00
parent 6aa498f6be
commit 70b2a43824
574 changed files with 173713 additions and 1884 deletions

View File

@@ -8,11 +8,11 @@ using UnityEngine.Serialization;
namespace Ichni.RhythmGame
{
public partial class ParticleTracker : GameElement, IHaveColorSubmodule
public partial class ParticleTracker : GameElement, IHaveParticles, IHaveColorSubmodule
{
public Track track;
public ParticleController particleController;
public ParticleSystem particle;
public ParticleSystem particle { get; set; }
public ColorSubmodule colorSubmodule { get; set; }
public bool haveBaseColor => true;
public bool haveEmissionColor => true;
@@ -44,6 +44,7 @@ namespace Ichni.RhythmGame
{
ParticleTracker particleTracker = Instantiate(GameManager.instance.basePrefabs.particleTracker, track.transform)
.GetComponent<ParticleTracker>();
particleTracker.particle = particleTracker.GetComponent<ParticleSystem>();
particleTracker.Initialize(elementName, id, tags, isFirstGenerated, track);
particleTracker.track = track;
particleTracker.particleController.spline = track.trackPathSubmodule.path;
@@ -51,7 +52,7 @@ namespace Ichni.RhythmGame
particleTracker.stopTime = stopTime;
particleTracker.themeBundleName = themeBundleName;
particleTracker.materialName = materialName;
particleTracker.SetParticleMaterial(themeBundleName, materialName);
(particleTracker as IHaveParticles).SetParticleMaterial(themeBundleName, materialName);
particleTracker.SetParticleSettings(prewarm, is3D, width, extendDirection, density, lifeTime, isAutoOrient, particleRotation);
return particleTracker;
}
@@ -60,21 +61,9 @@ namespace Ichni.RhythmGame
{
colorSubmodule = new ColorSubmodule(this, Color.white, true, Color.white, 0);
}
public void SetParticleMaterial(string themeBundleName, string materialName)
{
Material material = ThemeBundleManager.instance.GetObject<Material>(themeBundleName, materialName) ??
GameManager.instance.basePrefabs.defaultParticleMaterial;
Renderer particleRenderer = particle.GetComponent<Renderer>();
particleRenderer.material = material;
particleRenderer.InitializeShader();
}
public void SetParticleSettings(bool prewarm,
bool is3D, float width, Vector3 extendDirection,
float density, float lifeTime,
bool isAutoOrient, Vector3 particleRotation)
public void SetParticleSettings(bool prewarm, bool is3D, float width, Vector3 extendDirection,
float density, float lifeTime, bool isAutoOrient, Vector3 particleRotation)
{
this.prewarm = prewarm;
this.is3D = is3D;
@@ -85,12 +74,9 @@ namespace Ichni.RhythmGame
this.prewarm = prewarm;
this.isAutoOrient = isAutoOrient;
this.particleRotation = particleRotation;
SetPrewarm();
(this as IHaveParticles).SetParticleSettings(prewarm, ParticleSystemSimulationSpace.Local, density,
lifeTime, 0, 1, isAutoOrient, particleRotation);
SetShape();
SetDensity();
SetLifeTime();
SetAlignment();
}
}
@@ -130,50 +116,7 @@ namespace Ichni.RhythmGame
particleController.extendDirection = extendDirection;
particleController.Rebuild();
}
private void SetDensity()
{
var emission = particle.emission;
emission.rateOverTime = density;
}
private void SetLifeTime()
{
var mainModule = particle.main;
mainModule.startLifetime = lifeTime;
}
private void SetPrewarm()
{
var mainModule = particle.main;
mainModule.prewarm = prewarm;
}
private void SetAlignment()
{
ParticleSystemRenderer particleSystemRenderer = particle.GetComponent<ParticleSystemRenderer>();
var mainModule = particle.main;
if (isAutoOrient)
{
particleSystemRenderer.alignment = ParticleSystemRenderSpace.View;
mainModule.startRotation3D = false; // 禁用3D旋转
}
else
{
particleSystemRenderer.alignment = ParticleSystemRenderSpace.Local;
mainModule.startRotation3D = true; // 启用3D旋转
SetParticleRotation();
}
}
private void SetParticleRotation()
{
var mainModule = particle.main;
mainModule.startRotationX = particleRotation.x * Mathf.Deg2Rad;
mainModule.startRotationY = particleRotation.y * Mathf.Deg2Rad;
mainModule.startRotationZ = particleRotation.z * Mathf.Deg2Rad;
}
public override void Refresh()
{
base.Refresh();

View File

@@ -3,6 +3,7 @@ using System.Collections;
using System.Collections.Generic;
using Dreamteck.Splines;
using Ichni.RhythmGame.Beatmap;
using UniRx;
using UnityEngine;
namespace Ichni.RhythmGame
@@ -60,6 +61,11 @@ namespace Ichni.RhythmGame
}
trackPositioner.SetPercent(trackPercent.value);
trackPositioner.RebuildImmediate();
/*Debug.Log(trackSwitch.value + " " + trackPercent.value + " " +
nowAttachedTrack.trackPathSubmodule.path.EvaluatePosition(trackPercent.value) + " " +
transform.position + " " + transform.eulerAngles);*/
}
}

View File

@@ -40,7 +40,6 @@ namespace Ichni.RhythmGame
{
timeDurationSubmodule = new TimeDurationSubmodule(this);
}
public void Update()
{
if (track.timeDurationSubmodule.CheckTimeInDuration(GameManager.instance.songTime))

View File

@@ -60,11 +60,14 @@ namespace Ichni.RhythmGame
SetEnableEmission();
SetEmissionIntensity();
SetUV();
if (track.trackTimeSubmodule is TrackTimeSubmoduleMovable)
}
protected void SetMesh()
{
if (track.trackTimeSubmodule is TrackTimeSubmoduleMovable trackTimeSubmoduleMovable)
{
meshGenerator.clipFrom = 0;
meshGenerator.clipTo = 0;
meshGenerator.clipFrom = trackTimeSubmoduleMovable.tailPercent;
meshGenerator.clipTo = trackTimeSubmoduleMovable.headPercent;
}
else
{
@@ -124,6 +127,7 @@ namespace Ichni.RhythmGame
this.splineRenderer.color = Color.white;
this.splineRenderer.uvRotation = 90;
this.splineRenderer.uvMode = MeshGenerator.UVMode.UniformClip;
SetMesh();
}
public override void SaveBM()
@@ -178,7 +182,7 @@ namespace Ichni.RhythmGame
{
public PathGenerator pathGenerator;
public TrackRendererSubmodulePathGenerator(Track track, bool enableEmission, float emissionIntensity,
public TrackRendererSubmodulePathGenerator(Track track, bool enableEmission, float emissionIntensity,
bool zWrite, Vector2 uvScale, Vector2 uvOffset, Material material = null) :
base(track, enableEmission, emissionIntensity, zWrite, uvScale, uvOffset)
{
@@ -194,8 +198,10 @@ namespace Ichni.RhythmGame
this.pathGenerator.color = Color.white;
this.pathGenerator.uvRotation = 90;
this.pathGenerator.uvMode = MeshGenerator.UVMode.UniformClip;
SetMesh();
}
public override void SaveBM()
{
matchedBM = new TrackRendererSubmodulePathGenerator_BM(attachedGameElement, this);
@@ -268,6 +274,7 @@ namespace Ichni.RhythmGame
this.tubeGenerator.uvRotation = 90;
this.tubeGenerator.sides = sideCount;
this.tubeGenerator.uvMode = MeshGenerator.UVMode.UniformClip;
SetMesh();
}
public override void SaveBM()
@@ -340,6 +347,7 @@ namespace Ichni.RhythmGame
this.surface.color = Color.white;
this.surface.uvRotation = 90;
this.surface.uvMode = MeshGenerator.UVMode.UniformClip;
SetMesh();
}
public override void SaveBM()

View File

@@ -134,11 +134,6 @@ namespace Ichni.RhythmGame
public override void Refresh()
{
if (track.trackRendererSubmodule != null)
{
track.trackRendererSubmodule.meshGenerator.clipFrom = tailPercent;
track.trackRendererSubmodule.meshGenerator.clipTo = headPercent;
}
track.childElementList.ForEach(child =>
{
if (child is NoteBase note)