void Update() { //references for these game objects had to be done in the update section as the script has to be executed constantly as these objects only appear at different stages of the game gameEnemyTypeTwoScript = GameObject.FindWithTag("EnemyShipTwo"); enemyTypeTwoScript = gameEnemyTypeTwoScript.GetComponent <EnemyTypeTwoScript>(); gameEnemyTypeThreeScript = GameObject.FindWithTag("EnemyShipThree"); enemyTypeThreeScript = gameEnemyTypeThreeScript.GetComponent <EnemyTypeThreeScript>(); }
void Update() { HazardDamage = 1 * gameController.newGamePlusMultiplier; HealthPowerUp = gameController.PowerUpHealthRegen * gameController.newGamePlusMultiplier; BulletSpeedPowerUp = gameController.PowerupSpeedInt * gameController.newGamePlusMultiplier; BulletPowerPowerUp = gameController.PowerUpBulletStrength * gameController.newGamePlusMultiplier; HealthPowerUpHealthBar = gameController.PowerUpExpandHealthBar * gameController.newGamePlusMultiplier; tileDamage = gameController.myRandom.Next(5, 10); bossDamage = gameController.myRandom.Next(10, 20); //game over conditions if (IsGameOver == false) { GameOverText.enabled = false; } if (IsGameOver == true) { GameOverText.enabled = true; } UpdateHP(); if (HealthBarSlider.value < 1) { IsGameOver = true; //set game over to true GameOverText.enabled = true; //enable GameOver text Instantiate(Explosion, transform.position, transform.rotation); Destroy(gameObject); } // Enemy details gameEnemyScript = GameObject.FindWithTag("EnemyShip"); enemyScript = gameEnemyScript.GetComponent <EnemyScript>(); gameEnemyTypeTwoScript = GameObject.FindWithTag("EnemyShipTwo"); enemyTypeTwoScript = gameEnemyTypeTwoScript.GetComponent <EnemyTypeTwoScript>(); gameEnemyTypeThreeScript = GameObject.FindWithTag("EnemyShipThree"); enemyTypeThreeScript = gameEnemyTypeThreeScript.GetComponent <EnemyTypeThreeScript>(); }