Created
November 22, 2018 08:24
-
-
Save bibinba/c89fe42bf705fe81c1e944338ed46e1d to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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