Skip to content

Instantly share code, notes, and snippets.

View pouhiro1224's full-sized avatar

Hiroshi Take pouhiro1224

  • Midori-ku Yokohama
View GitHub Profile
@pouhiro1224
pouhiro1224 / gist:a11ee348e3a64327b0ae41172d88a710
Last active June 3, 2016 09:56
Unityカウントダウンタイマーのサンプルコード
//試合時間に3秒足すこと
private float maxTime = 63f;
Timer gameTimer = new Timer ();
gameTimer.Start (maxTime, 1f);
gameTimer.Elapsed += delegate(float rest) {
if(rest == maxTime - 2f){
gameStatusText.text = "GO!!";
}
if(rest <= maxTime - 3f){
gameStatusText.text = "";
@pouhiro1224
pouhiro1224 / gist:5a487a1de2dd675193e3c656ea8f2146
Last active November 23, 2018 08:58
勝敗判定スクリプト
void Update () {
if (isGameStart) {
//試合中にPlayer1.zが8fより少なくなったら負け
if (GameObject.Find ("Player1").transform.position.z <= 8f) {
//ゲーム開始フラグをOFF
isGameStart = false;
gameTimer.Stop ();
Vector3 player1Pos = GameObject.Find ("Player1").transform.position;
GameObject.Find ("Player1").transform.DOMove (new Vector3(player1Pos.x, -10f, player1Pos.z), 2f, false);
Timer timer = new Timer ();