Beispiel #1
0
    public void Init(HexGrid pGrid, CharacterSpecies pSpecie, Type pType)
    {
        this.grid   = pGrid;
        this.specie = pSpecie;
        this.type   = pType;

        units            = new List <Unit>();
        currentUnitIndex = 0;
    }
Beispiel #2
0
        public virtual void SaveXML(XmlDocument doc)
        {
            var character = doc.CreateElement("Character");

            doc.AppendChild(character);
            var child = character.OwnerDocument.CreateElement("Age");

            child.AppendChild(child.OwnerDocument.CreateTextNode(Age.ToString()));
            character.AppendChild(child);
            child = character.OwnerDocument.CreateElement("Culture");
            child.AppendChild(child.OwnerDocument.CreateTextNode(Culture.ToString()));
            character.AppendChild(child);
            child = character.OwnerDocument.CreateElement("Name");
            child.AppendChild(child.OwnerDocument.CreateTextNode(Name));
            character.AppendChild(child);
            child = character.OwnerDocument.CreateElement("Sex");
            child.AppendChild(child.OwnerDocument.CreateTextNode(Sex));
            character.AppendChild(child);
            child = character.OwnerDocument.CreateElement("Species");
            child.AppendChild(child.OwnerDocument.CreateTextNode(CharacterSpecies.ToString()));
            character.AppendChild(child);
            child = character.OwnerDocument.CreateElement("System");
            child.AppendChild(child.OwnerDocument.CreateTextNode(Style.ToString()));
            character.AppendChild(child);
            var journal = character.OwnerDocument.CreateElement("Journal");

            foreach (var item in Journal)
            {
                child = character.OwnerDocument.CreateElement("JournalItem");
                child.AppendChild(child.OwnerDocument.CreateTextNode(item));
                journal.AppendChild(child);
            }
            character.AppendChild(journal);
            // Now save the child collections
            // Attributes
            var attribs = character.OwnerDocument.CreateElement("Attributes");

            Profile.SaveXML(attribs);
            character.AppendChild(attribs);
            // Skills
            var skills = character.OwnerDocument.CreateElement("Skills");

            foreach (var skill in Skills.Values)
            {
                skill.SaveXML(skills);
            }
            character.AppendChild(skills);
            // Careers
            var careers = character.OwnerDocument.CreateElement("Careers");

            foreach (var career in Careers)
            {
                career.SaveXML(careers);
            }
            character.AppendChild(careers);
            // Benefits
            var benefits = character.OwnerDocument.CreateElement("Benefits");

            foreach (var benefit in Benefits.Values)
            {
                benefit.SaveXML(benefits);
            }
            character.AppendChild(benefits);
        }