private void Start() { player = GameManager.Instance.player.GetComponent <PlayerController>(); KB = GetComponent <Knockback>(); IN = GetComponent <Invincible>(); spriteDmg.GetComponent <SpriteRenderer>(); }
// This is the function used to convert statues into shooty dudes. // we remove the statue and then spawn in a new enemy of the shooty type. private void SwapEnemyType(GameObject enemy, GameObject prefab) { Vector2 position = enemy.transform.position; Vector2 velocity = enemy.GetComponent <Rigidbody2D>().velocity; GameObject instancedEnemy = Instantiate(prefab, GameObject.Find("EnemyContainer").transform); Invincible invincible = instancedEnemy.AddComponent <Invincible>(); invincible.Duration = 0.5f; instancedEnemy.transform.position = position; instancedEnemy.GetComponent <Rigidbody2D>().velocity = velocity; if (instancedEnemy.GetComponent <TurretEnemy>() != null) { instancedEnemy.GetComponent <TurretEnemy>().ShootSound = TurretShootSound; } Destroy(enemy); }
// Generates references to each type of powerup object public static void GenerateAllPowerups() { if (PowerUps == null) { //initializes the array PowerUps = new PowerUp[GlobalVars.POWERUP_COUNT]; //the array of all possible PowerUps the spawned PowerUp could be PowerUps[0] = new LaneConversion(durationLaneConversion); PowerUps[1] = new SlowFall(fallSpeedModifierSlowFall, timeBonusSlowFall, durationSlowFall); PowerUps[2] = new Fuel(timeBonusAddTime); PowerUps[3] = new Multiply(multiplierElementMultiply); PowerUps[4] = new BucketShield(bucketShieldHitPoints); PowerUps[5] = new TapToCollect(durationTapToCollect); PowerUps[6] = new Invincible(durationInvincible, spawnRateModifierInvincible); PowerUps[7] = new TotalConversion(durationTotalConversion); PowerUps[8] = new CollectAll(); } }
private void OnTriggerEnter2D(Collider2D collision) { if (collision.gameObject.layer == 13) { // Same code as in Bullet.CS if (GameObject.Find("Player").GetComponent <Invincible>() == null) { GameObject.Find("Player").GetComponent <Health>().Amount -= Damage; Invincible invincible = GameObject.Find("Player").AddComponent <Invincible>(); invincible.Duration = InvulnerabilityLength; if (GameObject.Find("Player").GetComponent <FlashSpriteRed>() == null) { FlashSpriteRed flashRed = GameObject.Find("Player").AddComponent <FlashSpriteRed>(); flashRed.Duration = 0.5f; flashRed.startColor = new Color(1, 0, 0, 0.125f); flashRed.targetColor = new Color(1, 0, 0, 1f); } GameObject.Find("Player").GetComponent <Health>().PlayPainSound(); } } }
private void OnTriggerEnter2D(Collider2D collision) { // Layer 13 is a collider that is attached to the player for the sole purpose of allowing us to have enemies move through players // but still be able to check if enemies and players overlap if (collision.gameObject.layer == 13) { // Same code as in Bullet.CS if (GameObject.Find("Player").GetComponent <Invincible>() == null) { GameObject.Find("Player").GetComponent <Health>().Amount -= Damage; Invincible invincible = GameObject.Find("Player").AddComponent <Invincible>(); invincible.Duration = InvulnerabilityLength; if (GameObject.Find("Player").GetComponent <FlashSpriteRed>() == null) { FlashSpriteRed flashRed = GameObject.Find("Player").AddComponent <FlashSpriteRed>(); flashRed.Duration = 0.5f; flashRed.startColor = new Color(1, 0, 0, 0.125f); flashRed.targetColor = new Color(1, 0, 0, 1f); } GameObject.Find("Player").GetComponent <Health>().PlayPainSound(); } } }
private void Start() { animator = GetComponent <Animator>(); if (!(jump = FindObjectOfType <Jump>())) { jump = gameObject.AddComponent <Jump>(); } if (!(shoot = FindObjectOfType <Shoot>())) { shoot = gameObject.AddComponent <Shoot>(); } if (!(invincible = FindObjectOfType <Invincible>())) { invincible = gameObject.AddComponent <Invincible>(); } if (!(dash = FindObjectOfType <Dash>())) { dash = gameObject.AddComponent <Dash>(); } }
// Use this for initialization void Start() { //make PowerUpScreen active since Content is referenced powerScreen = GameObject.Find ("Canvas/PowerUpScreen"); powerScreen.SetActive (true); contentList = GameObject.Find ("Canvas/PowerUpScreen/ScrollView/Content"); powerScreen.SetActive (false); buttonScale = new Vector3 (buttonSize, buttonSize, buttonSize); upgradeBarImages = new Sprite[]{upgradeBar0,upgradeBar1,upgradeBar2,upgradeBar3}; upgradeCardImages = new Sprite[]{upgradeCard0,upgradeCard1,upgradeCard2,upgradeCard3}; PowerUps = new PowerUp[GlobalVars.POWERUP_COUNT]; //the array of all possible PowerUps the spawned PowerUp could be PowerUps[0] = new LaneConversion(DEFAULT_NUMBER); PowerUps[1] = new SlowFall(DEFAULT_NUMBER,DEFAULT_NUMBER,DEFAULT_NUMBER); PowerUps[2] = new Fuel(DEFAULT_NUMBER) ; PowerUps[3] = new Multiply(DEFAULT_NUMBER,DEFAULT_NUMBER); PowerUps[4] = new BucketShield(DEFAULT_NUMBER); PowerUps[5] = new TapToCollect(DEFAULT_NUMBER); PowerUps[6] = new Invincible(DEFAULT_NUMBER, DEFAULT_NUMBER); PowerUps[7] = new TotalConversion(DEFAULT_NUMBER); PowerUps[8] = new CollectAll(); powerDescriptions = new string[TOTAL_BASE_POWERUPS*UPGRADE_LEVELS]{ "Tap or drag this ability into a specific lane to convert the elements contained to the lane’s elemental type.",//power 1, level 1 "Tap or drag this ability into a specific lane to convert the elements contained, and an adjacent lane, to each lane’s elemental type.",//power 1, level 2 "Tap or drag this ability to convert the elements contained within each lane to the lane’s elemental type.",//power 1, level 3 "Tap or drag this ability into a specific lane to slow down the fall of elements contained.",//power 2, level 1 "Tap or drag this ability into a specific lane to significantly slow down the fall of elements contained.",//power 2, level 2 "Tap or drag this ability to significantly slow down the fall all elements.",//power 2, level 3 "Your fuel does not deplete for a certain duration.",//power 3, level 1 "You gain additional fuel and it does not deplete for a certain duration.",//power 3, level 2 "You gain a significant amount of additional fuel and it does not deplete for a certain duration.",//power 3, level 3 "Tap or drag this ability into a specific lane to receive a score multiplier for the elements collected of that lane’s elemental type.",//power 4, level 1 "Tap or drag this ability into a specific lane to receive a score multiplier for the elements collected of that lane’s elemental type, and an adjacent lane’s elemental type.",//power 4, level 2 "Tap or drag this ability to receive a score multiplier for elements collected of all elemental types.",//power 4, level 3 "Tap or drag this ability into a specific lane to give that lane no miss penalty for the next 2 incorrect elements that fall into it.",//power 5, level 1 "Tap or drag this ability into a specific lane to give that lane no miss penalty for the next 4 incorrect elements that fall into it.",//power 5, level 2 "Tap or drag this ability to give all lanes no miss penalty for the next 4 incorrect elements that fall into them, for each lane.",//power 5, level 3 "Simply tap elements to automatically collect them.",//power 6, level 1 "Simply tap elements to automatically collect them.",//power 6, level 2 "Simply tap elements to automatically collect them.",//power 6, level 3 "Tap or drag this ability into a specific lane to give that lane no miss penalty for a small amount of time.",//power 7, level 1 "Tap or drag this ability into a specific lane to give that lane no miss penalty for a decent amount of time.",//power 7, level 2 "Tap or drag this ability to give all lanes no miss penalty for a decent amount of time.",//power 7, level 3 "Tap or drag this ability into a specific lane to convert all spawned elements to the lane’s elemental type for a small amount of time.",//power 8, level 1 "Tap or drag this ability into a specific lane to convert all spawned elements to the lane’s elemental type for a decent amount of time.",//power 8, level 2 "Tap or drag this ability into a specific lane to convert all spawned elements to the lane’s elemental type and gain invincibility for a decent amount of time.",//power 8, level 3 "Tap or drag this ability into a specific lane to automatically collect all elements in that lane.",//power 9, level 1 "Tap or drag this ability into a specific lane to automatically collect all elements in that lane and an adjacent lane.",//power 9, level 2 "Tap or drag this ability to automatically collect all elements in all lanes."};//power 9, level 3 bonusTexts = new string[TOTAL_BASE_POWERUPS*UPGRADE_LEVELS]{ "1 Lane",//power 1, level 1 "2 Lanes",//power 1, level 2 "All Lanes",//power 1, level 3 "Slow",//power 2, level 1 "Slower",//power 2, level 2 "Slower & All Lanes",//power 2, level 3 "Fuel",//power 3, level 1 "Fuel+",//power 3, level 2 "Fuel++",//power 3, level 3 "1 Element",//power 4, level 1 "2 Elements",//power 4, level 2 "4 Element",//power 4, level 3 "2 Saves & 1 Lane",//power 5, level 1 "4 Saves & 1 Lane",//power 5, level 2 "4 Saves & All Lanes",//power 5, level 3 "Tap Time",//power 6, level 1 "Tap Time+",//power 6, level 2 "Tap Time++",//power 6, level 3 "Invincible Time & 1 Lane",//power 7, level 1 "Invincible Time+ & 1 Lane",//power 7, level 2 "Invincible Time+ & All Lanes",//power 7, level 3 "Conversion Time",//power 8, level 1 "Conversion Time+",//power 8, level 2 "Conversion Time+ & Invincible",//power 8, level 3 "1 Lane",//power 9, level 1 "2 Lanes",//power 9, level 2 "All Lanes"};//power 9, level 3 elem = new string[TOTAL_BASE_POWERUPS*TIMES_UPGRADED,TYPES_OF_ELEMENTS_PER_UNLOCK]{ {FirstPowerUpElements[0], FirstPowerUpElements[1], FirstPowerUpElements[2], FirstPowerUpElements[3]},//power 1, upgrade 1 {"magma","cloud","mud","energy"},//power 1, upgrade 2 {"desert","earthquake","blizzard","mountain"},//power 2, upgrade 1 {"storm","glass","clay","brick"},//power 2, upgrade 2 {"coal","volcano","tornado","glacier"},//power 3, upgrade 1 {"ion","fission","ceramics","monsoon"},//power 3, upgrade 2 {"diamond","aurora","smoke","flood"},//power 4, upgrade 1 {"metal","grass","radiation","tsunami"},//power 4, upgrade 2 {"meteoroid","supernova","archipelago","rust"},//power 5, upgrade 1 {"wasteland","voltage","tide","edifice"},//power 5, upgrade 2 {"algae","pulsar","dynamo","windmill"},//power 6, upgrade 1 {"aliens","fusion","whirlpool","resistance"},//power 6, upgrade 2 {"forest","crater","maze","apocalypse"},//power 7, upgrade 1 {"dreams","balance","coincidence","fate"},//power 7, upgrade 2 {"valley","fruit","sorcery","prophecy"},//power 8, upgrade 1 {"inertia","morality","method","insight"},//power 8, upgrade 2 {"emotion","chaos","deception","reason"},//power 9, upgrade 1 {"information","chronology","absurd","motivation"}};//power 9, upgrade 2 cost = new int[TOTAL_BASE_POWERUPS*TIMES_UPGRADED,TYPES_OF_ELEMENTS_PER_UNLOCK]{ {50, 50, 50, 50},//power 1, upgrade 1 {99,99,99,99},//power 1, upgrade 2 {50,50,50,50},//power 2, upgrade 1 {99,99,99,99},//power 2, upgrade 2 {50,50,50,50},//power 3, upgrade 1 {99,99,99,99},//power 3, upgrade 2 {50,50,50,50},//power 4, upgrade 1 {99,99,99,99},//power 4, upgrade 2 {50,50,50,50},//power 5, upgrade 1 {99,99,99,99},//power 5, upgrade 2 {50,50,50,50},//power 6, upgrade 1 {99,99,99,99},//power 6, upgrade 2 {50,50,50,50},//power 7, upgrade 1 {99,99,99,99},//power 7, upgrade 2 {50,50,50,50},//power 8, upgrade 1 {99,99,99,99},//power 8, upgrade 2 {50,50,50,50},//power 9, upgrade 1 {99,99,99,99}};//power 9, upgrade 2 notEnoughColor = new Color(255.0f/255.0f,135.0f/255.0f,126.0f/255.0f); }
// Use this for initialization void Start() { invincible = gameObject.GetComponentInParent <Invincible>(); animator = GetComponentInChildren <Animator>(); }
private void OnTriggerEnter2D(Collider2D collision) { // Destroy bullet if it hits a wall if (collision.gameObject.layer == 12) { Destroy(this.gameObject); return; } // Make sure required variables are here Team targetTeam = collision.gameObject.GetComponent <Team>(); Team bulletTeam = this.GetComponent <Team>(); Health targetHealth = collision.gameObject.GetComponent <Health>(); if (bulletTeam == null || targetTeam == null || targetHealth == null) { return; } // Make sure enemy bullets dont hit enemies and player bullets dont hit players if (targetTeam.TeamID != bulletTeam.TeamID) { // Layer 8 is enemies so this checks if the bullet hit an enemy if (collision.gameObject.layer == 8) { // Check the bullet hit a red dude as thet are the ONLY ONE we can attack if (collision.gameObject.GetComponent <CommanderEnemy>() != null && bulletTeam.TeamID != TeamIDs.Turret && collision.gameObject.GetComponent <Invincible>() == null) { collision.gameObject.GetComponent <Health>().Amount -= Damage; GameObject.Find("GameManager").GetComponent <ScoreCounter>().Score++; } else if (collision.gameObject.GetComponent <StatueEnemy>() != null && bulletTeam.TeamID == TeamIDs.Turret && collision.gameObject.GetComponent <Invincible>() == null) { // Comment this out to disable turret bullets killing statues collision.gameObject.GetComponent <Health>().Amount -= Damage; Destroy(this.gameObject); // Comment above to disable turret bullets killing statues return; } if (collision.gameObject.GetComponent <CommanderEnemy>() != null && bulletTeam.TeamID == TeamIDs.Turret) { return; } } // Check if we hit player head collision box else { // Dont deal damage if we are invincible if (collision.gameObject.GetComponent <Invincible>() == null) { collision.gameObject.GetComponent <Health>().Amount -= Damage; // Give temporary invincibility after being hit Invincible invincible = collision.gameObject.AddComponent <Invincible>(); invincible.Duration = InvulnerabilityDuration; // Flash the sprite red to show we got hit if (collision.gameObject.GetComponent <FlashSpriteRed>() == null) { FlashSpriteRed flashRed = collision.gameObject.AddComponent <FlashSpriteRed>(); flashRed.Duration = 0.5f; flashRed.startColor = new Color(1, 0, 0, 0.125f); flashRed.targetColor = new Color(1, 0, 0, 1f); } collision.gameObject.GetComponent <Health>().PlayPainSound(); } } Destroy(this.gameObject); } }
// Use this for initialization void Start() { //make PowerUpScreen active since Content is referenced powerScreen = GameObject.Find("Canvas/PowerUpScreen"); powerScreen.SetActive(true); contentList = GameObject.Find("Canvas/PowerUpScreen/ScrollView/Content"); powerScreen.SetActive(false); buttonScale = new Vector3(buttonSize, buttonSize, buttonSize); upgradeBarImages = new Sprite[] { upgradeBar0, upgradeBar1, upgradeBar2, upgradeBar3 }; upgradeCardImages = new Sprite[] { upgradeCard0, upgradeCard1, upgradeCard2, upgradeCard3 }; PowerUps = new PowerUp[GlobalVars.POWERUP_COUNT]; //the array of all possible PowerUps the spawned PowerUp could be PowerUps[0] = new LaneConversion(DEFAULT_NUMBER); PowerUps[1] = new SlowFall(DEFAULT_NUMBER, DEFAULT_NUMBER, DEFAULT_NUMBER); PowerUps[2] = new Fuel(DEFAULT_NUMBER); PowerUps[3] = new Multiply(DEFAULT_NUMBER, DEFAULT_NUMBER); PowerUps[4] = new BucketShield(DEFAULT_NUMBER); PowerUps[5] = new TapToCollect(DEFAULT_NUMBER); PowerUps[6] = new Invincible(DEFAULT_NUMBER, DEFAULT_NUMBER); PowerUps[7] = new TotalConversion(DEFAULT_NUMBER); PowerUps[8] = new CollectAll(); powerDescriptions = new string[TOTAL_BASE_POWERUPS * UPGRADE_LEVELS] { "Tap or drag this ability into a specific lane to convert the elements contained to the lane’s elemental type.", //power 1, level 1 "Tap or drag this ability into a specific lane to convert the elements contained, and an adjacent lane, to each lane’s elemental type.", //power 1, level 2 "Tap or drag this ability to convert the elements contained within each lane to the lane’s elemental type.", //power 1, level 3 "Tap or drag this ability into a specific lane to slow down the fall of elements contained.", //power 2, level 1 "Tap or drag this ability into a specific lane to significantly slow down the fall of elements contained.", //power 2, level 2 "Tap or drag this ability to significantly slow down the fall all elements.", //power 2, level 3 "Your fuel does not deplete for a certain duration.", //power 3, level 1 "You gain additional fuel and it does not deplete for a certain duration.", //power 3, level 2 "You gain a significant amount of additional fuel and it does not deplete for a certain duration.", //power 3, level 3 "Tap or drag this ability into a specific lane to receive a score multiplier for the elements collected of that lane’s elemental type.", //power 4, level 1 "Tap or drag this ability into a specific lane to receive a score multiplier for the elements collected of that lane’s elemental type, and an adjacent lane’s elemental type.", //power 4, level 2 "Tap or drag this ability to receive a score multiplier for elements collected of all elemental types.", //power 4, level 3 "Tap or drag this ability into a specific lane to give that lane no miss penalty for the next 2 incorrect elements that fall into it.", //power 5, level 1 "Tap or drag this ability into a specific lane to give that lane no miss penalty for the next 4 incorrect elements that fall into it.", //power 5, level 2 "Tap or drag this ability to give all lanes no miss penalty for the next 4 incorrect elements that fall into them, for each lane.", //power 5, level 3 "Simply tap elements to automatically collect them.", //power 6, level 1 "Simply tap elements to automatically collect them.", //power 6, level 2 "Simply tap elements to automatically collect them.", //power 6, level 3 "Tap or drag this ability into a specific lane to give that lane no miss penalty for a small amount of time.", //power 7, level 1 "Tap or drag this ability into a specific lane to give that lane no miss penalty for a decent amount of time.", //power 7, level 2 "Tap or drag this ability to give all lanes no miss penalty for a decent amount of time.", //power 7, level 3 "Tap or drag this ability into a specific lane to convert all spawned elements to the lane’s elemental type for a small amount of time.", //power 8, level 1 "Tap or drag this ability into a specific lane to convert all spawned elements to the lane’s elemental type for a decent amount of time.", //power 8, level 2 "Tap or drag this ability into a specific lane to convert all spawned elements to the lane’s elemental type and gain invincibility for a decent amount of time.", //power 8, level 3 "Tap or drag this ability into a specific lane to automatically collect all elements in that lane.", //power 9, level 1 "Tap or drag this ability into a specific lane to automatically collect all elements in that lane and an adjacent lane.", //power 9, level 2 "Tap or drag this ability to automatically collect all elements in all lanes." }; //power 9, level 3 bonusTexts = new string[TOTAL_BASE_POWERUPS * UPGRADE_LEVELS] { "1 Lane", //power 1, level 1 "2 Lanes", //power 1, level 2 "All Lanes", //power 1, level 3 "Slow", //power 2, level 1 "Slower", //power 2, level 2 "Slower & All Lanes", //power 2, level 3 "Fuel", //power 3, level 1 "Fuel+", //power 3, level 2 "Fuel++", //power 3, level 3 "1 Element", //power 4, level 1 "2 Elements", //power 4, level 2 "4 Element", //power 4, level 3 "2 Saves & 1 Lane", //power 5, level 1 "4 Saves & 1 Lane", //power 5, level 2 "4 Saves & All Lanes", //power 5, level 3 "Tap Time", //power 6, level 1 "Tap Time+", //power 6, level 2 "Tap Time++", //power 6, level 3 "Invincible Time & 1 Lane", //power 7, level 1 "Invincible Time+ & 1 Lane", //power 7, level 2 "Invincible Time+ & All Lanes", //power 7, level 3 "Conversion Time", //power 8, level 1 "Conversion Time+", //power 8, level 2 "Conversion Time+ & Invincible", //power 8, level 3 "1 Lane", //power 9, level 1 "2 Lanes", //power 9, level 2 "All Lanes" }; //power 9, level 3 elem = new string[TOTAL_BASE_POWERUPS * TIMES_UPGRADED, TYPES_OF_ELEMENTS_PER_UNLOCK] { { FirstPowerUpElements[0], FirstPowerUpElements[1], FirstPowerUpElements[2], FirstPowerUpElements[3] }, //power 1, upgrade 1 { "magma", "cloud", "mud", "energy" }, //power 1, upgrade 2 { "desert", "earthquake", "blizzard", "mountain" }, //power 2, upgrade 1 { "storm", "glass", "clay", "brick" }, //power 2, upgrade 2 { "coal", "volcano", "tornado", "glacier" }, //power 3, upgrade 1 { "ion", "fission", "ceramics", "monsoon" }, //power 3, upgrade 2 { "diamond", "aurora", "smoke", "flood" }, //power 4, upgrade 1 { "metal", "grass", "radiation", "tsunami" }, //power 4, upgrade 2 { "meteoroid", "supernova", "archipelago", "rust" }, //power 5, upgrade 1 { "wasteland", "voltage", "tide", "edifice" }, //power 5, upgrade 2 { "algae", "pulsar", "dynamo", "windmill" }, //power 6, upgrade 1 { "aliens", "fusion", "whirlpool", "resistance" }, //power 6, upgrade 2 { "forest", "crater", "maze", "apocalypse" }, //power 7, upgrade 1 { "dreams", "balance", "coincidence", "fate" }, //power 7, upgrade 2 { "valley", "fruit", "sorcery", "prophecy" }, //power 8, upgrade 1 { "inertia", "morality", "method", "insight" }, //power 8, upgrade 2 { "emotion", "chaos", "deception", "reason" }, //power 9, upgrade 1 { "information", "chronology", "absurd", "motivation" } }; //power 9, upgrade 2 cost = new int[TOTAL_BASE_POWERUPS * TIMES_UPGRADED, TYPES_OF_ELEMENTS_PER_UNLOCK] { { 50, 50, 50, 50 }, //power 1, upgrade 1 { 99, 99, 99, 99 }, //power 1, upgrade 2 { 50, 50, 50, 50 }, //power 2, upgrade 1 { 99, 99, 99, 99 }, //power 2, upgrade 2 { 50, 50, 50, 50 }, //power 3, upgrade 1 { 99, 99, 99, 99 }, //power 3, upgrade 2 { 50, 50, 50, 50 }, //power 4, upgrade 1 { 99, 99, 99, 99 }, //power 4, upgrade 2 { 50, 50, 50, 50 }, //power 5, upgrade 1 { 99, 99, 99, 99 }, //power 5, upgrade 2 { 50, 50, 50, 50 }, //power 6, upgrade 1 { 99, 99, 99, 99 }, //power 6, upgrade 2 { 50, 50, 50, 50 }, //power 7, upgrade 1 { 99, 99, 99, 99 }, //power 7, upgrade 2 { 50, 50, 50, 50 }, //power 8, upgrade 1 { 99, 99, 99, 99 }, //power 8, upgrade 2 { 50, 50, 50, 50 }, //power 9, upgrade 1 { 99, 99, 99, 99 } }; //power 9, upgrade 2 notEnoughColor = new Color(255.0f / 255.0f, 135.0f / 255.0f, 126.0f / 255.0f); }
// Generates references to each type of powerup object public static void GenerateAllPowerups () { if (PowerUps == null) { //initializes the array PowerUps = new PowerUp[GlobalVars.POWERUP_COUNT]; //the array of all possible PowerUps the spawned PowerUp could be PowerUps[0] = new LaneConversion(durationLaneConversion); PowerUps[1] = new SlowFall(fallSpeedModifierSlowFall,timeBonusSlowFall,durationSlowFall); PowerUps[2] = new Fuel(timeBonusAddTime) ; PowerUps[3] = new Multiply(multiplierElementMultiply); PowerUps[4] = new BucketShield(bucketShieldHitPoints); PowerUps[5] = new TapToCollect(durationTapToCollect); PowerUps[6] = new Invincible(durationInvincible, spawnRateModifierInvincible); PowerUps[7] = new TotalConversion(durationTotalConversion); PowerUps[8] = new CollectAll(); } }