26 lines
599 B
C#
26 lines
599 B
C#
using System.Collections;
|
|
using System.Collections.Generic;
|
|
using System.Threading.Tasks;
|
|
using UnityEngine;
|
|
|
|
public class MusicStarter : MonoBehaviour
|
|
{
|
|
public string songName = "gameplay";
|
|
public int delay = 0;
|
|
|
|
int delayForSetup = 250;
|
|
|
|
void Start()
|
|
{
|
|
DelayedSongRequest();
|
|
}
|
|
|
|
async void DelayedSongRequest()
|
|
{
|
|
await Task.Delay(delayForSetup);
|
|
MusicManager m = GameObject.FindWithTag("MusicManager").GetComponent<MusicManager>();
|
|
m.StopOtherSongs(songName);
|
|
await Task.Delay(delay);
|
|
m.PlaySong(songName);
|
|
}
|
|
}
|