public bool InEndHitWindow(HitEvent currentNote, double _localCurrentOffset) { if (_localCurrentOffset >= currentNote.getEndOffset() - okHitWindow && _localCurrentOffset <= currentNote.getEndOffset() + okHitWindow) { return(true); } else { return(false); } }
void spawnStepNote(GameObject ring, Transform spawner, HitEvent hitObject, KeyCode key) { if (hitObject.IsHold()) { int offsetDiff = hitObject.getEndOffset() - hitObject.getOffset(); StopCoroutine(spawnStepHold(ring, spawner, hitObject, offsetDiff, key)); StartCoroutine(spawnStepHold(ring, spawner, hitObject, offsetDiff, key)); } else { var currentRing = Instantiate(ring, spawner.position, spawner.rotation); currentRing.transform.SetParent(noteHolder.transform); currentRing.transform.localScale = ring.transform.localScale; if (hitObject.IsMine()) { currentRing.AddComponent <Mine>().Initialize(spawner.position, hitbox.transform.position, hitObject.getOffset(), scrollDelay, key, hitObject); } else { currentRing.AddComponent <Ring>().Initialize(spawner.position, hitbox.transform.position, hitObject.getOffset(), scrollDelay, key, hitObject); } } }
IEnumerator spawnStepHold(GameObject ring, Transform spawner, HitEvent hitObject, int offsetDiff, KeyCode key) { GameObject startHold = Instantiate(ring, spawner.position, spawner.rotation); startHold.transform.SetParent(noteHolder.transform); startHold.transform.localScale = ring.transform.localScale; startHold.AddComponent <StartHold>(); GameObject midHold = Instantiate(midRing, spawner.position, spawner.rotation); midHold.transform.SetParent(noteHolder.transform); midHold.AddComponent <MidHold>(); GameObject endHold = Instantiate(ring, spawner.position, spawner.rotation); endHold.transform.SetParent(noteHolder.transform); endHold.transform.localScale = ring.transform.localScale; startHold.GetComponent <StartHold>().Initialize(spawner.position, hitbox.transform.position, hitObject.getOffset(), scrollDelay, key, midHold, endHold, noteHolder, hitObject); midHold.GetComponent <MidHold>().Initialize(spawner.position, hitbox.transform.position, hitObject.getOffset(), scrollDelay, key, startHold, endHold, hitObject); yield return(new WaitForSecondsRealtime(offsetDiff / 1000f)); endHold.AddComponent <EndHold>(); endHold.GetComponent <EndHold>().Initialize(spawner.position, hitbox.transform.position, hitObject.getEndOffset(), scrollDelay, key, startHold, midHold, hitObject); }