Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
using System.Collections;
using System.Collections.Generic;
using UnityEngine;
using UnityEngine.UI;
using UnityEngine.SceneManagement;
public class main : MonoBehaviour {
private int a = 0;
public Text kaisu;
public Text timerText;
public Text kekka;
public GameObject Endcanvas;
private float totalTime = 10.0f;
int seconds;
// Use this for initialization
void Start () {
totalTime = 10.0f;
}
// Update is called once per frame
void Update () {
seconds = (int)totalTime;
if (seconds > 0)
{
Endcanvas.SetActive(false);
totalTime -= Time.deltaTime;
timerText.text = seconds.ToString();
if (Input.GetMouseButtonDown(0))
{
a++;
kaisu.text = a.ToString();
}
}
else if (seconds == 0)
{
seconds = 0;
Endcanvas.SetActive(true);
timerText.text = seconds.ToString();
kekka.text = a.ToString();
}
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment