HKI Core
HKI Core
Audio
PlaySoundOnlyIfTimePassed.cs
Go to the documentation of this file.
1
using
UnityEngine
;
2
using
System
.Collections;
3
4
namespace
HKI
.Core.Audio
5
{
9
public
class
PlaySoundOnlyIfTimePassed
: MonoBehaviour
10
{
11
// Public variables
12
[SerializeField]
PlaySoundClip
PlaySoundClip
= null;
13
14
[SerializeField]
float
TimeToPass = 5.0f;
15
16
// Private variables
17
bool
playable =
true
;
18
19
// Interface function
20
public
void
Play
()
21
{
22
if
(PlaySoundClip != null && playable)
23
{
24
PlaySoundClip.
Play
();
25
playable =
false
;
26
Invoke(
"ChangePlayableBack"
, TimeToPass);
27
}
28
}
29
30
// Helper functions
31
void
ChangePlayableBack
()
32
{
33
playable =
true
;
34
}
35
}
36
}
HKI.Core.Audio.PlaySoundClip.Play
void Play()
Definition:
PlaySoundClip.cs:90
HKI.Core.Audio.PlaySoundOnlyIfTimePassed.ChangePlayableBack
void ChangePlayableBack()
Definition:
PlaySoundOnlyIfTimePassed.cs:31
System
HKI.Core.Audio.PlaySoundClip
This MonoBehaviour allows playing of a SoundClip on one of the general purpose AudioPlayers.
Definition:
PlaySoundClip.cs:8
HKI.Core.Audio.PlaySoundOnlyIfTimePassed.Play
void Play()
Definition:
PlaySoundOnlyIfTimePassed.cs:20
HKI.Core.Audio.PlaySoundOnlyIfTimePassed
This MonoBehaviour allows the delay of playing a soundclip.
Definition:
PlaySoundOnlyIfTimePassed.cs:9
UnityEngine
HKI
Generated by
1.8.13