campfire/Assets/Scripts/CasetteProgress.cs

38 lines
910 B
C#
Raw 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() {
2020-04-29 23:31:45 +02:00
if (CurrentlyPlaying != null && Display != null) {
2020-04-21 02:58:28 +02:00
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;
}
}
}