Esempio n. 1
0
    // メンバ関数の定義 =====================================================
    #region 初期化処理
    //-----------------------------------------------------------------
    //! @summary   初期化処理
    //!
    //! @parameter [void] なし
    //!
    //! @return    なし
    //-----------------------------------------------------------------
    public void Initialize()
    {
        // コンポーネントの取得
        m_transform             = GetComponent <RectTransform>();
        m_glowImage             = GetComponent <GlowImage>();
        m_musicalScoreTransform = m_transform.parent.GetComponent <RectTransform>();
        m_audioSource           = GetComponent <AudioSource>();

        // データの初期化
        m_notesData = ScriptableObject.CreateInstance <PiarhythmDatas.NoteData>();

        // 色の初期化
        PiarhythmDatas.Color colorData = new PiarhythmDatas.Color();
        colorData.r         = Color.green.r;
        colorData.g         = Color.green.g;
        colorData.b         = Color.green.b;
        colorData.a         = Color.green.a;
        m_notesData.m_color = colorData;
        m_glowImage.color   = m_glowImage.glowColor = Color.green;

        // スケールの初期化
        m_transform.localScale = Vector3.one;

        // 音階の設定
        SetNotesScale("C4");

        // 手前に持ってくる
        Vector3 position = m_transform.localPosition;

        position.z = 0.0f;
        m_transform.localPosition = position;

        // 開始時間と長さの初期化
        PiarhythmDatas.PositionData positionData = new PiarhythmDatas.PositionData();
        positionData.m_position = m_transform.offsetMin.y;
        positionData.m_lenght   = m_transform.sizeDelta.y;
        PiarhythmDatas.NoteData notesData = m_optionSheetController.ConvertToNotesData(positionData);
        m_notesData.m_startBeat  = notesData.m_startBeat;
        m_notesData.m_noteLength = 2;
        positionData             = m_optionSheetController.ConvertToPositionData(m_notesData.m_startBeat, m_notesData.m_noteLength);
        m_transform.offsetMin    = new Vector2(m_transform.offsetMin.x, positionData.m_position);
        m_transform.offsetMax    = new Vector2(m_transform.offsetMax.x, m_transform.offsetMin.y + positionData.m_lenght);

        // 光彩を切る
        m_glowImage.glowSize = 0.0f;
    }
Esempio n. 2
0
    // メンバ関数の定義 =====================================================
    #region 初期化処理
    //-----------------------------------------------------------------
    //! @summary   初期化処理
    //!
    //! @parameter [void] なし
    //!
    //! @return    なし
    //-----------------------------------------------------------------
    public void Initialize()
    {
        // コンポーネントの取得
        m_transform             = GetComponent <RectTransform>();
        m_glowImage             = GetComponent <GlowImage>();
        m_musicalScoreTransform = m_transform.parent.GetComponent <RectTransform>();
        m_audioSource           = GetComponent <AudioSource>();

        // 色の初期化
        UnityEngine.Color color = new UnityEngine.Color(m_noteList[0].m_color.r, m_noteList[0].m_color.g, m_noteList[0].m_color.b, m_noteList[0].m_color.a);
        m_glowImage.color = m_glowImage.glowColor = color;

        // スケールの初期化
        m_transform.localScale = Vector3.one;

        // 音階の設定
        SetNotesScale(m_noteList[0].m_scale);

        // 手前に持ってくる
        Vector3 position = m_transform.localPosition;

        position.z = 0.0f;
        m_transform.localPosition = position;

        // 開始時間と長さの初期化
        PiarhythmDatas.PositionData positionData = m_optionSheetController.ConvertToPositionData(m_noteList[0].m_startBeat, m_noteList[0].m_noteLength);
        m_transform.offsetMin = new Vector2(m_transform.offsetMin.x, positionData.m_position);
        m_transform.offsetMax = new Vector2(m_transform.offsetMax.x, m_transform.offsetMin.y + positionData.m_lenght);
        for (int i = 1; i < m_noteList.Count; ++i)
        {
            positionData = m_optionSheetController.ConvertToPositionData(m_noteList[i].m_startBeat, m_noteList[i].m_noteLength);
            Vector2 offsetMax = m_transform.offsetMax;
            offsetMax.y          += positionData.m_lenght;
            m_transform.offsetMax = offsetMax;
        }

        // 光彩を切る
        m_glowImage.glowSize = 0.0f;
    }