private void ENTER_GAMING() { Cursor.lockState = CursorLockMode.Locked; mState = PP_State.GAME_ACTIVE; mGameState = PP_GAME_STATE.CHILLING; refUI.gameObject.SetActive(true); // testing this bug. Time.timeScale = 1f; // Activate all the turrets and the pc in the scene. cTurMan.FActivateTurrets(); PC_Controller refPC = FindObjectOfType <PC_Controller>(); refPC.mState = PC_Controller.PC_STATE.SACTIVE; Vector3 vPCPos = FindObjectOfType <PP_Pocket>().transform.position; vPCPos.y = 1f; refPC.transform.position = vPCPos; mScore = 0; ChangeScore(0); // ah side effects, lovely aren't they? mStreak = 0; mStreakBonus = 1; mTimeLeft = mGameTime; cTargMan.FDeactivateReceiver(); }
private void ENTER_INSTRUCTIONS() { Cursor.lockState = CursorLockMode.Locked; MN_PauseScreen.SetActive(false); refUI.gameObject.SetActive(false); refInstrUI.SetActive(true); refScoreboardUI.SetActive(false); mGameState = PP_GAME_STATE.CHILLING; mState = PP_State.DISPLAY_INSTRUCTIONS; // Note, this needs to be polished, the rotations can get wonky. refPC.transform.rotation = Quaternion.Euler(0f, 0f, 0f); refPC.GetComponentInChildren <PC_Camera>().transform.rotation = Quaternion.Euler(0f, 0f, 0f); refPC.mState = PC_Controller.PC_STATE.SINACTIVE; refPC.GetComponent <Rigidbody>().velocity = Vector3.zero; // this is kind of to solve a bug with respect to throwing. TDC_EventManager.FBroadcast(TDC_GE.GE_QB_StopThrow); DestroyExistingProjectilesArrowsAndDeactivateTurrets(); // Also destroy all footballs PROJ_Football[] refFootballs = FindObjectsOfType <PROJ_Football>(); for (int i = 0; i < refFootballs.Length; i++) { Destroy(refFootballs[i].gameObject); } }
private void ENTER_SCORESCREEN() { bool bNewHighScore = false; if (lDifData.mName == "EASY") { if (IO_GamerInfo.mInfo.mPPHighScores.mEasyScore < mScore) { IO_GamerInfo.mInfo.mPPHighScores.mEasyScore = mScore; bNewHighScore = true; } } else if (lDifData.mName == "NORMAL") { if (IO_GamerInfo.mInfo.mPPHighScores.mNormalScore < mScore) { IO_GamerInfo.mInfo.mPPHighScores.mNormalScore = mScore; bNewHighScore = true; } } else if (lDifData.mName == "HARD") { if (IO_GamerInfo.mInfo.mPPHighScores.mHardScore < mScore) { IO_GamerInfo.mInfo.mPPHighScores.mHardScore = mScore; bNewHighScore = true; } } else if (lDifData.mName == "PETERMAN") { if (IO_GamerInfo.mInfo.mPPHighScores.mPetermanScore < mScore) { IO_GamerInfo.mInfo.mPPHighScores.mPetermanScore = mScore; bNewHighScore = true; } } if (bNewHighScore) { IO_GamerInfo.FWriteGamerData(IO_GamerInfo.mInfo); } Cursor.lockState = CursorLockMode.None; Cursor.visible = true; mState = PP_State.SCORE_SCREEN; refUI.gameObject.SetActive(false); refInstrUI.gameObject.SetActive(false); refScoreboardUI.SetActive(true); if (bNewHighScore) { refScoreboardUI.GetComponent <PP_Scoreboard>().mNewHighScoreTXT.text = "NEW HIGH SCORE!"; } else { refScoreboardUI.GetComponent <PP_Scoreboard>().mNewHighScoreTXT.text = "Good Game"; } DestroyExistingProjectilesArrowsAndDeactivateTurrets(); PC_Controller refPC = FindObjectOfType <PC_Controller>(); refPC.mState = PC_Controller.PC_STATE.SINACTIVE; refPC.GetComponent <Rigidbody>().velocity = Vector3.zero; }