public void Draw(Matrix view, Matrix projection) { if (laneTexture == null) { laneTexture = new QuadTexture(Globals.Textures["FootHold"]); } laneTexture.SetVerts(MaxX, MinX, -(float)Globals.StepNoteHeightOffset, 300); laneTexture.Draw(view, projection); if (footTexture == null) { footTexture = new QuadTexture(RawX <= TouchSettings.AbsX / 2 ? Globals.Textures["FootLeft"] : Globals.Textures["FootRight"]); } footTexture.SetVerts(X + Globals.FootWidth / 2, X - Globals.FootWidth / 2, -(float)Globals.StepNoteHeightOffset, (float)Globals.StepNoteHeightOffset, -0.05f); footTexture.Draw(view, projection); }
public HitState CheckHold(TouchCollection tc, double currentBeat) { if (currentBeat < StartNote.BeatLocation) { IsPlayerHolding = false; return(HitState.Unknown); } Note firstNote, secondNote; if (Notes[0].BeatLocation > currentBeat) { firstNote = StartNote; secondNote = Notes[0]; } else if (Notes.Count < 2 || Notes.Last().BeatLocation < currentBeat) { IsPlayerHolding = false; return(HitState.Unknown); } else { firstNote = Notes.Reverse <Note>().First(x => x.BeatLocation <= currentBeat); secondNote = Notes.First(x => x.BeatLocation >= currentBeat); } if (firstNote == null || secondNote == null) { IsPlayerHolding = false; return(HitState.Unknown); } bool useFirstNote = false; double noteMin = 0, noteMax = 0; // Interpolate based on currentBeat switch (secondNote.Type) { case NoteType.Step: // Shouldn't be possible case NoteType.Motion: IsPlayerHolding = false; return(HitState.Unknown); case NoteType.Hold: // Lane index and width is the same as the first note case NoteType.Shuffle: // Actual shuffle motion is not calculated here (but perhaps we need to figure in some dead space?) useFirstNote = true; break; case NoteType.Slide: // Lane index and width must be interpolated double fNoteMin = Globals.CalcTransX(firstNote, Side.Left); double fNoteMax = Globals.CalcTransX(firstNote, Side.Right); double sNoteMin = Globals.CalcTransX(secondNote, Side.Left); double sNoteMax = Globals.CalcTransX(secondNote, Side.Right); double ratio = (currentBeat - firstNote.BeatLocation) / (secondNote.BeatLocation - firstNote.BeatLocation); noteMin = (sNoteMin - fNoteMin) * ratio + fNoteMin; noteMax = (sNoteMax - fNoteMax) * ratio + fNoteMax; break; default: break; } if (useFirstNote) { noteMin = Globals.CalcTransX(firstNote, Side.Left); noteMax = Globals.CalcTransX(firstNote, Side.Right); } var validPoints = tc.Points.Where(x => x.Value.MinX <noteMax && x.Value.MaxX> noteMin).ToList(); if (validPoints.Count == 0 && !(Globals.AutoMode == GameSettingsScreen.AutoMode.Auto)) { IsPlayerHolding = false; } else { IsPlayerHolding = true; HitTexture.SetVerts((float)noteMax, (float)noteMin, (float)-Globals.StepNoteHeightOffset, (float)Globals.StepNoteHeightOffset, 0.1f); } var gradeBeat = GradePoints.Find(x => Math.Abs(x.GradeBeat - currentBeat) < NoteTiming.BeatTolerance && x.State == HitState.Unknown); if (gradeBeat != null) { if (IsPlayerHolding) { gradeBeat.State = HitState.Hit; } else { gradeBeat.State = HitState.Miss; } return(gradeBeat.State); } return(HitState.Unknown); }