public GameObject GetRelevantModel(PlayerStats.PlayerClass DesiredClass) { //If the list has a size and isn't null if (PlayerPrefabs != null && PlayerPrefabs.Count > 0) { //For each pref for (int i = 0; i < PlayerPrefabs.Count; i++) { //If it has a class (This shits important...) if (PlayerPrefabs[i] != null) { //If it matches if (PlayerPrefabs[i].Class == DesiredClass) { //And exists if (PlayerPrefabs[i].PlayerModel != null) { //Return the model return(PlayerPrefabs[i].PlayerModel); } } } } } //Otherwise, done goofed return(null); }
private void ChangeSelection(PlayerStats.PlayerClass Chosen) { //Update chosen PlayerStats.playerClass = Chosen; // Update all the text SetCharacterPerkText(Chosen.ToString()); //For each model container for (int i = 0; i < ModelContainer.Count; i++) { //If it exists if (ModelContainer[i] != null) { //If its model exists if (ModelContainer[i].PlayerModel != null) { //If it is the chosen one if (ModelContainer[i].Class == Chosen) { //Activate it ModelContainer[i].PlayerModel.SetActive(true); //Reset rotations ModelContainer[i].PlayerModel.transform.rotation = new Quaternion(); } else { //Otherwise, deactivate it ModelContainer[i].PlayerModel.SetActive(false); } } } } }
private void ChangeSelection(PlayerStats.PlayerClass Chosen) { if (Description != null) { Description.text = ""; Description.text += characterDescription; Description.MoveTextEnd(true); Description.textComponent.text = characterDescription; }//if //Update chosen PlayerStats.playerClass = Chosen; //For each model container for (int i = 0; i < ModelContainer.Count; i++) { //If it exists if (ModelContainer[i] != null) { //If its model exists if (ModelContainer[i].PlayerModel != null) { //If it is the chosen one if (ModelContainer[i].Class == Chosen) { //Activate it ModelContainer[i].PlayerModel.SetActive(true); //Reset rotations ModelContainer[i].PlayerModel.transform.rotation = new Quaternion(); } else { //Otherwise, deactivate it ModelContainer[i].PlayerModel.SetActive(false); } } } } }