示例#1
0
    /// <summary>
    /// Spawns the note prefab, sets its parent, names it, gives it the right icon, and positions it correctly
    /// </summary>
    /// <param name="noteValue"></param>
    /// <param name="noteTime"></param>
    /// <returns></returns>
    GameObject AddNewNoteUI(int noteValue, float noteTime)
    {
        GameObject noteUI = Instantiate
                                (notePrefab, new Vector3(GetXPositionGivenTime(noteTime), GetYPositionGivenValue(noteValue), 0f), Quaternion.identity) as GameObject;

        noteUI.transform.parent = noteHolder;
        noteUI.name             = noteMapping.GetNoteString(noteValue) + "_" + noteTime;
        noteUI.GetComponent <Image>().sprite = noteMapping.GetNoteTexture(noteValue);
        return(noteUI);
    }