update
This commit is contained in:
@@ -88,7 +88,7 @@ namespace Ichni.RhythmGame
|
||||
|
||||
if (this is IHaveColorSubmodule colorSource)
|
||||
{
|
||||
colorSource.UpdateColor();
|
||||
colorSource.UpdateColor(false);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -33,7 +33,18 @@ namespace Ichni.RhythmGame
|
||||
|
||||
public override void PreExecute()
|
||||
{
|
||||
offsetTweener = gameCameraTransform.DOBlendableLocalMoveBy(offsetValue, duration).SetEase(offsetCurve);
|
||||
offsetTweener = gameCameraTransform.DOBlendableLocalMoveBy(offsetValue, duration).SetEase(offsetCurve).Play();
|
||||
}
|
||||
|
||||
public override void Adjust()
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
public override void Disrupt()
|
||||
{
|
||||
offsetTweener?.Kill();
|
||||
gameCameraTransform.DOLocalMove(Vector3.zero, 0.4f).Play();
|
||||
}
|
||||
|
||||
public override EffectBase_BM ConvertToBM()
|
||||
|
||||
@@ -31,7 +31,7 @@ namespace Ichni.RhythmGame
|
||||
|
||||
public override void PreExecute()
|
||||
{
|
||||
tiltTweener = gameCameraTransform.DOBlendableLocalRotateBy(tiltValue, duration, RotateMode.FastBeyond360).SetEase(tiltCurve);
|
||||
tiltTweener = gameCameraTransform.DOBlendableLocalRotateBy(tiltValue, duration, RotateMode.FastBeyond360).SetEase(tiltCurve).Play();
|
||||
}
|
||||
|
||||
public override void Adjust()
|
||||
@@ -47,7 +47,7 @@ namespace Ichni.RhythmGame
|
||||
public override void Disrupt()
|
||||
{
|
||||
tiltTweener?.Kill();
|
||||
gameCameraTransform.DOLocalRotate(Vector3.zero, 0.4f);
|
||||
gameCameraTransform.DOLocalRotate(Vector3.zero, 0.4f).Play();
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -0,0 +1,273 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using Ichni.RhythmGame.Beatmap;
|
||||
using UnityEngine;
|
||||
using Object = UnityEngine.Object;
|
||||
|
||||
namespace Ichni.RhythmGame
|
||||
{
|
||||
|
||||
public partial class ParticleEmitter : GameElement, IHaveParticles, IHaveTimeDurationSubmodule, IHaveTransformSubmodule, IHaveColorSubmodule
|
||||
{
|
||||
public ParticleSystem particle { get; set; }
|
||||
private IHaveParticles particlesContainer => this;
|
||||
public TimeDurationSubmodule timeDurationSubmodule { get; set; }
|
||||
public TransformSubmodule transformSubmodule { get; set; }
|
||||
public ColorSubmodule colorSubmodule { get; set; }
|
||||
public bool haveBaseColor => true;
|
||||
public bool haveEmissionColor => true;
|
||||
|
||||
private List<string> themeBundleList;
|
||||
private List<string> materialNameList;
|
||||
public string themeBundleName;
|
||||
public string materialName;
|
||||
|
||||
public bool prewarm;
|
||||
public float playTime;
|
||||
public float stopTime;
|
||||
|
||||
public ParticleSystemSimulationSpace simulationSpace;
|
||||
public float density;
|
||||
public float lifeTime;
|
||||
public float speed;
|
||||
public float radius;
|
||||
|
||||
public bool isAutoOrient;
|
||||
public Vector3 particleRotation;
|
||||
|
||||
public static ParticleEmitter GenerateElement(string elementName, Guid id, List<string> tags,
|
||||
bool isFirstGenerated, GameElement parentElement, string themeBundleName, string materialName,
|
||||
bool prewarm, float playTime, float stopTime, ParticleSystemSimulationSpace simulationSpace,
|
||||
float density, float lifeTime, float speed, float radius,
|
||||
bool isAutoOrient, Vector3 particleRotation)
|
||||
{
|
||||
ParticleEmitter particleEmitter = Instantiate(GameManager.instance.basePrefabs.particleEmitter, parentElement.transform)
|
||||
.GetComponent<ParticleEmitter>();
|
||||
particleEmitter.particle = particleEmitter.GetComponent<ParticleSystem>();
|
||||
particleEmitter.Initialize(elementName, id, tags, isFirstGenerated, parentElement);
|
||||
particleEmitter.playTime = playTime;
|
||||
particleEmitter.stopTime = stopTime;
|
||||
particleEmitter.themeBundleList = ThemeBundleManager.instance.loadedThemeBundleList.ConvertAll(x => x.themeBundleName);
|
||||
particleEmitter.materialNameList = new List<string>();
|
||||
particleEmitter.themeBundleName = themeBundleName;
|
||||
particleEmitter.materialName = materialName;
|
||||
particleEmitter.particlesContainer.SetParticleMaterial(themeBundleName, materialName);
|
||||
particleEmitter.SetParticleSettings(prewarm, simulationSpace, density, lifeTime, speed, radius, isAutoOrient, particleRotation, false);
|
||||
return particleEmitter;
|
||||
}
|
||||
|
||||
public void SetParticleSettings(bool prewarm, ParticleSystemSimulationSpace simulationSpace,
|
||||
float density, float lifeTime, float speed, float radius, bool isAutoOrient, Vector3 particleRotation, bool mark)
|
||||
{
|
||||
//这个Mark没有任何作用,只是为了让解释器把interface中的函数和这个函数区分开。否则会Stackoverflow。
|
||||
this.prewarm = prewarm;
|
||||
this.simulationSpace = simulationSpace;
|
||||
this.density = density;
|
||||
this.lifeTime = lifeTime;
|
||||
this.speed = speed;
|
||||
this.radius = radius;
|
||||
this.isAutoOrient = isAutoOrient;
|
||||
this.particleRotation = particleRotation;
|
||||
(this as IHaveParticles).SetParticleSettings(prewarm, simulationSpace, density, lifeTime, speed, radius, isAutoOrient, particleRotation);
|
||||
}
|
||||
|
||||
public override void SetDefaultSubmodules()
|
||||
{
|
||||
timeDurationSubmodule = new TimeDurationSubmodule(this);
|
||||
transformSubmodule = new TransformSubmodule(this);
|
||||
colorSubmodule = new ColorSubmodule(this, Color.white, true, Color.white, 0);
|
||||
}
|
||||
}
|
||||
|
||||
public partial class ParticleEmitter
|
||||
{
|
||||
private void Update()
|
||||
{
|
||||
float songTime = GameManager.instance.songTime;
|
||||
if (playTime > songTime || stopTime < songTime)
|
||||
{
|
||||
particle.Stop();
|
||||
}
|
||||
else
|
||||
{
|
||||
if (!particle.isPlaying)
|
||||
{
|
||||
particle.Play();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public override void Refresh()
|
||||
{
|
||||
base.Refresh();
|
||||
ParticleSystemRenderer particleSystemRenderer = particle.GetComponent<ParticleSystemRenderer>();
|
||||
particleSystemRenderer.material.SetColor("_BaseColor", colorSubmodule.currentBaseColor);
|
||||
if (colorSubmodule.emissionEnabled)
|
||||
{
|
||||
particleSystemRenderer.material.EnableKeyword("_EMISSION_ON");
|
||||
particleSystemRenderer.material.SetColor("_EmissionColor", colorSubmodule.GetCurrentEmissionColor());
|
||||
}
|
||||
else
|
||||
{
|
||||
particleSystemRenderer.material.DisableKeyword("_EMISSION_ON");
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public partial class ParticleEmitter
|
||||
{
|
||||
public override void SaveBM()
|
||||
{
|
||||
matchedBM = new ParticleEmitter_BM(elementName, elementGuid, tags, parentElement.matchedBM as GameElement_BM,
|
||||
prewarm, playTime, stopTime, simulationSpace, density, lifeTime, speed, radius,
|
||||
isAutoOrient, particleRotation, themeBundleName, materialName);
|
||||
}
|
||||
}
|
||||
|
||||
namespace Beatmap
|
||||
{
|
||||
public class ParticleEmitter_BM : GameElement_BM
|
||||
{
|
||||
public bool prewarm = false;
|
||||
public float playTime = 0f;
|
||||
public float stopTime = 1f;
|
||||
|
||||
public ParticleSystemSimulationSpace simulationSpace;
|
||||
public float density = 10;
|
||||
public float lifeTime = 5;
|
||||
public float speed;
|
||||
public float radius;
|
||||
|
||||
public bool isAutoOrient = true;
|
||||
public Vector3 particleRotation = Vector3.zero;
|
||||
|
||||
public string materialThemeBundleName = string.Empty;
|
||||
public string materialName = string.Empty;
|
||||
|
||||
public ParticleEmitter_BM()
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
public ParticleEmitter_BM(string elementName, Guid elementGuid, List<string> tags, GameElement_BM attachedElement,
|
||||
bool prewarm, float playTime, float stopTime, ParticleSystemSimulationSpace simulationSpace,
|
||||
float density, float lifeTime, float speed, float radius, bool isAutoOrient, Vector3 particleRotation,
|
||||
string materialThemeBundleName, string materialName) :
|
||||
base(elementName, elementGuid, tags, attachedElement)
|
||||
{
|
||||
this.prewarm = prewarm;
|
||||
this.playTime = playTime;
|
||||
this.stopTime = stopTime;
|
||||
this.simulationSpace = simulationSpace;
|
||||
this.density = density;
|
||||
this.lifeTime = lifeTime;
|
||||
this.speed = speed;
|
||||
this.radius = radius;
|
||||
this.isAutoOrient = isAutoOrient;
|
||||
this.particleRotation = particleRotation;
|
||||
this.materialThemeBundleName = materialThemeBundleName;
|
||||
this.materialName = materialName;
|
||||
}
|
||||
|
||||
public override void ExecuteBM()
|
||||
{
|
||||
matchedElement = ParticleEmitter.GenerateElement(elementName, elementGuid, tags, false,
|
||||
GetElement(attachedElementGuid), materialThemeBundleName, materialName,
|
||||
prewarm, playTime, stopTime, simulationSpace, density, lifeTime, speed, radius,
|
||||
isAutoOrient, particleRotation);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public interface IHaveParticles
|
||||
{
|
||||
public ParticleSystem particle { get; set; }
|
||||
|
||||
public virtual void SetParticleMaterial(string themeBundleName, string materialName)
|
||||
{
|
||||
Material material = ThemeBundleManager.instance.GetObject<Material>(themeBundleName, materialName);
|
||||
if (material == null)
|
||||
{
|
||||
material = ThemeBundleManager.instance.GetObject<Material>("basic", "Basic_Track_Default");
|
||||
}
|
||||
|
||||
Renderer particleRenderer = particle.GetComponent<Renderer>();
|
||||
particleRenderer.material = Object.Instantiate(material);
|
||||
particleRenderer.InitializeShader();
|
||||
}
|
||||
|
||||
public virtual void SetParticleSettings(bool prewarm, ParticleSystemSimulationSpace simulationSpace, float density, float lifeTime,
|
||||
float speed, float radius, bool isAutoOrient, Vector3 particleRotation)
|
||||
{
|
||||
SetPrewarm(prewarm);
|
||||
SetSimulationSpace(simulationSpace);
|
||||
SetDensity(density);
|
||||
SetLifeTime(lifeTime);
|
||||
SetSpeed(speed);
|
||||
SetRadius(radius);
|
||||
SetAlignment(isAutoOrient, particleRotation);
|
||||
}
|
||||
|
||||
public void SetPrewarm(bool prewarm)
|
||||
{
|
||||
var mainModule = particle.main;
|
||||
mainModule.prewarm = prewarm;
|
||||
}
|
||||
|
||||
public void SetSimulationSpace(ParticleSystemSimulationSpace simulationSpace)
|
||||
{
|
||||
var mainModule = particle.main;
|
||||
mainModule.simulationSpace = simulationSpace;
|
||||
}
|
||||
|
||||
public void SetDensity(float density)
|
||||
{
|
||||
var emission = particle.emission;
|
||||
emission.rateOverTime = density;
|
||||
}
|
||||
|
||||
public void SetLifeTime(float lifeTime)
|
||||
{
|
||||
var mainModule = particle.main;
|
||||
mainModule.startLifetime = lifeTime;
|
||||
}
|
||||
|
||||
public void SetSpeed(float speed)
|
||||
{
|
||||
var mainModule = particle.main;
|
||||
mainModule.startSpeed = speed;
|
||||
}
|
||||
|
||||
public void SetRadius(float radius)
|
||||
{
|
||||
var shapeModule = particle.shape;
|
||||
shapeModule.radius = radius;
|
||||
}
|
||||
|
||||
public void SetAlignment(bool isAutoOrient, Vector3 particleRotation = default)
|
||||
{
|
||||
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(particleRotation);
|
||||
}
|
||||
}
|
||||
|
||||
public void SetParticleRotation(Vector3 particleRotation)
|
||||
{
|
||||
Vector3 vector3Rotation = particleRotation * Mathf.Deg2Rad;
|
||||
var mainModule = particle.main;
|
||||
mainModule.startRotationX = vector3Rotation.x;
|
||||
mainModule.startRotationY = vector3Rotation.y;
|
||||
mainModule.startRotationZ = vector3Rotation.z;
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,11 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 0bd980b161a6b6143b2ed58e3184d499
|
||||
MonoImporter:
|
||||
externalObjects: {}
|
||||
serializedVersion: 2
|
||||
defaultReferences: []
|
||||
executionOrder: 0
|
||||
icon: {instanceID: 0}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
@@ -43,7 +43,6 @@ namespace Ichni.RhythmGame
|
||||
{
|
||||
float x = Mathf.Lerp(Screen.width, bottomX, intensityCurve.Evaluate(effectProgressPercent));
|
||||
float y = Mathf.Lerp(Screen.height, bottomY, intensityCurve.Evaluate(effectProgressPercent));
|
||||
//Debug.Log(x + ", " + y);
|
||||
|
||||
GameManager.instance.postProcessingManager.SetPixelateStrength(x,y);
|
||||
}
|
||||
@@ -52,6 +51,8 @@ namespace Ichni.RhythmGame
|
||||
{
|
||||
GameManager.instance.postProcessingManager.SetPixelateStrength(Screen.width, Screen.height);
|
||||
GameManager.instance.postProcessingManager.SetFeatureActive(false);
|
||||
|
||||
Debug.Log("PixelateEffect Adjusted");
|
||||
}
|
||||
|
||||
public override EffectBase_BM ConvertToBM()
|
||||
|
||||
@@ -26,7 +26,7 @@ namespace Ichni.RhythmGame
|
||||
|
||||
public override void UpdateJudge()
|
||||
{
|
||||
if (note.isFirstJudged) return;
|
||||
if ((note is not Hold && note.isFirstJudged)||(note is Hold && note.isFinalJudged)) return;
|
||||
Vector2 noteScreenPosition = note.noteScreenPosition;
|
||||
RectTransform canvasRect = GameManager.instance.judgeHintCanvas.GetComponent<RectTransform>();
|
||||
if (RectTransformUtility.ScreenPointToLocalPointInRectangle(canvasRect, noteScreenPosition, null, out Vector2 uiPosition))
|
||||
|
||||
@@ -7,7 +7,7 @@ namespace Ichni.RhythmGame
|
||||
{
|
||||
public abstract class NotePerfectEffect : NoteEffectBase
|
||||
{
|
||||
|
||||
public override bool IsPost => true;
|
||||
}
|
||||
|
||||
namespace Beatmap
|
||||
|
||||
@@ -140,7 +140,7 @@ namespace Ichni.RhythmGame
|
||||
{
|
||||
if (inputUnitSwipe.isGeneric)
|
||||
{
|
||||
Debug.Log($"输入方向 {inputUnitSwipe.swipeDirection} 是通用的,直接匹配成功。");
|
||||
//Debug.Log($"输入方向 {inputUnitSwipe.swipeDirection} 是通用的,直接匹配成功。");
|
||||
return true;
|
||||
}
|
||||
|
||||
|
||||
@@ -79,7 +79,7 @@ namespace Ichni.RhythmGame
|
||||
|
||||
noteAudioSubmodule.PlayHoldStartAudio();
|
||||
|
||||
Debug.Log($"Hold Note Start Judge: {startJudgeType} at {triggerTime}");
|
||||
//Debug.Log($"Hold Note Start Judge: {startJudgeType} at {triggerTime}");
|
||||
}
|
||||
|
||||
public void ExecuteProcessJudge()
|
||||
@@ -89,6 +89,19 @@ namespace Ichni.RhythmGame
|
||||
|
||||
public void ExecuteFinalJudge()
|
||||
{
|
||||
foreach (EffectBase effect in noteVisual.effectSubmodule.effectCollection["StartHold"])
|
||||
{
|
||||
if (effect.nowEffectState == EffectBase.EffectState.Middle)
|
||||
{
|
||||
effect.Adjust();
|
||||
}
|
||||
}
|
||||
|
||||
foreach (EffectBase effect in noteVisual.effectSubmodule.effectCollection["Holding"])
|
||||
{
|
||||
effect.Adjust();
|
||||
}
|
||||
|
||||
float triggerTime = GameManager.instance.songTime;
|
||||
postTimeDifference = holdEndTime - triggerTime;
|
||||
|
||||
@@ -105,7 +118,7 @@ namespace Ichni.RhythmGame
|
||||
postJudgeType = NoteJudgeType.Bad;
|
||||
}
|
||||
|
||||
Debug.Log($"Hold Note Final Judge: {postJudgeType} at {triggerTime} of difference {postTimeDifference}");
|
||||
//Debug.Log($"Hold Note Final Judge: {postJudgeType} at {triggerTime} of difference {postTimeDifference}");
|
||||
|
||||
NoteJudgeType finalJudge = GetLowerType(preJudgeType, postJudgeType);
|
||||
float finalTimeDifference = Mathf.Min(preTimeDifference, postTimeDifference);
|
||||
@@ -168,6 +181,24 @@ namespace Ichni.RhythmGame
|
||||
GameManager.instance.noteJudgeManager.checkingHoldList.Remove(this);
|
||||
}
|
||||
}
|
||||
|
||||
public override void SetPerfectPosition()
|
||||
{
|
||||
if (isOnTrack && track.trackTimeSubmodule is TrackTimeSubmoduleMovable movable)
|
||||
{
|
||||
holdingTime = holdEndTime - exactJudgeTime;
|
||||
(noteVisual as INoteVisualHold)?.UpdateHoldInMovableTrack();
|
||||
}
|
||||
}
|
||||
|
||||
protected override void SlowOffsetAfterExactJudgeTime()
|
||||
{
|
||||
if (isOnTrack && track.trackTimeSubmodule is TrackTimeSubmoduleMovable movable)
|
||||
{
|
||||
holdingTime = GameManager.instance.songTime - exactJudgeTime;
|
||||
(noteVisual as INoteVisualHold)?.UpdateHoldInMovableTrack();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public partial class Hold
|
||||
@@ -270,6 +301,11 @@ namespace Ichni.RhythmGame
|
||||
|
||||
SetJudgeArea();
|
||||
|
||||
if (!isFirstJudged && exactJudgeTime < GameManager.instance.songTime)
|
||||
{
|
||||
SlowOffsetAfterExactJudgeTime();
|
||||
}
|
||||
|
||||
foreach (EffectBase e in noteVisual.effectSubmodule.effectCollection["Generate"])
|
||||
{
|
||||
e.UpdateEffect(exactJudgeTime);
|
||||
@@ -297,6 +333,12 @@ namespace Ichni.RhythmGame
|
||||
{
|
||||
isHolding = false;
|
||||
isFinalJudged = true;
|
||||
|
||||
foreach (EffectBase e in noteVisual.effectSubmodule.effectCollection["StartHold"])
|
||||
{
|
||||
e.Disrupt();
|
||||
}
|
||||
|
||||
ExecuteFinalJudge();
|
||||
RemoveFromCheckingList();
|
||||
}
|
||||
|
||||
@@ -129,6 +129,11 @@ namespace Ichni.RhythmGame
|
||||
e.UpdateEffect(exactJudgeTime);
|
||||
}
|
||||
|
||||
if (!isFirstJudged && exactJudgeTime < GameManager.instance.songTime)
|
||||
{
|
||||
SlowOffsetAfterExactJudgeTime();
|
||||
}
|
||||
|
||||
if (!isFirstJudged && GameManager.instance.songTime > exactJudgeTime + judgeIntervals.afterMiss)
|
||||
{
|
||||
Miss(exactJudgeTime + judgeIntervals.afterMiss);
|
||||
@@ -177,7 +182,23 @@ namespace Ichni.RhythmGame
|
||||
Observable.EveryUpdate().Subscribe(_ =>
|
||||
{
|
||||
noteVisual.effectSubmodule.effectCollection["GeneralJudge"].ForEach(e => e.UpdateEffect(triggerTime));
|
||||
noteVisual.effectSubmodule.effectCollection["Perfect"].ForEach(e => e.UpdateEffect(triggerTime));
|
||||
|
||||
foreach (var e in noteVisual.effectSubmodule.effectCollection["Perfect"])
|
||||
{
|
||||
if (!e.IsPost)
|
||||
{
|
||||
e.UpdateEffect(triggerTime);
|
||||
}
|
||||
}
|
||||
|
||||
foreach (var e in noteVisual.effectSubmodule.effectCollection["Perfect"])
|
||||
{
|
||||
if (e.IsPost)
|
||||
{
|
||||
e.UpdateEffect(triggerTime);
|
||||
}
|
||||
}
|
||||
|
||||
noteVisual.effectSubmodule.effectCollection["AfterJudge"].ForEach(e => e.UpdateEffect(exactJudgeTime));
|
||||
}).AddTo(gameObject);
|
||||
|
||||
@@ -328,7 +349,7 @@ namespace Ichni.RhythmGame
|
||||
}
|
||||
}
|
||||
|
||||
public void SetPerfectPosition()
|
||||
public virtual void SetPerfectPosition()
|
||||
{
|
||||
if (isOnTrack && track.trackTimeSubmodule is TrackTimeSubmoduleMovable movable)
|
||||
{
|
||||
@@ -336,6 +357,30 @@ namespace Ichni.RhythmGame
|
||||
trackPositioner.SetPercent(notePercent);
|
||||
}
|
||||
}
|
||||
|
||||
protected virtual void SlowOffsetAfterExactJudgeTime()
|
||||
{
|
||||
if (isOnTrack && track.trackTimeSubmodule is TrackTimeSubmoduleMovable movable)
|
||||
{
|
||||
float slowedTime = (GameManager.instance.songTime - exactJudgeTime) * 0.8f;
|
||||
float notePercent = movable.GetTrackPercent(exactJudgeTime + slowedTime);
|
||||
trackPositioner.SetPercent(notePercent);
|
||||
}
|
||||
}
|
||||
|
||||
/*public virtual void SlowOffsetAfterExactJudgeTime()
|
||||
{
|
||||
if (isOnTrack && track.trackTimeSubmodule is TrackTimeSubmoduleMovable movable)
|
||||
{
|
||||
float timeDifference = GameManager.instance.songTime - exactJudgeTime;
|
||||
float percent = Mathf.Lerp(0f, 1f, timeDifference / (judgeIntervals.afterMiss + 0.2f));
|
||||
float slowedTime = (GameManager.instance.songTime - exactJudgeTime) * percent;
|
||||
//float percent = Mathf.Lerp(0, 0.5f, timeDifference / judgeIntervals.afterMiss);
|
||||
//float slowedTime = (GameManager.instance.songTime - exactJudgeTime) * 0.5f;
|
||||
float notePercent = movable.GetTrackPercent(exactJudgeTime + slowedTime);
|
||||
trackPositioner.SetPercent(notePercent);
|
||||
}
|
||||
}*/
|
||||
}
|
||||
|
||||
public abstract partial class NoteBase
|
||||
|
||||
@@ -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();
|
||||
|
||||
@@ -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);*/
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -40,7 +40,6 @@ namespace Ichni.RhythmGame
|
||||
{
|
||||
timeDurationSubmodule = new TimeDurationSubmodule(this);
|
||||
}
|
||||
|
||||
public void Update()
|
||||
{
|
||||
if (track.timeDurationSubmodule.CheckTimeInDuration(GameManager.instance.songTime))
|
||||
|
||||
@@ -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()
|
||||
|
||||
@@ -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)
|
||||
|
||||
Reference in New Issue
Block a user