campfire/Assets/Scripts/CasetteProgress.cs

38 lines
891 B
C#
Raw Permalink Normal View History

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