Ejemplo n.º 1
0
    /**
     * @brief Gets the image used to represent a @link NOTE_LENGTH_BASE note's length@endlink.
     * @param[in] aLength The @link NOTE_LENGTH_BASE note length@endlink whose image representation is being obtained.
     * @return The image representation of the given @link NOTE_LENGTH_BASE note length@endlink.
     */
    public static Sprite GetImageForNoteLength(NOTE_LENGTH_BASE aLength)
    {
        // Declare the returned Sprite variable.
        Sprite returned = null;

        // If the given length is not "None", then use the path in the NOTE_LENGTH_BASE_IMAGE_PATHS array.
        // Otherwise, keep the returned variable set to null.
        if (aLength != NOTE_LENGTH_BASE.NONE)
        {
            returned = Resources.Load <Sprite>(NOTE_LENGTH_BASE_IMAGE_PATHS[(int)aLength]);
            Assert.IsNotNull(returned, "Could not load the note length image at the path " + NOTE_LENGTH_BASE_IMAGE_PATHS[(int)aLength] + "!");
        }

        return(returned);
    }
Ejemplo n.º 2
0
        public NoteLength(string aString)
        {
            Assert.IsTrue(aString.Length == 3, "Tried to initialize a NoteLength struct with an improperly-formatted string!");

            BaseLength = (NOTE_LENGTH_BASE)(int.Parse(aString.Substring(0, 1)));
            if (int.Parse(aString.Substring(1, 1)) == 1)
            {
                Dot = true;
            }
            else
            {
                Dot = false;
            }

            if (int.Parse(aString.Substring(2, 1)) == 1)
            {
                Triplet = true;
            }
            else
            {
                Triplet = false;
            }
        }
Ejemplo n.º 3
0
 public NoteLength(NOTE_LENGTH_BASE aBaseLength, bool aDot, bool aTriplet)
 {
     Dot        = aDot;
     Triplet    = aTriplet;
     BaseLength = aBaseLength;
 }
Ejemplo n.º 4
0
        public NOTE_LENGTH_BASE BaseLength; //!< @copydoc Music::NOTE_LENGTH_BASE

        public NoteLength(NOTE_LENGTH_BASE aBaseLength)
        {
            BaseLength = aBaseLength;
            Dot        = false;
            Triplet    = false;
        }