Пример #1
0
    private void LoadCharacterBackgrounds()
    {
        var allBackgrounds = CharacterBackgroundLoader.GetCharacterBackgroundTypes().ToList();

        foreach (var background in allBackgrounds)
        {
            var option = Instantiate(BackgroundOptionPrefab, BackgroundOptionPrefab.transform.position,
                                     Quaternion.identity);

            option.transform.SetParent(BackgroundOptionParent);

            option.GetComponent <RectTransform>().localScale = new Vector3(1, 1, 1);

            option.transform.GetChild(0).GetComponent <TextMeshProUGUI>().text = background;

            if (background != allBackgrounds.First())
            {
                continue;
            }

            SelectButton(option);
        }

        _selectedBackground = CharacterBackgroundLoader.GetCharacterBackground(allBackgrounds.First());
    }
    private void LoadTable(int tableIndex, int startIndex, string[][] sheet)
    {
        int nextIndex    = startIndex + 1;
        int subRowLength = 0;

        CharacterBackground cb = new CharacterBackground();

        cb.id   = tableIndex;
        cb.die  = int.Parse(sheet[startIndex][0].Replace("d", ""));
        cb.name = sheet[startIndex][1];

        string testCell = sheet[nextIndex][0];

        while (testCell != "" && nextIndex < sheet.GetLength(0))
        {
            nextIndex    += 1;
            subRowLength += 1;
            testCell      = sheet[nextIndex][0];
        }

        cb.dieScore = new int[subRowLength];
        cb.detail   = new string[subRowLength];

        int subRow = 0;

        for (int row = startIndex + 1; row < startIndex + subRowLength + 1; row++)
        {
            cb.dieScore[subRow] = int.Parse(sheet[row][0]);
            cb.detail[subRow]   = sheet[row][1];

            subRow += 1;
        }

        Data[tableIndex] = cb;
    }
Пример #3
0
 public PlayerStatusComponent(ref PlayerStatusComponent rhs)
 {
     status          = rhs.status;
     maxMadness      = rhs.maxMadness;
     moveSpeed       = 1.0f;
     madnessWeight   = 1.0f;
     searchingWeight = 1.0f;
 }
Пример #4
0
 void Awake()
 {
     my_text_obj      = GetComponentInChildren <Text>();
     curr_char_text   = FindObjectOfType <CurrCharText>();
     event_controller = FindObjectOfType <EventControllerMain>();
     my_transform     = gameObject.transform;
     my_characters    = FindObjectOfType <MyCharacters>();
     background       = GetComponentInChildren <CharacterBackground>();
 }
Пример #5
0
    public EntityFluff(string entityType, List <string> possibleNameFiles)
    {
        Sex         = _sexes[Random.Range(0, _sexes.Count)];
        _entityType = entityType;
        Name        = GenerateName(possibleNameFiles);
        Background  = new List <string>();
        _turnBorn   = HistoryGenerator.CurrentTurn;

        BackgroundType = PickBackgroundType();
    }
Пример #6
0
 public PersonalInformation(CharacterName characterName, CharacterSex characterSex,
                            CharacterRace characterRace, CharacterBackground characterBackground, CharacterAge characterAge,
                            CharacterHeight characterHeight, CharacterWeight characterWeight, CharacterHairStyle hairStyle)
 {
     cName       = characterName;
     cRace       = characterRace;
     cSex        = characterSex;
     cBackground = characterBackground;
     cHeight     = characterHeight;
     cWeight     = characterWeight;
     cAge        = characterAge;
     cHair       = hairStyle;
 }
    private void DisplayData(CharacterBackground table)
    {
        Text          displayText;
        RectTransform frame  = new RectTransform();
        string        detail = table.RollOnTable();

        frame = GetDetailFrame(table, frame);

        if (frame != null)
        {
            displayText      = frame.Find("Body").GetComponent <Text>();
            displayText.text = detail;
        }
    }
Пример #8
0
    public void SelectCharacterBackgroundOption(CharacterBackground background)
    {
        _selectedBackground = background;

        var description = background.Description;

        LoadStartingAbilitiesForBackground(background);

        if (BackgroundDescription.activeSelf)
        {
            DisplayCharacterBackgroundDescription(description);
        }
        else
        {
            DisplayBackgroundStartingAbilities();
        }
    }
Пример #9
0
    private void LoadStartingAbilitiesForBackground(CharacterBackground background)
    {
        GlobalHelper.DestroyAllChildren(BackgroundStartingAbilityParent);

        var backgroundAbilities = AbilityStore.GetAbilitiesByBackground(background);

        foreach (var ability in backgroundAbilities)
        {
            var instance = Instantiate(StartingAbilityPrefab, StartingAbilityPrefab.transform.position,
                                       Quaternion.identity);

            instance.transform.SetParent(BackgroundStartingAbilityParent);

            instance.transform.GetComponentsInChildren <TextMeshProUGUI>()[0].text = GlobalHelper.CapitalizeAllWords(ability.Name);

            instance.transform.GetComponentsInChildren <TextMeshProUGUI>()[1].text = ability.Description;
        }
    }
Пример #10
0
    public void showBackgroundPanel(CharacterBackground cb)
    {
        GameObject go = getRaceTextField(character.race);

        if (go != null)
        {
            if (cb != CharacterBackground.None)
            {
                toggleAllExcept(new GameObject[]  { go, backgroundTextFields[(int)cb] });
            }
            else
            {
                toggleAllExcept(go);
            }
        }
        else if (cb != CharacterBackground.None)
        {
            toggleAllExcept(backgroundTextFields[(int)cb]);
        }
    }
Пример #11
0
 public Character()
 {
     Class                         = new CharacterClass();
     Background                    = new CharacterBackground();
     Class.Equipment               = 0;
     Class.Skills                  = new int[4];
     Class.Skills[0]               = 0;
     Class.Skills[1]               = 0;
     Class.Skills[2]               = 0;
     Class.Skills[3]               = 0;
     Class.Type                    = 0;
     Background.Equipment          = 0;
     Background.LangOne            = (Language)(-1);
     Background.LangTwo            = (Language)(-1);
     Background.Rerolls            = 3;
     Background.Type               = 0;
     Background.Characteristics    = new int[4];
     Background.Characteristics[0] = 0;
     Background.Characteristics[1] = 0;
     Background.Characteristics[2] = 0;
     Background.Characteristics[3] = 0;
 }
Пример #12
0
    public void loadCharacter(string firstName, string lastName, CharacterSex mCSex, CharacterRace mCRace, int age,
                              CharacterBackground mCBackground, int height, int weight, CharacterClass mCClass,
                              int mCSturdy, int mCPerception, int mCTechnique, int mCWellVersed,
                              Color characterColor, Color headColor, Color primaryColor, Color secondaryColor, CharacterHairStyle hairStyle)
    {
        int heightRemainder = height % 12;

        height -= heightRemainder;

        personalInfo = new PersonalInformation(new CharacterName(firstName, lastName),
                                               mCSex, mCRace, mCBackground, new CharacterAge(age),
                                               new CharacterHeight(height, heightRemainder),
                                               new CharacterWeight(weight), hairStyle);
        characterProgress = new CharacterProgress(mCClass);
        abilityScores     = new AbilityScores(mCSturdy, mCPerception, mCTechnique, mCWellVersed);
        combatScores      = new CombatScores(abilityScores, personalInfo, characterProgress);
        skillScores       = new SkillScores(combatScores, characterProgress);
        CharacterColors characterColors = new CharacterColors(characterColor, headColor, primaryColor, secondaryColor);

        characterSheet = new CharacterSheet(abilityScores, personalInfo,
                                            characterProgress, combatScores, skillScores, characterColors, this, characterLoadout);
    }
Пример #13
0
    void InitializeDefaultBackgrounds()
    {
        var types = Enum.GetValues(typeof(BackgroundType));

        _defaultBackgrounds = new CharacterBackground[types.Length];

        foreach (BackgroundType type in types)
        {
            switch (type)
            {
            case BackgroundType.BackStreetBoy: {
                _defaultBackgrounds[(int)type] = new CharacterBackground()
                {
                    type      = BackgroundType.BackStreetBoy,
                    madness   = 0,
                    mentality = 120,
                    agility   = 120,
                    physical  = 70,
                    search    = 110,
                    luck      = 0
                };
            }
            break;

            case BackgroundType.Poet: {
                _defaultBackgrounds[(int)type] = new CharacterBackground()
                {
                    type      = BackgroundType.Poet,
                    madness   = 0,
                    mentality = 100,
                    agility   = 110,
                    physical  = 90,
                    search    = 85,
                    luck      = 20
                };
            }
            break;

            case BackgroundType.VeteranSoldier: {
                _defaultBackgrounds[(int)type] = new CharacterBackground()
                {
                    type      = BackgroundType.VeteranSoldier,
                    madness   = 0,
                    mentality = 90,
                    agility   = 90,
                    physical  = 160,
                    search    = 80,
                    luck      = 0
                };
            }
            break;

            case BackgroundType.Priest: {
                _defaultBackgrounds[(int)type] = new CharacterBackground()
                {
                    type      = BackgroundType.Priest,
                    madness   = 0,
                    mentality = 105,
                    agility   = 100,
                    physical  = 90,
                    search    = 100,
                    luck      = 5
                };
            }
            break;

            case BackgroundType.Professor: {
                _defaultBackgrounds[(int)type] = new CharacterBackground()
                {
                    type      = BackgroundType.Professor,
                    madness   = 20,
                    mentality = 150,
                    agility   = 70,
                    physical  = 85,
                    search    = 120,
                    luck      = 0
                };
            }
            break;

            case BackgroundType.Detective: {
                _defaultBackgrounds[(int)type] = new CharacterBackground()
                {
                    type      = BackgroundType.Detective,
                    madness   = 0,
                    mentality = 100,
                    agility   = 110,
                    physical  = 100,
                    search    = 150,
                    luck      = 0
                };
            }
            break;
            }
        }
    }
Пример #14
0
 public void selectBackground(Button b, CharacterBackground cb)
 {
     character.background = cb;
     selectBackgroundButton(b);
     showBackgroundPanel(cb);
 }
Пример #15
0
 public static List <AbilityTemplate> GetAbilitiesByBackground(CharacterBackground background)
 {
     return(new List <AbilityTemplate>(_abilitiesByBackground[background.Name]));
 }
    private RectTransform GetDetailFrame(CharacterBackground table, RectTransform frame)
    {
        if (table.name == "Parents")
        {
            frame = Parents;
        }
        else if (table.name == "Half-Elf Parents")
        {
            frame = ParentsHalfElf;
        }
        else if (table.name == "Half-Orc Parents")
        {
            frame = ParentsHalfOrc;
        }
        else if (table.name == "Tiefling Parents")
        {
            frame = ParentsTiefling;
        }
        else if (table.name == "Birthplace")
        {
            frame = Birthplace;
        }
        else if (table.name == "Siblings")
        {
            frame = Siblings;
        }
        else if (table.name == "Family")
        {
            frame = Family;
        }
        else if (table.name == "Family Other")
        {
            frame = OtherFamily;
        }
        else if (table.name == "Absent Parents")
        {
            frame = AbsentParents;
        }
        else if (table.name == "Absent Mother")
        {
            frame = AbsentMother;
        }
        else if (table.name == "Absent Father")
        {
            frame = AbsentFather;
        }
        else if (table.name == "Lifestyle")
        {
            frame = Lifestyle;
        }
        else if (table.name == "Home")
        {
            frame = Home;
        }
        else if (table.name == "Memories")
        {
            frame = Childhood;
        }
        else if (table.name == "Background")
        {
            frame = Background;
        }
        else if (table.name == "Class Training")
        {
            frame = Class;
        }

        return(frame);
    }
 void Awake() {
     my_text = GetComponentInChildren<Text>();
     my_text.text = display_char;
     background = GetComponentInChildren<CharacterBackground>();
     menu_controller = FindObjectOfType<MenuController>();
 }
Пример #18
0
    public string getCharacterString()
    {
        string characterStr = "";

        //********PERSONAL INFORMATION********\\
        //Adding player first name.
        characterStr += personalInfo.getCharacterName().firstName + delimiter;
        characterStr += personalInfo.getCharacterName().lastName + delimiter;
        CharacterSex sex = personalInfo.getCharacterSex();

        characterStr += (sex == CharacterSex.Male ? 0 : (sex == CharacterSex.Female ? 1 : 2)) + delimiter;
        RaceName race = personalInfo.getCharacterRace().raceName;

        characterStr += (race == RaceName.Berrind ? 0 : (race == RaceName.Ashpian ? 1 : 2)) + delimiter;
        CharacterBackground background = personalInfo.getCharacterBackground();

        characterStr += (background == CharacterBackground.FallenNoble || background == CharacterBackground.Commoner || background == CharacterBackground.Servant ? 0 : 1) + delimiter;
        characterStr += personalInfo.getCharacterAge().age + delimiter;
        characterStr += (personalInfo.getCharacterHeight().feet * 12 + personalInfo.getCharacterHeight().inches) + delimiter;
        characterStr += personalInfo.getCharacterWeight().weight + delimiter;
        ClassName clas = characterProgress.getCharacterClass().getClassName();

        characterStr += (clas == ClassName.ExSoldier ? 0 : (clas == ClassName.Engineer ? 1 : (clas == ClassName.Investigator ? 2 : (clas == ClassName.Researcher ? 3 : 4)))) + delimiter;
        characterStr += abilityScores.getSturdy() + delimiter;
        characterStr += abilityScores.getPerception(0) + delimiter;
        characterStr += abilityScores.getTechnique() + delimiter;
        characterStr += abilityScores.getWellVersed() + delimiter;
        foreach (int score in skillScores.scores)
        {
            characterStr += score + delimiter;
        }
        CharacterColors colors = characterSheet.characterColors;

        characterStr += colorString(colors.characterColor);
        characterStr += colorString(colors.headColor);
        characterStr += colorString(colors.primaryColor);
        characterStr += colorString(colors.secondaryColor);
        characterStr += characterSheet.personalInformation.getCharacterHairStyle().hairStyle + delimiter;
        characterStr += characterProgress.getCharacterLevel() + delimiter;
        characterStr += characterProgress.getCharacterExperience() + delimiter;
        //*********Hair*********\\
        characterStr += characterSheet.inventory.purse.money + delimiter;
        characterStr += characterSheet.combatScores.getCurrentHealth() + delimiter;
        characterStr += characterSheet.combatScores.getCurrentComposure() + delimiter;
        int[] features = characterSheet.characterProgress.getCharacterClass().chosenFeatures;
        characterStr += features.Length + delimiter;
        foreach (int feature in features)
        {
            characterStr += feature + delimiter;
        }
        characterStr += characterSheet.characterProgress.getWeaponFocusAsNumber() + delimiter;
        string inventoryString = "";
        int    inventorySize   = 0;

        foreach (InventoryItemSlot slot in characterSheet.inventory.inventory)
        {
            if (slot.item != null)
            {
                inventorySize++;
                inventoryString += slot.index + delimiter;
                inventoryString += (int)slot.item.getItemCode() + delimiter;
                inventoryString += slot.item.getItemData() + delimiter;
                if (slot.item.stackSize() > 0)
                {
                    foreach (Item i in slot.item.stack)
                    {
                        inventorySize++;
                        inventoryString += slot.index + delimiter;
                        inventoryString += (int)i.getItemCode() + delimiter;
                        inventoryString += i.getItemData() + delimiter;
                    }
                }
            }
        }
        foreach (InventorySlot slot in UnitGUI.armorSlots)
        {
            Item i = characterSheet.characterLoadout.getItemInSlot(slot);
            if (i != null)
            {
//				if (characterSheet.personalInformation.getCharacterName().firstName == "v") Debug.Log("GUI Slot: " + slot + "  " + (i is Weapon) + "   " + (i is Medicinal));
                inventorySize++;
                inventoryString += getArmorSlotIndex(slot) + delimiter;
                inventoryString += (int)i.getItemCode() + delimiter;
                inventoryString += i.getItemData() + delimiter;
            }
        }
        characterStr += inventorySize + delimiter + inventoryString;
        characterStr += characterSheet.characterProgress.getFavoredRaceAsNumber() + delimiter;
        return(characterStr);
    }
Пример #19
0
    public void loadCharacterFromTextFile(string fileName)
    {
        //	TextAsset text = Resources.Load<TextAsset>("Saves/" + fileName);
        //	string data = text.text;
        string data = Saves.getCharactersString(fileName);

        string[]            components     = data.Split(new char[] { ';' });
        int                 curr           = 0;
        string              firstName      = components[curr++];
        string              lastName       = components[curr++];
        int                 sex            = int.Parse(components[curr++]);
        CharacterSex        sexC           = (sex == 0 ? CharacterSex.Male : (sex == 1 ? CharacterSex.Female : CharacterSex.Other));
        int                 race           = int.Parse(components[curr++]);
        CharacterRace       raceC          = CharacterRace.getRace(race == 0 ? RaceName.Berrind : (race == 1 ? RaceName.Ashpian : RaceName.Rorrul));
        int                 background     = int.Parse(components[curr++]);
        CharacterBackground backgroundC    = (background == 0 ? (race == 0 ? CharacterBackground.FallenNoble : (race == 1 ? CharacterBackground.Commoner : CharacterBackground.Servant)) : (race == 0 ? CharacterBackground.WhiteGem : (race == 1 ? CharacterBackground.Immigrant : CharacterBackground.Unknown)));
        int                 age            = int.Parse(components[curr++]);
        int                 height         = int.Parse(components[curr++]);
        int                 weight         = int.Parse(components[curr++]);
        int                 class1         = int.Parse(components[curr++]);
        ClassName           className      = (class1 == 0 ? ClassName.ExSoldier : (class1 == 1 ? ClassName.Engineer : (class1 == 2 ? ClassName.Investigator : (class1 == 3 ? ClassName.Researcher : ClassName.Orator))));
        int                 sturdy         = int.Parse(components[curr++]);
        int                 perception     = int.Parse(components[curr++]);
        int                 technique      = int.Parse(components[curr++]);
        int                 wellVersed     = int.Parse(components[curr++]);
        int                 athletics      = int.Parse(components[curr++]);
        int                 melee          = int.Parse(components[curr++]);
        int                 ranged         = int.Parse(components[curr++]);
        int                 stealth        = int.Parse(components[curr++]);
        int                 mechanical     = int.Parse(components[curr++]);
        int                 medicinal      = int.Parse(components[curr++]);
        int                 historical     = int.Parse(components[curr++]);
        int                 political      = int.Parse(components[curr++]);
        Color               characterColor = new Color(int.Parse(components[curr++]) / 255.0f, int.Parse(components[curr++]) / 255.0f, int.Parse(components[curr++]) / 255.0f);

        Debug.Log(characterColor.r + " " + characterColor.g + " " + characterColor.b);
        Color headColor      = new Color(int.Parse(components[curr++]) / 255.0f, int.Parse(components[curr++]) / 255.0f, int.Parse(components[curr++]) / 255.0f);
        Color primaryColor   = new Color(int.Parse(components[curr++]) / 255.0f, int.Parse(components[curr++]) / 255.0f, int.Parse(components[curr++]) / 255.0f);
        Color secondaryColor = new Color(int.Parse(components[curr++]) / 255.0f, int.Parse(components[curr++]) / 255.0f, int.Parse(components[curr++]) / 255.0f);
        int   hairStyle      = 0;
        int   level          = 1;
        int   experience     = 0;

        if (curr < components.Length - 1)
        {
            hairStyle = int.Parse(components[curr++]);
        }
        if (curr < components.Length - 1)
        {
            level = int.Parse(components[curr++]);
        }
        if (curr < components.Length - 1)
        {
            experience = int.Parse(components[curr++]);
        }
        int money       = 0;
        int health      = 100000;
        int composure   = 100000;
        int numFeatures = 0;
        int numItems    = 0;
        int focus       = 0;

        if (curr < components.Length - 1)
        {
            money = int.Parse(components[curr++]);
        }
        if (curr < components.Length - 1)
        {
            health = int.Parse(components[curr++]);
        }
        if (curr < components.Length - 1)
        {
            composure = int.Parse(components[curr++]);
        }
        if (curr < components.Length - 1)
        {
            numFeatures = int.Parse(components[curr++]);
        }
        int[] features = new int[numFeatures];
        for (int n = 0; n < numFeatures; n++)
        {
            if (curr < components.Length - 1)
            {
                features[n] = int.Parse(components[curr++]);
            }
        }
        if (curr < components.Length - 1)
        {
            focus = int.Parse(components[curr++]);
        }
        if (curr < components.Length - 1)
        {
            numItems = int.Parse(components[curr++]);
        }
        personalInfo = new PersonalInformation(new CharacterName(firstName, lastName), sexC,
                                               raceC, backgroundC, new CharacterAge(age), new CharacterHeight(height),
                                               new CharacterWeight(weight), new CharacterHairStyle(hairStyle));
        characterProgress = new CharacterProgress(CharacterClass.getClass(className));
        abilityScores     = new AbilityScores(sturdy, perception, technique, wellVersed);
        combatScores      = new CombatScores(abilityScores, personalInfo, characterProgress);
        skillScores       = new SkillScores(combatScores, characterProgress);
        CharacterColors characterColors = new CharacterColors(characterColor, headColor, primaryColor, secondaryColor);

        characterSheet = new CharacterSheet(abilityScores, personalInfo, characterProgress, combatScores, skillScores, characterColors, this, characterLoadout);
        skillScores.incrementScore(Skill.Athletics, athletics);
        skillScores.incrementScore(Skill.Melee, melee);
        skillScores.incrementScore(Skill.Ranged, ranged);
        skillScores.incrementScore(Skill.Stealth, stealth);
        skillScores.incrementScore(Skill.Mechanical, mechanical);
        skillScores.incrementScore(Skill.Medicinal, medicinal);
        skillScores.incrementScore(Skill.Historical, historical);
        skillScores.incrementScore(Skill.Political, political);
        characterProgress.setLevel(level);
        characterProgress.setExperience(experience);
        characterSheet.inventory.purse.receiveMoney(money);
        combatScores.setHealth(health);
        combatScores.setComposure(composure);
        characterProgress.getCharacterClass().chosenFeatures = features;
        characterProgress.setWeaponFocus(focus);
        Inventory inv = characterSheet.inventory;

        for (int n = 0; n < numItems; n++)
        {
            int      slot     = int.Parse(components[curr++]);
            ItemCode code     = (ItemCode)int.Parse(components[curr++]);
            string   itemData = components[curr++];
            Item     i        = Item.deserializeItem(code, itemData);
            if (slot < 100)
            {
                if (inv.inventory[slot].item != null)
                {
                    if (inv.itemCanStackWith(inv.inventory[slot].item, i))
                    {
                        inv.inventory[slot].item.addToStack(i);
                    }
                }
                else if (inv.canInsertItemInSlot(i, Inventory.getSlotForIndex(slot)))
                {
                    inv.insertItemInSlot(i, Inventory.getSlotForIndex(slot));
                }
            }
            else
            {
                characterSheet.characterLoadout.setItemInSlot(getArmorSlot(slot), i);
            }
            //Inventory stuff
        }
        //Right Weapon = 100;
        //Left Weapon = 110;
        //Head = 120;
        //Shoulder = 130;
        //Chest = 140;
        //Legs = 150;
        //Boots = 160;
        //Gloves = 170;
        if (curr < components.Length - 1)
        {
            characterProgress.setFavoredRace(int.Parse(components[curr++]));
        }
    }