Advertisement
Guest User

Untitled

a guest
Jun 24th, 2019
85
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.80 KB | None | 0 0
  1. float count; // 時間を管理する小数値
  2. bool gameActive = false; //trueだったらゲーム中
  3. void Update()
  4. {
  5. if(Input.GetKeyDown(KeyCode.Space)) //スペースキーを押してゲームスタート
  6. {
  7. gameActive = true; // gameactiveをtrueにしてゲームをスタートさせる
  8. }
  9.  
  10. if(gameActive == true) //gameactiveがtrueの間はゲームを実行する
  11. {
  12. count += Time.deltaTime; //一秒に1増やす
  13. if(Input.GetKeyDown(KeyCode.Enter)) //Enterを押すと実行
  14. {
  15. if(count >= 5 && count =< 7) //countが5~7の間の場合
  16. {
  17. Debug.Log("成功");
  18. }
  19. else //countが5~7以外の場合
  20. {
  21. Debug.Log("失敗");
  22. }
  23. }
  24. }
  25. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement