akadoc/Assets/src/Player.cs

44 lines
948 B
C#
Raw Normal View History

2015-03-04 16:09:45 +00:00
using UnityEngine;
using System.Collections;
2015-03-05 15:09:35 +00:00
public class Player : MonoBehaviour {
2015-03-04 16:09:45 +00:00
2015-03-04 16:41:51 +00:00
public Player(int _charID, int _roleID){
2015-03-05 15:09:35 +00:00
SetCharacter(_charID);
SetRole(_roleID);
}
public void DebugInfo() {
Debug.Log(charname+" is a "+GetRoleName()+" with "+hp.ToString()+" hit points");
}
void SetCharacter(int _charID){
2015-03-04 16:09:45 +00:00
charID = _charID;
var ct = Rdb.GetTable("characters");
charname = ct.GetValue<string>(charID, "name");
spellID = ct.GetValue<int>(charID, "spell");
hp = ct.GetValue<int>(charID, "hp");
2015-03-05 15:09:35 +00:00
}
void SetRole(int _roleID){
roleID = _roleID;
2015-03-04 16:09:45 +00:00
var rt = Rdb.GetTable("roles");
2015-03-05 15:09:35 +00:00
rolename_strref = rt.GetValue<int>(roleID, "name_strref");
2015-03-04 16:09:45 +00:00
ultiID = rt.GetValue<int>(roleID, "ulti");
align = rt.GetValue<string>(roleID, "alignment");
}
2015-03-04 16:41:51 +00:00
public int charID;
public string charname;
public int spellID;
public int hp;
2015-03-05 15:09:35 +00:00
public int roleID;
public int rolename_strref;
2015-03-04 16:41:51 +00:00
public int ultiID;
public string align;
2015-03-04 16:09:45 +00:00
}