IEnumerator IncreaseGrenades() { GameObject nade = GameObject.Find("FPSController/FirstPersonCharacter/BulletEmitter/"); Bullets grenade = nade.GetComponent <Bullets>(); GameObject miner = GameObject.Find("FPSController/FirstPersonCharacter/BulletEmitter/"); DeployMine mine = miner.GetComponent <DeployMine>(); grenade.currentGrenades = 3; mine.mineCount = 3; GameObject textUI = GameObject.Find("HUD/PowerType/"); Text powerType = textUI.GetComponent <Text>(); powerType.text = "Max Special Ammo"; yield return(new WaitForSeconds(5f)); powerType.text = ""; GameObject anotherPowerup = GameObject.Find("PowerupLocations/"); DeployPowerup deploy = anotherPowerup.GetComponent <DeployPowerup>(); yield return(new WaitForSeconds(5f)); deploy.ChooseSpawners(1); print("ANOTHER POWERUP SPAWNED"); // Remove Powerup Destroy(gameObject); }
IEnumerator RapidFire() { print("TEST"); GameObject gun = GameObject.Find("FPSController/FirstPersonCharacter/PM-40_Variant1/"); RayCastShoot raycast = gun.GetComponent <RayCastShoot>(); raycast.fireRate = 0.14f; raycast.currentAmmo = 30; raycast.maxAmmo = 30; raycast.SetAmmoText(); GameObject textUI = GameObject.Find("HUD/PowerType/"); Text powerType = textUI.GetComponent <Text>(); powerType.text = "Rapid Fire!"; //print("PowerupGiven"); yield return(new WaitForSeconds(30f)); raycast.fireRate = 0.25f; if (raycast.currentAmmo > 15) { raycast.currentAmmo = 15; } raycast.maxAmmo = 15; raycast.SetAmmoText(); powerType.text = "Powerup Removed"; print("Powerup Removed"); yield return(new WaitForSeconds(5f)); powerType.text = ""; GameObject anotherPowerup = GameObject.Find("PowerupLocations/"); DeployPowerup deploy = anotherPowerup.GetComponent <DeployPowerup>(); yield return(new WaitForSeconds(5f)); deploy.ChooseSpawners(2); print("ANOTHER POWERUP SPAWNED"); // Remove Powerup Destroy(gameObject); //print("GameObject removed"); }
IEnumerator IncreaseHealth() { //print("TEST"); GameObject player = GameObject.Find("FPSController/Player/"); PlayerHealth increaseHp = player.GetComponent <PlayerHealth>(); if (increaseHp.currentHealth <= 75) { increaseHp.currentHealth = increaseHp.currentHealth + 25; } else { increaseHp.currentHealth = 100; } increaseHp.HealthBar.value = increaseHp.currentHealth; print("Health Increased"); GameObject textUI = GameObject.Find("HUD/PowerType/"); Text powerType = textUI.GetComponent <Text>(); print(textUI); print(powerType); powerType.text = "Health Increased by 25!"; yield return(new WaitForSeconds(5f)); powerType.text = ""; GameObject anotherPowerup = GameObject.Find("PowerupLocations/"); DeployPowerup deploy = anotherPowerup.GetComponent <DeployPowerup>(); yield return(new WaitForSeconds(5f)); deploy.ChooseSpawners(1); print("ANOTHER POWERUP SPAWNED"); // Remove Powerup Destroy(gameObject); }
IEnumerator DoubleDamage() { GameObject gun = GameObject.Find("FPSController/FirstPersonCharacter/PM-40_Variant1/"); RayCastShoot raycast = gun.GetComponent <RayCastShoot>(); raycast.gunDamage = 2; GameObject textUI = GameObject.Find("HUD/PowerType/"); Text powerType = textUI.GetComponent <Text>(); powerType.text = "Double Damage!"; //print("PowerupGiven"); yield return(new WaitForSeconds(30f)); raycast.gunDamage = 1; //print("Powerup Removed"); powerType.text = "Powerup Removed"; yield return(new WaitForSeconds(5f)); powerType.text = ""; GameObject anotherPowerup = GameObject.Find("PowerupLocations/"); DeployPowerup deploy = anotherPowerup.GetComponent <DeployPowerup>(); yield return(new WaitForSeconds(5f)); deploy.ChooseSpawners(3); print("ANOTHER POWERUP SPAWNED"); // Remove Powerup Destroy(gameObject); //print("GameObject removed"); }