void FixedUpdate() { if (Level >= 20) { BannerScript.UnlockTrophy("RNA"); } if (timeRemaining < 0) { BannerScript.UnlockTrophy("Ribosome"); } if ((lives < 1 || timeRemaining < 0) && GlobalVariables.arcadeMode != false) { ShowScore(); } else { if (lives < 1 || timeRemaining < 0) { GlobalVariables.arcadeMode = false; SceneManager.LoadScene("MemoryGame"); } if (GlobalVariables.arcadeMode == true) { int tmp = (int)score; theScore.GetComponent <TMPro.TextMeshPro>().text = "SCORE: " + tmp.ToString(); } else { Timer.GetComponent <TMPro.TextMeshPro>().text = ""; theScore.GetComponent <TMPro.TextMeshPro>().text = ""; } theLevels.GetComponent <TMPro.TextMeshPro>().text = "LEVEL: " + Level.ToString(); } }
private void OnCollisionEnter(Collision collision) { if (collision.transform.tag == "CBullet") { BannerScript.UnlockTrophy("Golgi"); } }
void FixedUpdate() { if (score >= 1000) { BannerScript.UnlockTrophy("Endoplasmic reticulum"); } if (GlobalVariables.arcadeMode == false) { if (numberofstingsdone >= 20) { CellGameplayScript.loadCase = 2; Set.SetAndEnterStatic(15); } } if (GlobalVariables.arcadeMode == true) { theLives.GetComponent <TMPro.TextMeshPro>().text = "LIVES: " + lives; if (lives < 1) { if (GlobalVariables.tutorial) { Set.SetAndEnterStatic(5); } else { ShowScore(); } } if (numberofstingsdone >= neededstings) { TheLevel.GetComponent <TMPro.TextMeshPro>().text = "Level: " + level; neededstings += 5; } int tmp = (int)score; theScore.GetComponent <TMPro.TextMeshPro>().text = "SCORE: " + tmp.ToString(); } else { theScore.GetComponent <TMPro.TextMeshPro>().text = ""; TheLevel.GetComponent <TMPro.TextMeshPro>().text = ""; theLives.GetComponent <TMPro.TextMeshPro>().text = ""; } }
void Update() { SeeValue = PlayerPrefs.GetInt("VirusTotalCount"); if (GlobalVariables.tutorial == false) { if (GlobalVariables.arcadeMode) { DisplayCountAndScore(); //Checking if you completed a wave if (EnemyManger.GetComponent <VirusManager>().VirusList.Count == 0 && EnemyManger.GetComponent <VirusManager>().DoneSpawning == true) { EnemyManger.GetComponent <VirusManager>().DoneSpawning = false; TextForArcade(); } //If you lose arcade bring up scorebaord if (VirusLeaveCount == 10) { isGameOver = true; ScoreBoard.SetActive(true); Text.text = "You lose arcade mode"; if (CurrentScore > BestScoreForFightVirus) { BestScoreForFightVirus = CurrentScore; } if (BestScoreForFightVirus > PlayerPrefs.GetFloat("FightVirusScore")) { PlayerPrefs.SetFloat("FightVirusScore", BestScoreForFightVirus); } else { BestScoreForFightVirus = PlayerPrefs.GetFloat("FightVirusScore"); } SetFacebook(); ScoreBoard.transform.position = new Vector3(transform.position.x, transform.position.y, transform.position.z + 5); } //If you win arcade bring up score board if (EnemyManger.GetComponent <VirusManager>().WaveNumber >= 5 && EnemyManger.GetComponent <VirusManager>().VirusList.Count == 0 && VirusLeaveCount < 10) { isGameOver = true; ScoreBoard.SetActive(true); Text.text = "You win arcade mode"; if (CurrentScore > BestScoreForFightVirus) { BestScoreForFightVirus = CurrentScore; } if (BestScoreForFightVirus > PlayerPrefs.GetFloat("FightVirusScore")) { PlayerPrefs.SetFloat("FightVirusScore", BestScoreForFightVirus); } else { BestScoreForFightVirus = PlayerPrefs.GetFloat("FightVirusScore"); } SetFacebook(); ScoreBoard.transform.position = new Vector3(transform.position.x, transform.position.y, transform.position.z + 5); if (VirusLeaveCount == 0 && BeatBoss == true) { BannerScript.UnlockTrophy("Virus Trophy"); } } //Check to see if player killed enough viruses if (IncrementKill > 0) { VirusKillCount = IncrementKill; IncrementKill = 0; } if (VirusKillCount == 50) { BannerScript.UnlockTrophy("Virus Capsid"); } } else { if (EnemyManger.GetComponent <VirusManager>().VirusList.Count == 0 && EnemyManger.GetComponent <VirusManager>().DoneSpawning == true) { EnemyManger.GetComponent <VirusManager>().DoneSpawning = false; TextForArcade(); } //If you lose story mode keep making them play until they beat it if (VirusLeaveCount == 5) { isGameOver = true; Text.text = "You lose story mode"; SceneManager.LoadScene("FightVirus"); } //If you win story mode continue to next scene and don't forget to fade out if (EnemyManger.GetComponent <VirusManager>().WaveNumber == 4 && EnemyManger.GetComponent <VirusManager>().VirusList.Count == 0) { isGameOver = true; Text.text = "You win story mode"; BeatGameTimer += Time.deltaTime; //float a = BlackCurtain.GetComponent<Renderer>().material.color.a; //if (a < 0) // a = 0; //BlackCurtain.GetComponent<Renderer>().material.color = new Color(0, 0, 0, a + (Time.deltaTime * 1.5f)); if (BeatGameTimer >= 2.0f) { CellGameplayScript.loadCase = 4; Set.SetAndEnterStatic(15); } } } } ////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// //Set up turtorial else if (GlobalVariables.tutorial == true) { //Need to fade in //float a = BlackCurtain.GetComponent<Renderer>().material.color.a; //BlackCurtain.GetComponent<Renderer>().material.color = new Color(0, 0, 0, a - (Time.deltaTime * 1.5f)); //Player input to skip text if (StopInput == false) { bool held = Input.GetButton("Fire1"); if (held && !last) { if (text) { finish = true; } else { PressToContinue.SetActive(false); TextForTutorial(); } } last = held; } //Checking for events if (VirusLeaveCount == 1 && WhatToRead == 5) { StopInput = false; PressToContinue.SetActive(true); WhatToRead += 1; } if (EnemyManger.GetComponent <VirusManager>().VirusList.Count == 0 && EnemyManger.GetComponent <VirusManager>().WaveNumber == 3 && WhatToRead == 9) { StopInput = false; PressToContinue.SetActive(true); WhatToRead++; } } }
void Update() { SeeValue = PlayerPrefs.GetInt("ReceptorTotalCount"); //For arcade and story mode if (GlobalVariables.tutorial == false) { if (GlobalVariables.arcadeMode) { ScoreGameOjbect.text = "Score: " + CurrentScore.ToString(); LivesGameObject.text = "Lives: " + Lives.ToString(); } //Display wave text if (InstructionsDone == true) { if (WaveStarted == true) { switch (WaveManager.GetComponent <WaveManager>().WaveNumber) { case 1: StartCoroutine(DisplayText("Wave1", 2.3f)); break; case 2: StartCoroutine(DisplayText("Wave2", 2.3f)); break; case 3: StartCoroutine(DisplayText("Wave3", 2.3f)); break; case 4: StartCoroutine(DisplayText("Final Wave", 2.3f)); break; default: break; } WaveManager.GetComponent <WaveManager>().WaveNumber += 1; WaveStarted = false; } } //Check which enemies are nearby Collider[] AntibodiesCloseBy = Physics.OverlapSphere(transform.position, 5.0f); if (AntibodiesCloseBy.Length != 0) { foreach (Collider enemy in AntibodiesCloseBy) { //If there is an enemy close then check if player is in the field of view if (enemy.GetComponent <AntiViralProtein>()) { if (enemy.GetComponent <AntiViralProtein>().CheckFOV() == true) { //Alert the player } } } } //Gameover if (GlobalVariables.arcadeMode) { if (Lives == 0) { isGameover = true; } } if (isGameover == true) { if (Lives != 0) { BeatGameTimer += Time.deltaTime; StartCoroutine(DisplayText("You Win", 2.0f)); if (!GlobalVariables.arcadeMode) { float a = BlackCurtain.GetComponent <Renderer>().material.color.a; if (a < 0) { a = 0; } BlackCurtain.GetComponent <Renderer>().material.color = new Color(0, 0, 0, a + (Time.deltaTime * 1.5f)); } else { Respawn(); if (CurrentScore > FinalScore) { FinalScore = CurrentScore; } if (FinalScore > PlayerPrefs.GetFloat("DestroyCellScore")) { PlayerPrefs.SetFloat("DestroyCellScore", FinalScore); } else { FinalScore = PlayerPrefs.GetFloat("DestroyCellScore"); } SetFacebook(); ScoreBoard.SetActive(true); ScoreBoard.transform.position = new Vector3(transform.position.x, transform.position.y, transform.position.z + 5); if (Lives == 3) { BannerScript.UnlockTrophy("Protein"); } } } else if (Lives == 0) { BeatGameTimer += Time.deltaTime; StartCoroutine(DisplayText("You Lose", 2.0f)); } if (BeatGameTimer >= 2.0f) { //For story mode once you beat it proceed to the next story mode if (!GlobalVariables.arcadeMode) { TutorialModeCompleted = false; ContinuePlayThrough(); } //For arcade mode once you beat it will bring up scoreboard else { Respawn(); SetFacebook(); ScoreBoard.SetActive(true); if (CurrentScore > BestScoreForDestroyCell) { BestScoreForDestroyCell = CurrentScore; } ScoreBoard.transform.position = new Vector3(transform.position.x, transform.position.y, transform.position.z + 5); } } } if (IncrementKill > 0) { CellReceptorKillCount = IncrementKill; IncrementKill = 0; } if (CellReceptorKillCount == 50) { BannerScript.UnlockTrophy("Receptor"); } } else if (GlobalVariables.tutorial == true) { //Need to fade in float a = BlackCurtain.GetComponent <Renderer>().material.color.a; BlackCurtain.GetComponent <Renderer>().material.color = new Color(0, 0, 0, a - (Time.deltaTime * 1.5f)); //Player input to skip text if (StopInput == false) { bool held = Input.GetButton("Fire1"); if (held && !last) { if (text) { finish = true; } else { PressToContinue.SetActive(false); TextForTutorial(); } } last = held; } //Checking for events if (WhatToRead == 2 && IsCellDoneIdling == true) { StopInput = false; PressToContinue.SetActive(true); } if (WhatToRead == 4 && IsCellDoneMoving == true) { StopInput = false; PressToContinue.SetActive(true); } if (WhatToRead == 5 && WaveManager.GetComponent <WaveManager>().CellReceptorsList.Count == 0) { StopInput = false; PressToContinue.SetActive(true); } if (WhatToRead == 7 && WaveManager.GetComponent <WaveManager>().AntiViralProteinList.Count == 0) { StopInput = false; PressToContinue.SetActive(true); } if (WhatToRead == 9 && WaveManager.GetComponent <WaveManager>().CellReceptorsList.Count == 0 && WaveManager.GetComponent <WaveManager>().DoneSpawningCellReceptors == true) { StopInput = false; PressToContinue.SetActive(true); } } }