public void CreateCharacterStats(int index) { CharacterDataHolder characterHolder = FindObjectOfType <GameManager>().Characters; Character character = CharacterDataSupplier.GetCharacterFromIndex(characterHolder, index); for (int i = 0; i < character.stats.Length; i++) { GameObject go; if (ObjectPool.Count > i) { go = ObjectPool[i]; } else { go = Instantiate(StatsBarPrefab, transform.parent); ObjectPool.Add(go); go = ObjectPool[i]; } if (!ObjectPool[i].activeSelf) { ObjectPool[i].SetActive(true); } ObjectPool[i].GetComponent <StatBar>().HookUp(character.stats[i]); } if (ObjectPool.Count > character.stats.Length) { for (int i = character.stats.Length; i < ObjectPool.Count; i++) { ObjectPool[i].SetActive(false); } } }
public void DisplayCharacters(bool isVisible) { if (!isVisible) { CharacterDataHolder characterHolder = FindObjectOfType <ManagementScripts.GameManager>().Characters; textDisplayTemplate.GetComponent <IDisplayCharacters>().Display(CharacterDataSupplier.AllCharacterNames(characterHolder)); } }
private void GetAndShowCharacterDetails(string characterName) { gameManager.ActivateCharacterReturnWasActive(characterName); CharacterDataHolder holder = gameManager.Characters; CurrentCharacterName = characterName; CharacterNameText.text = "Name: " + characterName; SetMoneyText(CharacterDataSupplier.GetCharacterFromName(holder, characterName).FinancialAccountID); }
public void can_create_a_random_character_and_verify_exists() { string[] fakeStats = { "stat1", "stat2" }; CharacterDataHolder characterDataHolder = new CharacterDataHolder(fakeStats); Character character = CharacterDataCreator.CreateRandomCharacter(characterDataHolder, 1, 2); Assert.NotNull(CharacterDataSupplier.AllCharacterNames(characterDataHolder)); Assert.AreEqual(character.CharacterName, CharacterDataSupplier.AllCharacterNames(characterDataHolder)[CharacterDataSupplier.AllCharacterNames(characterDataHolder).Length - 1]); }
public bool DeactivateCharacterReturnWasAcrive(string characterName) { int characterIndex = CharacterDataSupplier.GetIndexFromName(Characters, characterName); if (ActiveCharacters.Contains(characterIndex)) { ActiveCharacters.Remove(characterIndex); return(true); } else { return(false); } }
void SetStatsBarsFromString(string name) { CharacterDataHolder characterHolder = FindObjectOfType <GameManager>().Characters; CreateCharacterStats(CharacterDataSupplier.GetIndexFromName(characterHolder, name)); }
public bool CheckIfCharacterIsActive(string characterName) { int characterIndex = CharacterDataSupplier.GetIndexFromName(Characters, characterName); return(ActiveCharacters.Contains(characterIndex)); }