akadoc/Assets/src/Player.cs

51 lines
1.0 KiB
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);
}
2015-03-06 11:37:52 +00:00
void Awake(){
//Debug
SetCharacter(charID);
SetRole(roleID);
Game.Get().SetMainPlayer(this);
}
2015-03-05 15:09:35 +00:00
public void DebugInfo() {
2015-03-05 15:13:25 +00:00
Debug.Log(charname+" is a "+Rdb.GetStrRef(rolename_strref)+" with "+hp.ToString()+" hit points");
2015-03-05 15:09:35 +00:00
}
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
}