48 lines
974 B
C#
48 lines
974 B
C#
|
using SHADE;
|
|||
|
using SHADE_Scripting.Audio;
|
|||
|
using System;
|
|||
|
using System.Collections.Generic;
|
|||
|
using System.Linq;
|
|||
|
using System.Text;
|
|||
|
using System.Threading.Tasks;
|
|||
|
|
|||
|
public class DecorationAudio : Script
|
|||
|
{
|
|||
|
public string name = "REPLACETHIS";
|
|||
|
public string audio = "event:/UI/botton_hover";
|
|||
|
public bool loop = true;
|
|||
|
public float timeDruation = 0.5f;
|
|||
|
private float timer = 0.0f;
|
|||
|
|
|||
|
protected override void awake()
|
|||
|
{
|
|||
|
if (audio != "Empty")
|
|||
|
{
|
|||
|
AudioHandler.audioClipHandlers[name] = Audio.CreateAudioClip(audio);
|
|||
|
Audio.AttachAudioClipToObject(AudioHandler.audioClipHandlers[name], GameObject.EntityId);
|
|||
|
}
|
|||
|
}
|
|||
|
|
|||
|
protected override void start()
|
|||
|
{
|
|||
|
if (loop)
|
|||
|
AudioHandler.audioClipHandlers[name].Play();
|
|||
|
|
|||
|
}
|
|||
|
|
|||
|
protected override void update()
|
|||
|
{
|
|||
|
if (!loop)
|
|||
|
{
|
|||
|
timer += Time.DeltaTimeF;
|
|||
|
if (timer > timeDruation)
|
|||
|
{
|
|||
|
timer = 0.0f;
|
|||
|
AudioHandler.audioClipHandlers[name].Play();
|
|||
|
}
|
|||
|
}
|
|||
|
}
|
|||
|
|
|||
|
}
|
|||
|
|