sparkengineweb
    Preparing search index...

    Class SoundComponent

    Represents a sound that can be played

    Hierarchy (View Summary)

    Index

    Constructors

    Accessors

    • get filePath(): string | undefined

      Returns string | undefined

      the path of the file to load

    • set filePath(path: string): void

      Sets the path of the file to load. This will reset the asset and stop the sound if it was playing

      Parameters

      • path: string

        the path of the file to load

      Returns void

    • get isLoaded(): boolean

      Indicates if the sound is loaded and ready to be played

      Returns boolean

      true if the sound is loaded and ready to be played

    • get isPlaying(): boolean

      This readonly property aims to indicate if the sound is playing. In this first MVP It is reset to false at any update and used only to trigger the sound at the next update

      Returns boolean

      true if the sound is set to be played at the next update.

    Methods

    • Plays the sound if loaded and flagged for playing at the next update. Flag is reset to false at the next update.

      Returns void