private void MarkNoteAsHit(BeatlineNote bln, double phraseNumber) { bln.Hit = true; bln.Opacity = 255; bln.DisplayPosition = CalculateAbsoluteBeatlinePosition(bln.Position, phraseNumber); bln.Position = phraseNumber + 0.3; }
/// <summary> /// Calculates the opacity of a beatline note depending on where it is. If it isn't hit, it will fade /// in and out when at the edges of the beatline. If it is hit, it will fade out gradually and remain in position. /// </summary> /// <param name="bn">The BeatlineNote to calculate the opacity for.</param> /// <param name="markerBeatOffset">The calculated markerBeatOffset (calculated as beatline speed * Zoom Distance (constant) * (phrase number - BeatlineNote position value))</param> /// <returns>The opacity of the beatline note.</returns> private byte CalculateNoteOpacity(BeatlineNote bn, double markerBeatOffset) { byte result; if (bn.Hit) { bn.Opacity = Math.Max(0, bn.Opacity - TextureManager.LastDrawnPhraseDiff * HIT_NOTE_FADEOUT_SPEED); result = (byte)bn.Opacity; return(result); } var distTravelled = this.Width - LEFT_SIDE + markerBeatOffset; if (markerBeatOffset > 0) { result = (byte)(Math.Max(0, 255 - 10 * markerBeatOffset)); } else if (distTravelled < 35) { result = (byte)(7 * distTravelled); } else { result = 255; } return(result); }
private float CalculateNotePosition(BeatlineNote bn, double markerBeatOffset) { float result; if (bn.Hit) { result = (float)((LEFT_SIDE * WidthRatio) + (bn.DisplayPosition)); result = Math.Min(this.Width, result); result = Math.Max(0, result); } else { result = (float)((LEFT_SIDE * WidthRatio) - (markerBeatOffset)); } result += this.X; return(result); }
public double CalculateHitOffset(BeatlineNote bln, double phraseNumber) { return((bln.Position - phraseNumber) * 1000 * 240 / Bpm); }
public void InsertBeatlineNote(BeatlineNote bln, int index) { _beatlineNotes.Insert(index, bln); }
public void AddBeatlineNote(BeatlineNote bln) { _beatlineNotes.Insert(0, bln); }