ZoeAppClass/Assets/Jogos/261/Scripts/STARTENDING2.cs

64 lines
1.6 KiB
C#

using System.Collections;
using System.Collections.Generic;
using UnityEngine;
using TMPro;
using System.Runtime.InteropServices;
public class STARTENDING2 : MonoBehaviour{
private bool Max, Min, ending;
public TextMeshProUGUI texto;
public CanvasGroup Fundo;
private float time;
// Start is called before the first frame update
void Start()
{
Max = false;
//StartedGame();
}
// Update is called once per frame
void Update()
{
if (Max == false && ending == false)
{//Change the local scale to adapt
if (texto.rectTransform.localScale.x <= 0.8f && Min == false){
texto.rectTransform.localScale += new Vector3(0.1f, 0.1f, 0.1f);
}
if (texto.rectTransform.localScale.x >= 0.8f){
Min = true;
}
if (Min){
texto.rectTransform.localScale += new Vector3(-0.1f, -0.1f, -0.1f);
}
if (texto.rectTransform.localScale.x <= 1 && Min)
{
Max = true;
}
}//Here too
else if(ending == false){ texto.rectTransform.localScale = new Vector3(0.8f, 0.8f, 0.8f); time += Time.deltaTime; }
if (time >= 5)
{
time = 0; ending = true;
}
if (ending)
{
Fundo.alpha += -0.1f;
if (Fundo.alpha == 0)
{
//TimerScript.startTimer = true;
}
}
}
public static void Encerrar(CanvasGroup canvas)
{
canvas.alpha += 0.1f; //Finish or fail game in the script that decides that
}
}