new AudioComponent(pOwner)
Audio component to add to a game object for playing sounds.
Parameters:
| Name | Type | Description |
|---|---|---|
pOwner |
FM.GameObject | Game object owner of this component. |
Extends
Members
-
name :FM.ComponentTypes
-
Component's name.
Type:
- Inherited From:
- Source:
-
owner :FM.GameObject
-
Component's owner.
Type:
- Inherited From:
- Source:
Methods
-
addSound(pSound)
-
Add a sound to the component.
Parameters:
Name Type Description pSoundFM.AudioAsset The sound to add to this component. -
destroy()
-
Destroy the sound component and its objects.
-
getSoundByName(pSoundName) → {FM.AudioAsset}
-
Retrieve the audio object.
Parameters:
Name Type Description pSoundNamestring The name of the sound to retrieve. Returns:
The sound found or null if not.- Type
- FM.AudioAsset
-
isPlaying(pSoundName) → {boolean}
-
Check if a sound is currently playing.
Parameters:
Name Type Description pSoundNamestring The name of the sound to check. Returns:
Whether the sound is playing or not.- Type
- boolean
-
pause(pSoundName)
-
Pause the sound.
Parameters:
Name Type Description pSoundNamestring The name of the sound to pause. -
play(pSoundName, pVolume, pLoop)
-
Play the sound given a certain volume and whether the sound loops or not.
Parameters:
Name Type Description pSoundNamestring The name of the sound to play. pVolumefloat The volume at which playing the sound (0 to 1). pLoopboolean Whether the sound should loop or not.