private void senseKeyPresses() { //sense which keys are pressed foreach (int laneIdx in input.keysIndiciesPressedButton) { Lane lane = lanes[laneIdx]; lane.makePressVFx(); instrument.Play(); GameObject lowestNote = lane.getLowestNote(); if (lowestNote != null) { float distance = (lowestNote.transform.position - lane.noteTarget.transform.position).magnitude; if (distance < 0.5) { lane.noteTapVFx(PressAccuracy.Perfect); } else if (distance < 1) { lane.noteTapVFx(PressAccuracy.Good); } else { lane.noteTapVFx(PressAccuracy.Miss); } } Destroy(lowestNote); } }
private void senseKeyPresses() { //sense which keys are pressed foreach (int laneIdx in input.keysIndiciesPressedButton) { Lane lane = lanes[laneIdx]; lane.makePressVFx(); GameObject lowestNote = lane.getLowestNote(); if (lowestNote != null) { float distance = (lowestNote.transform.position - lane.noteTarget.transform.position).magnitude; if (distance < 0.5) { lane.noteTapVFx(PressAccuracy.Perfect); } else if (distance < 1) { lane.noteTapVFx(PressAccuracy.Good); } else { lane.noteTapVFx(PressAccuracy.Miss); } } Destroy(lowestNote); } //if the answer is close. for now. just be happy. //if the answer is far. for now. just be sad. //maybe one for medium distance if you can swing it. }