Player class impr

This commit is contained in:
Crom (Thibaut CHARLES) 2015-03-05 16:09:35 +01:00
parent ee5b086c87
commit 366994d156
2 changed files with 21 additions and 19 deletions

View File

@ -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<string>(charID, "name");
spellID = ct.GetValue<int>(charID, "spell");
hp = ct.GetValue<int>(charID, "hp");
}
void SetRole(int _roleID){
roleID = _roleID;
var rt = Rdb.GetTable("roles");
rolename = rt.GetValue<string>(roleID, "name");
rolename_strref = rt.GetValue<int>(roleID, "name_strref");
ultiID = rt.GetValue<int>(roleID, "ulti");
align = rt.GetValue<string>(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;
}

View File

@ -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<string>(strref, "text");
return Get().m_strref.GetValue<string>(strref, "text");
}