Beispiel #1
0
    public void UnlockCharacter(int characterIndex)
    {
        List <GameObject> characters = GameObject.FindGameObjectWithTag("Player").GetComponentInChildren <CharacterManager>().GetCharacters();

        if (characters[characterIndex].GetComponent <CharacterSpecifics>().isUnlocked == false)
        {
            characters[characterIndex].GetComponent <CharacterSpecifics>().isUnlocked = true;

            Notification       notification       = new Notification();
            CharacterSpecifics characterSpecifics = characters[characterIndex].GetComponent <CharacterSpecifics>();

            notification.type        = "Character unlocked!";
            notification.title       = characterSpecifics.name;
            notification.duration    = notificationDuration;
            notification.description = notificationDescription;
            notification.scale       = notificationScale;
            notification.sprite      = characters[characterIndex].GetComponent <Image>().sprite;

            Debug.Log("Character unlocked!", characters[characterIndex]);
            GameObject.FindGameObjectWithTag("NotificationCenter").GetComponent <NotificationCenter>().ShowNotification(notification);
            AudioManager.instance.Play(unlockSound);

            Destroy(gameObject);
        }
    }
Beispiel #2
0
    private void DisplayCharacter(int characterIndex)
    {
        //refresh character list
        characters = GameObject.FindGameObjectWithTag("Player").GetComponentInChildren <CharacterManager>().GetCharacters();
        GameObject         character          = characters[characterIndex];
        CharacterSpecifics characterSpecifics = character.GetComponent <CharacterSpecifics>();
        SpecialAbility     specialAbility     = character.GetComponent <SpecialAbility>();

        if (characterSpecifics.isUnlocked)
        {
            characterImage.sprite     = character.GetComponent <Image>().sprite;
            characterName.text        = characterSpecifics.characterName;
            characterDescription.text = characterSpecifics.description.Replace("\\n", "\n");

            specialImage.sprite     = specialAbility.specialIcon;
            specialName.text        = specialAbility.specialName;
            specialDescription.text = specialAbility.specialDescription.Replace("\\n", "\n");

            maxHealth.text   = characterSpecifics.maxHealth.ToString();
            maxSpecial.text  = characterSpecifics.maxSpecial.ToString();
            specialRate.text = characterSpecifics.specialAbilityLoadingRate.ToString() + "/s";
        }
        else
        {
            DisplayDefault();
            DisplayCharacterPreview(characters[characterIndex]);
        }

        currentDisplayIndex = characterIndex;
    }
Beispiel #3
0
    public void SwitchCharacter(int characterIndex)
    {
        foreach (GameObject character in characters)
        {
            character.SetActive(false);
        }
        characters[characterIndex].SetActive(true);

        currentCharacterIndex = characterIndex;
        currentCharacter      = characters[characterIndex];

        CharacterSpecifics characterSpecifics = currentCharacter.GetComponent <CharacterSpecifics>();

        playerStats.UpdateStats(characterSpecifics.maxHealth, characterSpecifics.maxSpecial, characterSpecifics.specialAbilityLoadingRate);

        currentAnimator = currentCharacter.GetComponent <Animator>();

        GameObject.FindGameObjectWithTag("UI_CharacterName").GetComponent <TextMeshProUGUI>().text = currentCharacter.GetComponent <CharacterSpecifics>().characterName;

        specialAbilityManager.SwitchCharacter(currentCharacter);
    }
Beispiel #4
0
    private void DisplayCharacterPreview(GameObject character)
    {
        CharacterSpecifics characterSpecifics = character.GetComponent <CharacterSpecifics>();

        characterName.text = characterSpecifics.characterName;
    }