Пример #1
0
    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);
            }
        }
    }
Пример #2
0
 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);
    }
Пример #4
0
        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]);
        }
Пример #5
0
        public bool DeactivateCharacterReturnWasAcrive(string characterName)
        {
            int characterIndex = CharacterDataSupplier.GetIndexFromName(Characters, characterName);

            if (ActiveCharacters.Contains(characterIndex))
            {
                ActiveCharacters.Remove(characterIndex);
                return(true);
            }
            else
            {
                return(false);
            }
        }
Пример #6
0
    void SetStatsBarsFromString(string name)
    {
        CharacterDataHolder characterHolder = FindObjectOfType <GameManager>().Characters;

        CreateCharacterStats(CharacterDataSupplier.GetIndexFromName(characterHolder, name));
    }
Пример #7
0
        public bool CheckIfCharacterIsActive(string characterName)
        {
            int characterIndex = CharacterDataSupplier.GetIndexFromName(Characters, characterName);

            return(ActiveCharacters.Contains(characterIndex));
        }