示例#1
0
    void spawnMemoryNote(GameObject ring, Transform spawner, HitEvent hitObject, KeyCode key)
    {
        if (MemoryNoteManager.Instance.currentMemorySequence.Count > 0)
        {
            HitEvent memNote     = MemoryNoteManager.Instance.currentMemorySequence.Dequeue();
            var      currentRing = Instantiate(ring, spawner.localPosition, Quaternion.identity);
            currentRing.transform.SetParent(diamondHolder.transform, false);
            hitObject.setPlayMode(FetchNotePlayMode(hitObject));
            currentRing.GetComponent <DiamondRing>().Initialize(diamondHitbox.transform.localScale, hitObject.getOffset(), scrollDelay, hitObject);
            if (hitObject.getColorIntArray().Length == 4)
            {
                colorIntArray = hitObject.getColorIntArray();
            }
            int intKey = Array.IndexOf(colorIntArray, memNote.getKey());
            switch (intKey)
            {
            case 0:       // LEFT
                currentRing.GetComponent <DiamondRing>().keyCode = keyLeft;
                break;

            case 1:      // DOWN
                currentRing.GetComponent <DiamondRing>().keyCode = keyDown;
                break;

            case 2:      // UP
                currentRing.GetComponent <DiamondRing>().keyCode = keyUp;
                break;

            case 3:      // RIGHT
                currentRing.GetComponent <DiamondRing>().keyCode = keyRight;
                break;

            default:
                break;
            }
        }
    }