void Start() { gameState = enumGameState.None; nextGameState = enumGameState.WaitforStart; audio = GetComponent <AudioSource>(); audio.Play(); }
public void timerGameStateTrigger() { if (gameState == enumGameState.Paused) { if (lastState == enumGameState.UnpausedTimeStopped) { lastState = enumGameState.UnpausedTimeRunning; } else { lastState = enumGameState.UnpausedTimeStopped; } } else { if (gameState == enumGameState.UnpausedTimeStopped) { gameState = enumGameState.UnpausedTimeRunning; } else { gameState = enumGameState.UnpausedTimeStopped; } } }
public static bool AllowUserActivity; // Разрешено действие пользователя // Use this for initialization void Start() { GameState = enumGameState.BeginGame; _score1 = 0; _score2 = 0; this.ChangeBorderPlace(); _tm = GameObject.Find("txtMessage").GetComponent <MessageControl> (); _tm.RaiseMessage("Start !", 2, Color.magenta); _curC = GameObject.Find("FireShoot").GetComponent <CursorController> (); _ply1 = GameObject.Find("meshPlayer1"); _ply2 = GameObject.Find("meshPlayer2"); _ply1.GetComponent <TankController> ().UnderAIControl = GameStatic.LeftPlayer.isAI; _ply2.GetComponent <TankController> ().UnderAIControl = GameStatic.RightPlayer.isAI; _actTC = _ply1.GetComponent <TankController> (); _ply1.GetComponent <TankController> ().player = GameStatic.LeftPlayer; _ply2.GetComponent <TankController> ().player = GameStatic.RightPlayer; AllowUserActivity = true; RightPlayerGameField = new Rect(3.5f, -10.5f, 19.5f, 22.5f); // Ограничения по полю передвижения танков UpdatePlayers(); //Обновляем имена игроков }
void Start() { beatTime = (60f / tempo) / 2; // ÷2で8分音符 ÷4で16分音符 CreateWall(YLimit + 1f); CreateWall(-1f); CreateWallSide(ZLimit + 1f); CreateWallSide(-1f); gameState = enumGameState.None; nextGameState = enumGameState.WaitforStart; audioSource = GetComponent <AudioSource>(); //audioSource.Play(); }
public void pauseGameStateTrigger() { if (gameState == enumGameState.Paused) { gameState = lastState; Time.timeScale = 1f; } else { Time.timeScale = 0f; lastState = gameState; gameState = enumGameState.Paused; } }
void Awake() { currentDay = 5; if (instance != null) { Destroy(gameObject); } else { instance = this; DontDestroyOnLoad(gameObject); this.gameState = enumGameState.UnpausedTimeStopped; this.lastState = enumGameState.UnpausedTimeStopped; } }
void ChangeGameStateTo(enumGameState state) { switch (state) { //case enumGameState.BeginGame: // _curC.UpdateText("Press right key ..."); // break; case enumGameState.Player1Fire: _actTC = _ply1.GetComponent <TankController>(); _ply1.GetComponent <Rigidbody2D>().Sleep(); _ply2.GetComponent <Rigidbody2D>().WakeUp(); _curC.UpdateText("Fire"); break; case enumGameState.Player2Fire: _actTC = _ply2.GetComponent <TankController>(); _ply1.GetComponent <Rigidbody2D>().WakeUp(); _ply2.GetComponent <Rigidbody2D>().Sleep(); _curC.UpdateText("Fire"); break; case enumGameState.Player1Turn: _actTC = _ply1.GetComponent <TankController>(); _curC.UpdateText("Move"); break; case enumGameState.Player2Turn: _actTC = _ply2.GetComponent <TankController>(); _curC.UpdateText("Move"); break; } ChangeBorderPlace(); SetCursorInDefaultPosition(); _curC.UpdatePosition(); GameState = state; }
// Update is called once per frame void Update() { switch (gameState) { case enumGameState.WaitforStart: if (Input.GetKeyDown(KeyCode.Return)) { nextGameState = enumGameState.Playing; } break; case enumGameState.Playing: BlockSpawn(); break; case enumGameState.GameOver: if (Input.GetKeyDown(KeyCode.Return)) { //nextGameState = enumGameState.WaitforStart; UnityEngine.SceneManagement.SceneManager.LoadScene("SampleScene"); } break; default: break; } switch (nextGameState) { case enumGameState.WaitforStart: updateHighScore(); score = 0; level = 1; //EnemyBlockSpeed = 1.0f; TweetButton.gameObject.SetActive(false); InfoText.gameObject.SetActive(true); InfoText.text = "<color=yellow>TSUNAHIYO</color><br><br>HIT ENTER KEY TO START<br><br>UP / DOWN<br>SPACE : Shoot"; ScoreText.text = "SCORE<br>" + score.ToString(); LevelText.text = "LEVEL<br>" + level.ToString(); HighScoreText.text = "<color=red>HIGH<br> SCORE</color><br>" + highScore.ToString(); break; case enumGameState.Playing: InfoText.gameObject.SetActive(false); score = 0; level = 1; break; case enumGameState.GameOver: PlaySound(2); string highScroreMsg = "GAME OVER"; //int high = PlayerPrefs.GetInt("highscore"); if (highScore < score) { PlayerPrefs.SetInt("highscore", score); PlayerPrefs.Save(); highScroreMsg = "<color=red>HIGH SCORE</color>"; } EnemyBlockSpeed = 0; TweetButton.gameObject.SetActive(true); InfoText.gameObject.SetActive(true); InfoText.text = highScroreMsg + "<br>HIT ENTER KEY"; // Type == Number の場合 naichilab.RankingLoader.Instance.SendScoreAndShowRanking(score); break; default: break; } if (nextGameState != enumGameState.None) { gameState = nextGameState; nextGameState = enumGameState.None; } }
public void GameOverProcess() { nextGameState = enumGameState.GameOver; }
// Update is called once per frame void Update() { //仮置き if (gameState == enumGameState.Playing || gameState == enumGameState.GameOver) { diff = DateTime.Now - startTime; elapsedTime = (float)diff.TotalSeconds; beatCount = Mathf.FloorToInt(elapsedTime / beatTime); this.LevelText.text = beatCount.ToString(); } switch (gameState) { case enumGameState.WaitforStart: if (Input.GetKeyDown(KeyCode.Return) || OVRInput.GetDown(OVRInput.Button.PrimaryIndexTrigger)) { nextGameState = enumGameState.Playing; } break; case enumGameState.Playing: BlockSpawn(); break; case enumGameState.GameOver: if (Input.GetKeyDown(KeyCode.Return) || OVRInput.GetDown(OVRInput.Button.PrimaryIndexTrigger)) { //nextGameState = enumGameState.WaitforStart; UnityEngine.SceneManagement.SceneManager.LoadScene("SoundGame"); } break; default: break; } switch (nextGameState) { case enumGameState.WaitforStart: updateHighScore(); score = 0; level = 1; //EnemyBlockSpeed = 1.0f; InfoText.gameObject.SetActive(true); InfoText.text = "<color=yellow>TSUNAHIYO</color><br><br>TRIGGET TO START<br><br>TRIGGER : Shoot"; ScoreText.text = "SCORE<br>" + score.ToString(); LevelText.text = "LEVEL<br>" + level.ToString(); HighScoreText.text = "<color=red>HIGH<br> SCORE</color><br>" + highScore.ToString(); break; case enumGameState.Playing: InfoText.gameObject.SetActive(false); score = 0; level = 1; elapsedTime = 0; startTime = DateTime.Now; audioSource.Play(); break; case enumGameState.GameOver: PlaySound(2); string highScroreMsg = "GAME OVER"; if (highScore < score) { PlayerPrefs.SetInt("highscore", score); PlayerPrefs.Save(); highScroreMsg = "<color=red>HIGH SCORE</color>"; } EnemyBlockSpeed = 0; InfoText.gameObject.SetActive(true); InfoText.text = highScroreMsg + "<br>HIT ENTER KEY"; break; default: break; } if (nextGameState != enumGameState.None) { gameState = nextGameState; nextGameState = enumGameState.None; } /* * //仮置き * if (Input.GetMouseButtonDown(0)) * { * var TouchPos = Input.mousePosition; * var ray = Camera.main.ScreenPointToRay(TouchPos); * RaycastHit hit; * if (Physics.Raycast(ray, out hit, 100f)) * { * if (hit.transform.gameObject.CompareTag("Dummy")) * { * if (hit.transform.gameObject.GetComponent<DummyBlock>().canDelete == true) * { * hit.transform.gameObject.GetComponent<DummyBlock>().ChangeFace(); * } * } * } * } */ }