public CharacterOptionCollection GetCharacterOptionsFromDrops() { CharacterOptionCollection retCol = new CharacterOptionCollection(); retCol.charName = characterNameText.text; try { retCol.charGender = OSRICConstants.GetEnum<OSRIC_GENDER>(genderDrop.options[genderDrop.value].text); } catch(Exception e) { Debug.Log(e.ToString()); } // Debug.Log("options from drop: " + raceDrop.value); try { retCol.charRace = OSRICConstants.GetEnum<OSRIC_RACE>(raceDrop.options[raceDrop.value].text); } catch(Exception e) { Debug.Log(e.ToString()); } // Debug.Log("option from class drop: " + classDrop.value); try { if(classDrop.options.Contains(classDrop.options[classDrop.value])) // THIS CALL IS THROWING AN EXCEPTION retCol.charClass = OSRICConstants.GetEnum<OSRIC_CLASS>(classDrop.options[classDrop.value].text); else retCol.charClass = OSRIC_CLASS.None; } catch(Exception e) { Debug.Log(e.ToString()); } try { retCol.charAlignment = OSRICConstants.GetEnum<OSRIC_ALIGNMENT>(alignmentDrop.options[alignmentDrop.value].text); } catch(Exception e) { Debug.Log(e.ToString()); } return retCol; }
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 (); }
public bool VerifyOptionCollection(CharacterOptionCollection coc) { HashSet<OSRIC_CLASS> retSet = new HashSet<OSRIC_CLASS> (); bool available; foreach (OSRIC_CLASS oc in Enum.GetValues(typeof(OSRIC_CLASS))) { if (oc == OSRIC_CLASS.None) { retSet.Add (oc); continue; } available = raceClassMatrix.GetValue (coc.charRace.GetDesc(), raceClassMatrix.GetYIndexOf (oc.GetDesc ())); if (available) retSet.Add (oc); } if (retSet.Contains (coc.charClass)) return true; return false; }