Пример #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;
    }
Пример #2
0
    //-----------------------------------------------------------------
    //! @summary   ノーツの移動処理
    //!
    //! @parameter [scale] 音階
    //! @parameter [positionY] Y座標
    //!
    //! @return    なし
    //-----------------------------------------------------------------
    private void MoveEditNotes(string scale, float positionY)
    {
        // ノーツの移動
        m_transform.localPosition = new Vector3(m_transform.localPosition.x, positionY, 0.0f);
        SetNotesScale(scale);

        // 移動制限
        Vector2 offsetMin = m_transform.offsetMin;

        if (offsetMin.y <= 0.0)
        {
            offsetMin.y = 0.0f;
        }
        m_transform.offsetMin = offsetMin;

        // 最新データの作成
        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);
        SetStartBeat(notesData.m_startBeat);
    }