Beispiel #1
0
    void ChooseRace(int raceName)
    {
        switch (raceName)
        {
        case 0:
            health   = 110;
            mana     = 65;
            charRace = characterRace.Human;
            break;

        case 1:
            health   = 90;
            mana     = 90;
            charRace = characterRace.Dragonborn;
            break;

        case 2:
            health   = 150;
            mana     = 30;
            charRace = characterRace.Gnome;
            break;

        case 3:
            health   = 50;
            mana     = 100;
            charRace = characterRace.Elf;
            break;

        case 4:
            health   = 110;
            mana     = 50;
            charRace = characterRace.Dwarf;
            break;
        }
    }
    public GameObject GetRandomClassOfRaceCharacter(characterRace _race)
    {
        int max = Enum.GetValues(typeof(characterClass)).Length;
        int rng = (int)UnityEngine.Random.Range(0, max);

        foreach (GameObject chara in playerCharactersChooseable)
        {
            if (chara.GetComponent <PlayerCharacter>().cRace == _race && (int)chara.GetComponent <PlayerCharacter>().cClass == rng)
            {
                return(chara);
            }
        }
        return(null);
    }