Skip to content

Instantly share code, notes, and snippets.

@bibinba
Created November 22, 2018 08:24
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save bibinba/c89fe42bf705fe81c1e944338ed46e1d to your computer and use it in GitHub Desktop.
Save bibinba/c89fe42bf705fe81c1e944338ed46e1d to your computer and use it in GitHub Desktop.
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