diff --git a/Assets/src/Player.cs b/Assets/src/Player.cs index bf4d28e..125b00d 100644 --- a/Assets/src/Player.cs +++ b/Assets/src/Player.cs @@ -1,39 +1,43 @@ using UnityEngine; using System.Collections; -public class Player { +public class Player : MonoBehaviour { public Player(int _charID, int _roleID){ + SetCharacter(_charID); + SetRole(_roleID); + } + + + public void DebugInfo() { + Debug.Log(charname+" is a "+GetRoleName()+" with "+hp.ToString()+" hit points"); + } + + void SetCharacter(int _charID){ charID = _charID; - roleID = _roleID; var ct = Rdb.GetTable("characters"); charname = ct.GetValue(charID, "name"); spellID = ct.GetValue(charID, "spell"); hp = ct.GetValue(charID, "hp"); + } + + void SetRole(int _roleID){ + roleID = _roleID; var rt = Rdb.GetTable("roles"); - rolename = rt.GetValue(roleID, "name"); + rolename_strref = rt.GetValue(roleID, "name_strref"); ultiID = rt.GetValue(roleID, "ulti"); align = rt.GetValue(roleID, "alignment"); } - - - - public void DebugInfo() { - Debug.Log(charname+" is a "+rolename+" with "+hp.ToString()+" hit points"); - } - - - public int charID; - public int roleID; - public string charname; public int spellID; public int hp; - public string rolename; + + public int roleID; + public int rolename_strref; public int ultiID; public string align; } diff --git a/Assets/src/RulesDatabase.cs b/Assets/src/RulesDatabase.cs index 027125c..e2d5f47 100644 --- a/Assets/src/RulesDatabase.cs +++ b/Assets/src/RulesDatabase.cs @@ -15,13 +15,11 @@ public class Rdb { } public static void SetLocale(string lang) { - m_inst.m_strref = GetTable("locale_"+lang); + Get().m_strref = GetTable("locale_"+lang); } public static string GetStrRef(int strref) { - Rdb inst = Get(); - - return inst.m_strref.GetValue(strref, "text"); + return Get().m_strref.GetValue(strref, "text"); }