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); } } }
public void spawnNotes(HitEvent hitObject) { switch (hitObject.getKey()) { case 0: // LEFT if (memoryMode || invertedMemoryMode) // Currently in a memory timing section { spawnMemoryNote(diamondRing, diamondRing.transform, hitObject, keyLeft); } else if (hitObject.IsMine()) { spawnStepNote(bigMine, leftSpawnerBig, hitObject, keyLeft); } else { spawnStepNote(bigRing, leftSpawnerBig, hitObject, keyLeft); } break; case 1: // DOWN if (memoryMode || invertedMemoryMode) { spawnMemoryNote(diamondRing, diamondRing.transform, hitObject, keyDown); } else if (hitObject.IsMine()) { spawnStepNote(smallMine, leftSpawnerSmall, hitObject, keyDown); } else { spawnStepNote(smallRing, leftSpawnerSmall, hitObject, keyDown); } break; case 2: // UP if (memoryMode || invertedMemoryMode) { spawnMemoryNote(diamondRing, diamondRing.transform, hitObject, keyUp); } else if (hitObject.IsMine()) { spawnStepNote(smallMine, rightSpawnerSmall, hitObject, keyUp); } else { spawnStepNote(smallRing, rightSpawnerSmall, hitObject, keyUp); } break; case 3: // RIGHT if (memoryMode || invertedMemoryMode) { spawnMemoryNote(diamondRing, diamondRing.transform, hitObject, keyRight); } else if (hitObject.IsMine()) { spawnStepNote(bigMine, rightSpawnerBig, hitObject, keyRight); } else { spawnStepNote(bigRing, rightSpawnerBig, hitObject, keyRight); } break; default: break; } }