(旧)コダフォンの日記ブログ(移転しました)

FC2ブログに移転しました。ここいる?

Unity カウントダウン タイマー

メモ

直さないと使えません。

using System.Collections;

using System.Collections.Generic;

using UnityEngine;

using UnityEngine.UI;

public class Timer : MonoBehaviour {

public static float timer;

public int temp;

public int mode;

float countTime=0;

int oioi;

int syoki=0;

// Use this for initialization

void Start () {

//timer = getHitPoint ();

}

// Update is called once per frame

void Update () {

oioi= LifeScript.getHitPoint ();

if (syoki == 0) {

if(mode==0){

timer = 0;

syoki++;

}

}

if (mode != 5) {

countTime = timer + Time.deltaTime; //スタートしてからの秒数を格納

}

GetComponent ().text = countTime.ToString ("F2"); //小数2桁にして表示

timer = countTime;

}

/*public static int getHitPoint() {

return timer;

}*/

//oioi= LifeScript.getHitPoint ();

}