ZoeAppClass/Assets/Jogos/Aula09/Game09Copy/GameClothe09Objs.cs

51 lines
1.1 KiB
C#

using System.Collections;
using System.Collections.Generic;
using UnityEngine;
using UnityEngine.UI;
public class GameClothe09Objs : MonoBehaviour
{
public string text;
public void ChooseThis()
{
GetComponentInParent<GameClothe09>().VerificaResposta(text, this);
}
public void SetWrong()
{
StartCoroutine(WrongAnime());
}
IEnumerator WrongAnime()
{
float time = 0;
Image img = GetComponent<Image>();
while (time < .75f)
{
time += Time.deltaTime * 3;
img.color = new Color(1, 1 - time, 1 - time, 1 - time);
yield return new WaitForEndOfFrame();
}
while (time > 0)
{
time -= Time.deltaTime * 3;
img.color = new Color(1, 1 - time, 1 - time, 1 - time);
yield return new WaitForEndOfFrame();
}
img.color = new Color(1, 1, 1, 1);
}
public void SetRight()
{
GetComponent<Image>().color = Color.black;
GetComponent<Button>().interactable = false;
}
}