Esempio n. 1
0
        /// <summary>
        /// Loads
        /// </summary>
        /// <param name="node">XmlNode handle</param>
        public virtual bool Load(XmlNode node)
        {
            if (node == null)
            {
                return(false);
            }


            if (node.NodeType == XmlNodeType.Comment)
            {
                return(false);
            }

            switch (node.Name.ToLower())
            {
            case "strength":
            {
                Strength.Load(node);
            }
            break;

            case "intelligence":
            {
                Intelligence.Load(node);
            }
            break;

            case "wisdom":
            {
                Wisdom.Load(node);
            }
            break;

            case "dexterity":
            {
                Dexterity.Load(node);
            }
            break;

            case "constitution":
            {
                Constitution.Load(node);
            }
            break;

            case "charisma":
            {
                Charisma.Load(node);
            }
            break;

            case "alignment":
            {
                Alignment = (EntityAlignment)Enum.Parse(typeof(EntityAlignment), node.Attributes["value"].Value, true);
            }
            break;

            case "hitpoint":
            {
                HitPoint.Load(node);
            }
            break;

            case "movespeed":
            {
                MoveSpeed = TimeSpan.FromMilliseconds(int.Parse(node.Attributes["value"].Value));
            }
            break;

            default:
            {
                Trace.WriteLine("[Entity] Load() : Unknown node : <{0}>", node.Name);
            }
            break;
            }


            return(true);
        }