public void DisplayAbilities() { switch (GameModeManager.gameModeToLoad) { case GameModes.Single: SinglePlayerManager manager = GameObject.FindWithTag("SPManager").GetComponent <SinglePlayerManager>(); for (int i = 0; i < manager.playerAbilitySprites.Count; i++) { if (i < currentAbilityImages.Count) { manager.playerAbilitySprites[i].GetComponent <Image>().sprite = currentAbilityImages[i]; manager.playerAbilitySprites[i].enabled = true; } else { manager.playerAbilitySprites[i].enabled = false; } } manager.UpdateHUD(); break; case GameModes.Coop: CoopManager Cmanager = GameObject.FindWithTag("CPManager").GetComponent <CoopManager>(); if (currentPlayer == "Player1") { for (int i = 0; i < Cmanager.player1AbilitySprites.Count; i++) { if (i < currentAbilityImages.Count) { Cmanager.player1AbilitySprites[i].GetComponent <Image>().sprite = currentAbilityImages[i]; Cmanager.player1AbilitySprites[i].enabled = true; } else { Cmanager.player1AbilitySprites[i].enabled = false; } } } else if (currentPlayer == "Player2") { for (int i = 0; i < Cmanager.player2AbilitySprites.Count; i++) { if (i < currentAbilityImages.Count) { Cmanager.player2AbilitySprites[i].GetComponent <Image>().sprite = currentAbilityImages[i]; Cmanager.player2AbilitySprites[i].enabled = true; } else { Cmanager.player2AbilitySprites[i].enabled = false; } } } Cmanager.UpdateHUD(); break; case GameModes.PvP: PvPManager Pmanager = GameObject.FindWithTag("PPManager").GetComponent <PvPManager>(); if (currentPlayer == "Player1") { for (int i = 0; i < Pmanager.player1AbilitySprites.Count; i++) { if (i < currentAbilityImages.Count) { Pmanager.player1AbilitySprites[i].GetComponent <Image>().sprite = currentAbilityImages[i]; Pmanager.player1AbilitySprites[i].enabled = true; } else { Pmanager.player1AbilitySprites[i].enabled = false; } } } else if (currentPlayer == "Player2") { for (int i = 0; i < Pmanager.player2AbilitySprites.Count; i++) { if (i < currentAbilityImages.Count) { Pmanager.player2AbilitySprites[i].GetComponent <Image>().sprite = currentAbilityImages[i]; Pmanager.player2AbilitySprites[i].enabled = true; } else { Pmanager.player2AbilitySprites[i].enabled = false; } } } Pmanager.UpdateHUD(); break; } }