127 lines
3.4 KiB
C#
127 lines
3.4 KiB
C#
using System.Collections;
|
|
using System.Collections.Generic;
|
|
using UnityEngine;
|
|
using UnityEngine.UI;
|
|
|
|
public class MitsukuFace : MonoBehaviour
|
|
{
|
|
|
|
Image img;
|
|
|
|
AudioSource audio;
|
|
|
|
public List<AudioClip> audios = new List<AudioClip>();
|
|
|
|
// Start is called before the first frame update
|
|
void Start()
|
|
{
|
|
img = GetComponent<Image>();
|
|
audio = GetComponentInChildren<AudioSource>();
|
|
|
|
StartCoroutine(chooseAnime());
|
|
}
|
|
|
|
IEnumerator chooseAnime() {
|
|
while (true)
|
|
{
|
|
int rand = Random.Range(0, 225);
|
|
|
|
if (rand > 125)
|
|
{
|
|
yield return StartCoroutine(runAnimeGlass("Respiracao -_", "Respiracao", 86, 0));
|
|
}else if (rand > 100)
|
|
{
|
|
yield return StartCoroutine(runAnimeGlass("Natural Yo_", "Natural 640x360 yo", 70, 58));
|
|
}
|
|
else if (rand > 75)
|
|
{
|
|
yield return StartCoroutine(runAnimeGlass("Natural Yo_", "Natural 640x360 yo", 52, 36));
|
|
}
|
|
else if (rand > 50)
|
|
{
|
|
yield return StartCoroutine(runAnimeGlass("Natural Yo_", "Natural 640x360 yo", 38, 18));
|
|
}
|
|
else if (rand > 20)
|
|
{
|
|
yield return StartCoroutine(runAnimeGlass("Natural Yo_", "Natural 640x360 yo", 18, 0));
|
|
}
|
|
else if (rand >= 15)
|
|
{
|
|
|
|
yield return StartCoroutine(runAnimeGlass("buttefly_", "Butterfly", 358, 0));
|
|
}
|
|
else //if (rand >= 10)
|
|
{
|
|
yield return StartCoroutine(runAnimeGlassLess0("Mitsuko Glass _ ", "Glass", 292, 0));
|
|
}
|
|
/*else
|
|
{
|
|
yield return StartCoroutine(runAnimeGlass("Mixtape_", "Mixtape", 358, 0));
|
|
}*/
|
|
|
|
}
|
|
}
|
|
|
|
IEnumerator runAnimeGlass(string nameBase, string pasteName, int nbrframes, int startframe, AudioClip clip = null) {
|
|
|
|
int index = startframe;
|
|
if (clip != null)
|
|
{
|
|
audio.clip = clip;
|
|
audio.Play();
|
|
}
|
|
//Mitsuko Glass _ 293
|
|
while (index <= nbrframes)
|
|
{
|
|
string url;
|
|
if (index < 10)
|
|
{
|
|
url = nameBase + "00" + index.ToString();
|
|
}
|
|
else if (index < 100)
|
|
{
|
|
url = nameBase + "0" + index.ToString();
|
|
}
|
|
else
|
|
{
|
|
url = nameBase + index.ToString();
|
|
}
|
|
|
|
img.sprite = Resources.Load<Sprite>("Mitsuku/" + pasteName + "/" + url);
|
|
|
|
index += 1;
|
|
|
|
yield return new WaitForSecondsRealtime(0.04f);
|
|
}
|
|
|
|
yield break;
|
|
}
|
|
|
|
IEnumerator runAnimeGlassLess0(string nameBase, string pasteName, int nbrframes, int startframe)
|
|
{
|
|
|
|
int index = startframe;
|
|
//audio.Play();
|
|
//Mitsuko Glass _ 293
|
|
while (index <= nbrframes)
|
|
{
|
|
string url;
|
|
if (index < 10)
|
|
{
|
|
url = nameBase + "0" + index.ToString();
|
|
}else
|
|
{
|
|
url = nameBase + index.ToString();
|
|
}
|
|
|
|
img.sprite = Resources.Load<Sprite>("Mitsuku/" + pasteName + "/" + url);
|
|
|
|
index += 1;
|
|
|
|
yield return new WaitForSecondsRealtime(0.04f);
|
|
}
|
|
|
|
yield break;
|
|
}
|
|
}
|