/// <summary>Displays information about the given race</summary> /// <param name="raceRef_">The RaceSelectorButton that contains the info to display</param> public void DisplayRaceInfo(RaceSelectorButton raceRef_) { this.raceNameText.text = raceRef_.race.ToString(); //The string that will be displayed in the raceInfoText string textToDisplay = raceRef_.raceDescription + "\n\n"; textToDisplay += " - Stats -" + "\nHit Points: " + raceRef_.startingHP + "\nMovement Speed: " + raceRef_.movementSpeed + " Tiles" + "\nStarting Group Size: " + raceRef_.startingGroupSize; //Displaying any racial abilities if they exist if (raceRef_.racialAbility != null) { textToDisplay += "\n\n - Ability -\n" + raceRef_.racialAbility.actionName; } //Displaying any racial perks if they exist if (raceRef_.racialPerks.Count > 0) { textToDisplay += "\n\n - Perks -"; for (int p = 0; p < raceRef_.racialPerks.Count; p++) { textToDisplay += "\n" + raceRef_.racialPerks[p].perkNameID; } } this.raceInfoText.text = textToDisplay; }
/// <summary>Sets the stats for the starting race using a RaceSelectorButton component</summary> /// <param name="startingRace_"></param> public void SetStartingRaceStats(RaceSelectorButton startingRace_) { //Deleting any previously created characters for (int d = 0; d < this.newPartyCharacters.Count; d++) { if (this.newPartyCharacters[d] != null) { Destroy(this.newPartyCharacters[d].gameObject); } } this.selectedRaceStats = startingRace_; //Creating new instances of the character prefabs for the party this.newPartyCharacters = new List <Character>(); for (int c = 0; c < this.selectedRaceStats.startingGroupSize; c++) { //If there's a valid character prefab for this index, we create a new instance of the prefab if (this.selectedRaceStats.characterPrefabList[c] != null) { GameObject newCharObj = GameObject.Instantiate(this.defaultCharacterRef.gameObject); this.newPartyCharacters.Add(newCharObj.GetComponent <Character>()); this.newPartyCharacters[c].charModels.charModel = this.selectedRaceStats.characterPrefabList[c].prefab; this.newPartyCharacters[c].charName = this.selectedRaceStats.characterPrefabList[c].charName; //Storing the index of the model for this character if (c == 0) { char0ModelIndex = c; } if (c == 1) { char1ModelIndex = c; } if (c == 2) { char2ModelIndex = c; } if (c == 3) { char3ModelIndex = c; } } //If this index isn't valid, we use a copy of the one at index 0 else { GameObject newCharObj = GameObject.Instantiate(this.defaultCharacterRef.gameObject); this.newPartyCharacters.Add(newCharObj.GetComponent <Character>()); this.newPartyCharacters[c].charModels.charModel = this.selectedRaceStats.characterPrefabList[0].prefab; this.newPartyCharacters[c].charName = this.selectedRaceStats.characterPrefabList[0].charName; if (c == 0) { char0ModelIndex = 0; } if (c == 1) { char1ModelIndex = 0; } if (c == 2) { char2ModelIndex = 0; } if (c == 3) { char3ModelIndex = 0; } } //Updating the character model displayed for this character this.UpdateCharacterModelAtIndex(c); } //Hiding the character panels for empty character slots this.char0Panel.SetActive(this.newPartyCharacters.Count > 0); this.char1Panel.SetActive(this.newPartyCharacters.Count > 1); this.char2Panel.SetActive(this.newPartyCharacters.Count > 2); this.char3Panel.SetActive(this.newPartyCharacters.Count > 3); //Updating the name fields this.UpdateNameTextfields(); }