Beispiel #1
0
    /// <summary>
    /// 음악의 길이에 맞게 노트찍는 라인 생성.
    /// </summary>
    /// <param name="length"> 음악 길이 </param>
    public void CreateLine(float length)
    {
        startTransform.position = InitPos;
        curBGMPosition.position = new Vector3(-0.5f, 0);

        if (clones != null)
        {
            noteMgr.DestroyAllNotes();
            for (int i = 0; i < clones.Length; i++)
            {
                Destroy(clones[i]);
            }
        }
        clones      = new GameObject[(int)length + 1];
        createCount = clones.Length;
        for (int i = 0; i < clones.Length; i++)
        {
            clones[i]                    = GameObject.Instantiate(line_Prefab);
            clones[i].name               = "Line";
            clones[i].transform.parent   = startTransform;
            clones[i].transform.position = new Vector2(startTransform.position.x + i * 1.2f, startTransform.position.y);

            if (i == 0)
            {
                startPos = clones[i].transform.position;
            }

            else if (i == clones.Length - 1)
            {
                endTransform.position = clones[i].transform.position;
            }
        }

        endPos = endTransform.position;
    }