using System.Collections; using System.Collections.Generic; using UnityEngine; using UnityEngine.UI; using System.Runtime.InteropServices; public class STARTENDING_ : MonoBehaviour{ [DllImport("__Internal")] private static extern void StartedGame(); private bool Max, Min, ending; public Text 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 } }