public Monster(MonsterData data) { name = data.name; // Get or load a texture texture = GameManager.GetInstance().GetTexture(data.image); if (texture == null) texture = GameManager.GetInstance().LoadTexture(data.image); attributes.agility = data.attribs.agility; attributes.speed = data.attribs.speed; attributes.strength = data.attribs.strength; attributes.constitution = data.attribs.constitution; attributes.endurance = data.attribs.endurance; stats.Initialize(data.level, attributes); }
// --------------- Data Records From Hash Functions ---------------- // protected static MonsterData MonsterDataFromHash(Hashtable data) { MonsterData mon = new MonsterData(); mon.name = (string)data["name"]; mon.image = (string)data["image"]; mon.level = Convert.ToInt32(data["lvl"]); mon.attribs.agility = Convert.ToInt32(data["agility"]); mon.attribs.constitution = Convert.ToInt32(data["constitution"]); mon.attribs.endurance = Convert.ToInt32(data["endurance"]); mon.attribs.intelligence = Convert.ToInt32(data["intelligence"]); mon.attribs.speed = Convert.ToInt32(data["speed"]); mon.attribs.strength = Convert.ToInt32(data["strength"]); return mon; }
public Monster(MonsterData data, Vector2 startPos) : this(data) { pos = startPos; displayPos = pos; }