public void ObjectResponse(HitObject nextObject, float speed) { float beatLength = _timingManager.BeatLength(); if (HitObjectUtils.Length(nextObject) >= beatLength / 2 - 0.002f) { FloorUtils.SmartPattern(this, nextObject, beatLength); } else if (_hitObjectManager.NextGap() >= beatLength * 3 - 0.002f) { FloorUtils.PlayPattern(this, Patterns.Droplet, 15, beatLength / 500f, 0, a => { foreach (int t in a) { _squares[t].SetSat(0); _squares[t].ValMode = true; } }); } else { int ct = (int)Mathf.Clamp(speed * 25, 10, 100); int[] changes = Patterns.SmartRandom(ct, _squares); ChangeFloor(changes); } }
public static void SmartPattern(DanceFloor floor, HitObject obj, float beatLength) { if (HitObjectUtils.Length(obj) >= beatLength * 1.5f - 0.002f) { _prevPattern ^= 2; float beats = HitObjectUtils.Length(obj) / beatLength; float ms = Mathf.Ceil(beats) * beatLength; float len = ms / 1000f; //float patternLen = beatLength / (beats % 2 == 0 ? 500f : 1000f); float patternLen = beatLength / 500f; for (float f = 0; f < len - 0.002f; f += patternLen) { FullPattern(floor, patternLen, f, ReversePattern); } } else if (HitObjectUtils.Length(obj) >= beatLength - 0.002f) { float len = HitObjectUtils.Length(obj) / 1000f; FullPattern(floor, len); } else if (HitObjectUtils.Length(obj) >= beatLength / 2 - 0.002f) { float len = HitObjectUtils.Length(obj) / 1000f; HalfPattern(floor, len); } }
public int NextGap() { if (_lastObject != null && _objects.Count > 0) { return(HitObjectUtils.TimeGap(_lastObject, _objects.Peek())); } else { return(-1); } }
public void UpdateObjects(Action <HitObject, float> callback, float audioTime) { if (_objects == null || _objects.Count == 0) { return; } while (ShouldAdvance(audioTime)) { HitObject nextObject = _objects.Dequeue(); if (nextObject.IsNewCombo) { ColorManager.Advance(nextObject.ComboOffset); } float speed = HitObjectUtils.Speed(_lastObject, nextObject); callback.Invoke(nextObject, speed); _lastObject = nextObject; } }