Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Vocal fixes #496

Merged
merged 15 commits into from
Jun 26, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
15 commits
Select commit Hold shift + click to select a range
03d464c
Removed outdated todo comment
EscapeNumber001 Jun 2, 2023
52f516c
Merge branch 'dev' of https://github.com/YARC-Official/YARG into dev
EscapeNumber001 Jun 3, 2023
5765558
Merge branch 'dev' of https://github.com/YARC-Official/YARG into dev
EscapeNumber001 Jun 9, 2023
be9f218
Merge branch 'dev' of https://github.com/YARC-Official/YARG into dev
EscapeNumber001 Jun 9, 2023
41f1a59
Fixed Discord not accounting for speed changes
EscapeNumber001 Jun 10, 2023
910bf6c
Formatting tweaks
EscapeNumber001 Jun 10, 2023
a361d28
Merge branch 'dev' of https://github.com/YARC-Official/YARG into dev
EscapeNumber001 Jun 11, 2023
50cd719
Merge branch 'dev' of https://github.com/YARC-Official/YARG into dev
EscapeNumber001 Jun 12, 2023
161771d
Merge branch 'dev' of https://github.com/YARC-Official/YARG into dev
EscapeNumber001 Jun 13, 2023
918d03f
Merge branch 'dev' of https://github.com/YARC-Official/YARG into dev
EscapeNumber001 Jun 16, 2023
95f3ce9
Merge branch 'dev' of https://github.com/YARC-Official/YARG into dev
EscapeNumber001 Jun 20, 2023
51a6514
Merge branch 'dev' of https://github.com/YARC-Official/YARG into dev
EscapeNumber001 Jun 20, 2023
73dcbdc
Merge branch 'dev' of https://github.com/YARC-Official/YARG into dev
EscapeNumber001 Jun 21, 2023
296f138
Fixed vocal performance with song speedups
EscapeNumber001 Jun 26, 2023
01b144b
Vocal particles now account for trackSpeed
EscapeNumber001 Jun 26, 2023
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 8 additions & 2 deletions Assets/Script/PlayMode/MicPlayer.cs
Original file line number Diff line number Diff line change
Expand Up @@ -210,7 +210,11 @@ private void Start() {
// Spawn needle
var needle = Instantiate(needlePrefab, transform).GetComponent<VocalNeedle>();
needle.transform.localPosition = needlePrefab.transform.position;
needle.ParticleSpeed = trackSpeed;
needle.SetLineProperties(
4f / trackSpeed,
trackSpeed,
trackSpeed / 4f * 50.0f
);

// Create player info
var playerInfo = new PlayerInfo {
Expand Down Expand Up @@ -871,14 +875,16 @@ private void CalculateSectionSingTime(float start) {
}

private float GetSingTimeMultiplier(Difficulty diff) {
return diff switch {
float multiplier = diff switch {
Difficulty.EASY => 0.45f,
Difficulty.MEDIUM => 0.5f,
Difficulty.HARD => 0.55f,
Difficulty.EXPERT => 0.6f,
Difficulty.EXPERT_PLUS => 0.7f,
_ => throw new Exception("Unreachable.")
};

return multiplier / Play.speed;
}

private float CalcLagCompensation(float currentTime, float noteTime) {
Expand Down
18 changes: 8 additions & 10 deletions Assets/Script/PlayMode/VocalNeedle.cs
Original file line number Diff line number Diff line change
Expand Up @@ -11,18 +11,16 @@ public class VocalNeedle : MonoBehaviour {
[SerializeField]
private Texture2D[] needleTextures;

private float _particleSpeed;
public float ParticleSpeed {
get {
return _particleSpeed;
}
set {
_particleSpeed = value;
activeParticles.SetStartSpeed(value);
nonActiveParticles.SetStartSpeed(value);
}
public void SetLineProperties(float lifetime, float startSpeed, float emissionRate) {
activeParticles.SetStartLifetime(lifetime);
activeParticles.SetStartSpeed(startSpeed);
activeParticles.SetEmissionRate(emissionRate);
nonActiveParticles.SetStartLifetime(lifetime);
nonActiveParticles.SetStartSpeed(startSpeed);
nonActiveParticles.SetEmissionRate(emissionRate);
}


private void Start() {
// Give random needle (for now)
meshRenderer.material.mainTexture = needleTextures[Random.Range(0, needleTextures.Length)];
Expand Down
14 changes: 14 additions & 0 deletions Assets/Script/Util/ParticleGroup.cs
Original file line number Diff line number Diff line change
Expand Up @@ -67,6 +67,20 @@ public void SetStartSpeed(float speed) {
}
}

public void SetStartLifetime(float lifetime) {
foreach (var particle in particles) {
var main = particle.main;
main.startLifetime = lifetime;
}
}

public void SetEmissionRate(float rate) {
foreach (var particle in particles) {
var e = particle.emission;
e.rateOverTime = rate;
}
}

public void Play(float speed = 4.0f) {
foreach (var particle in particles) {
if (particle.main.loop && particle.isEmitting) {
Expand Down