예제 #1
0
    public void Initialize(Scan scanRef, NoteObject noteRef,
                           int lastNotePulse)
    {
        this.noteRef = noteRef.GetComponent <NoteAppearance>();

        float startX = GetComponent <RectTransform>()
                       .anchoredPosition.x;
        float endX = scanRef.FloatPulseToXPosition(
            lastNotePulse,
            positionEndOfScanOutOfBounds: true,
            positionAfterScanOutOfBounds: true);
        float width = Mathf.Abs(startX - endX);

        extension.sizeDelta = new Vector2(width,
                                          extension.sizeDelta.y);
        if (endX < startX)
        {
            extension.localRotation =
                Quaternion.Euler(0f, 0f, 180f);
        }
    }
예제 #2
0
    public NoteObject SpawnNoteObject(GameObject prefab, Note n,
                                      bool hidden)
    {
        GameObject o = Instantiate(prefab, transform);

        NoteObject noteObject = o.GetComponent <NoteObject>();

        noteObject.note = n;

        float         x    = FloatPulseToXPosition(n.pulse);
        float         y    = FloatLaneToYPosition(n.lane);
        RectTransform rect = o.GetComponent <RectTransform>();

        rect.pivot            = new Vector2(0.5f, 0.5f);
        rect.anchorMin        = Vector2.zero;
        rect.anchorMax        = Vector2.zero;
        rect.anchoredPosition = new Vector2(x, y);
        rect.sizeDelta        = new Vector2(laneHeight, laneHeight);

        NoteAppearance appearance = o.GetComponent <NoteAppearance>();

        appearance.SetHidden(hidden);
        appearance.SetScanAndScanlineRef(this, scanline);
        noteAppearances.Add(appearance);

        switch (n.type)
        {
        case NoteType.Hold:
        case NoteType.RepeatHeadHold:
        case NoteType.RepeatHold:
            appearance.InitializeTrail();
            break;

        case NoteType.Drag:
            appearance.InitializeCurve();
            break;
        }

        return(noteObject);
    }
예제 #3
0
 public void RegisterNoteAppearance(NoteAppearance noteRef)
 {
     this.noteRef = noteRef;
 }