using System; using System.Xml; namespace TeslaConsole.BattleTech; /// /// A BattleTech pilot role. Each participant references one role /// (role=Role::<Key>); the egg then carries a matching /// [Role::<Key>] model=<Model> block. Free For All uses the /// Default role, No Return uses the NoReturn role. Serializable because it is /// reachable from a saved via the mission's /// players (mirrors the .rpm save mechanism). /// [Serializable] public class BTRole { private readonly string mKey; private readonly string mModel; private readonly string mName; public string Key => mKey; public string Model => mModel; public string Name => mName; internal BTRole(XmlNode roleNode) { mKey = roleNode.Attributes["key"].InnerText; mModel = roleNode.Attributes["model"].InnerText; XmlAttribute xmlAttribute = roleNode.Attributes["name"]; mName = ((xmlAttribute != null) ? xmlAttribute.InnerText : mKey); } public BTRole(string key, string model, string name) { mKey = key; mModel = model; mName = name; } public override string ToString() { return mName; } }