Пример #1
0
    public OSRICAttributeModel(RPGCharacterModel _cm, JSONObject _jo)
    {
        cm = _cm;
        CharacterModifiers = new OSRICModifierCollection();
        characterName = _jo["characterName"].str;
        Str = (int)_jo["Str"].n;
        Dex = (int)_jo["Dex"].n;
        Con = (int)_jo["Con"].n;
        Int = (int)_jo["Int"].n;
        Wis = (int)_jo["Wis"].n;
        Cha = (int)_jo["Cha"].n;
        hitPoints = (int)_jo["hitPoints"].n;

        string[] levelStr = _jo["level"].str.Split('/');
        level = new int[levelStr.Length];

        for(int i=0; i<levelStr.Length; i++)
            level[i] = Int32.Parse(levelStr[i]);

        experiencePoints = (int)_jo["experiencePoints"].n;
        vision = (int)_jo["vision"].n;
        move = (int)_jo["move"].n;
        characterGender = OSRICConstants.GetEnum<OSRIC_GENDER>(_jo["characterGender"].str);
        characterRace = OSRICConstants.GetEnum<OSRIC_RACE>(_jo["characterRace"].str);
        characterClass = OSRICConstants.GetEnum<OSRIC_CLASS>(_jo["characterClass"].str);
        characterAlignment = OSRICConstants.GetEnum<OSRIC_ALIGNMENT>(_jo["characterAlignment"].str);
        characterState = OSRICConstants.GetEnum<OSRIC_CHARACTER_STATE>(_jo["characterState"].str);
        foreach(JSONObject obj in _jo["CharacterModifiers"].list)
            CharacterModifiers.Add(new OSRICCharacterModifier(obj));
    }
Пример #2
0
    public void UpdateCharacterOptions(CharacterOptionCollection coc)
    {
        //OSRICEngine.RemoveRaceAdjustments(this);//if we really need to call function on the engine from here we're probably in trouble and need to rethink a few things
        this.ClearRacialModifiers();//this works now without engine call like above
        characterName = coc.charName;
        characterRace = coc.charRace;
        OSRICEngine.AddRaceAdjustments(this,characterRace);
        characterAlignment = coc.charAlignment;
        characterGender = coc.charGender;
        characterClass = coc.charClass;

        string strout = "Current Modifiers: ";
        foreach(OSRICCharacterModifier ocm in CharacterModifiers.ModifierList)
        {
            strout += ocm.attribute.GetDesc() + " | ";
        }
        //		Debug.Log(strout);

        BroadcastRacialAttributeDidChange();
        BroadcastAttributeModelDidChange ();
    }