Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- float count; // 時間を管理する小数値
- bool gameActive = false; //trueだったらゲーム中
- void Update()
- {
- if(Input.GetKeyDown(KeyCode.Space)) //スペースキーを押してゲームスタート
- {
- gameActive = true; // gameactiveをtrueにしてゲームをスタートさせる
- }
- if(gameActive == true) //gameactiveがtrueの間はゲームを実行する
- {
- count += Time.deltaTime; //一秒に1増やす
- if(Input.GetKeyDown(KeyCode.Enter)) //Enterを押すと実行
- {
- if(count >= 5 && count =< 7) //countが5~7の間の場合
- {
- Debug.Log("成功");
- }
- else //countが5~7以外の場合
- {
- Debug.Log("失敗");
- }
- }
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement