campfire/Assets/Scripts/CasetteProgress.cs

38 lines
910 B
C#

using System.Collections;
using System.Collections.Generic;
using UnityEngine;
using UnityEngine.UI;
public class CasetteProgress : MonoBehaviour {
public static int CasetteIndex;
public static int CasetteCount;
public static bool AllCasettesPlayed {
get {
return CasetteIndex >= CasetteCount;
}
}
public static AudioSource CurrentlyPlaying;
public Text Display;
private void Start() {
CasetteIndex = 0;
CasetteCount = 0;
}
private void Update() {
if (CurrentlyPlaying != null && Display != null) {
Display.text = CurrentlyPlaying.isPlaying ? "Playing diary..." : "";
}
}
public static int PlayNext() {
if (!AllCasettesPlayed) {
int Index = CasetteIndex;
CasetteIndex++;
return Index;
} else {
return -1;
}
}
}