Super Knight : Enter the Dungeon
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

37 lines
873 B

using System.Collections;
using System.Collections.Generic;
using UnityEngine;
public class EGA_EffectSound : MonoBehaviour
{
public bool Repeating = true;
public float RepeatTime = 2.0f;
public float StartTime = 0.0f;
public bool RandomVolume;
public float minVolume = .4f;
public float maxVolume = 1f;
private AudioClip clip;
private AudioSource soundComponent;
void Start ()
{
soundComponent = GetComponent<AudioSource>();
clip = soundComponent.clip;
if (RandomVolume == true)
{
soundComponent.volume = Random.Range(minVolume, maxVolume);
RepeatSound();
}
if (Repeating == true)
{
InvokeRepeating("RepeatSound", StartTime, RepeatTime);
}
}
void RepeatSound()
{
soundComponent.PlayOneShot(clip);
}
}