Example #1
0
        BodyPart LoadBodyPart(XElement partNode)
        {
            //Set any flags attached to this body part
            var flags = new BodyPartFlags();

            if (partNode.Attribute("lifeCritical") != null)
            {
                flags |= BodyPartFlags.LifeCritical;
            }
            if (partNode.Attribute("canPickUp") != null)
            {
                flags |= BodyPartFlags.CanPickUpItem;
            }
            if (partNode.Attribute("missingno") != null)
            {
                flags |= BodyPartFlags.LifeCritical;
            }

            return(new BodyPart(
                       partNode.Attribute("name").Value,
                       int.Parse(partNode.Attribute("health").Value),
                       flags,
                       null
                       ));
        }
Example #2
0
 /// <summary>
 /// Constructor.
 /// </summary>
 /// <param name="name">What to call this body part.</param>
 /// <param name="health">How much damage this part can take. TODO: Percent based?</param>
 /// <param name="flags">The optional bit properties of this body part.</param>
 /// <param name="parent">Fingers connected to the hand, hand connected to the forearm, etc.</param>
 public BodyPart(string name, int health, BodyPartFlags flags, BodyPart parent = null)
 {
     Name          = name;
     CurrentHealth = MaxHealth = health;
     Flags         = flags;
     this.parent   = parent;
 }
Example #3
0
 public BodyPartData(System.IO.BinaryReader reader)
 {
     part     = (BodyPartPiece)reader.ReadByte();
     skinType = (SkinType)reader.ReadByte();
     flags    = (BodyPartFlags)reader.ReadByte();
     partType = (BodyPartType)reader.ReadByte();
 }
        BodyPart LoadBodyPart(XElement partNode)
        {
            //Set any flags attached to this body part
            var flags = new BodyPartFlags();
            if (partNode.Attribute("lifeCritical") != null)
                flags |= BodyPartFlags.LifeCritical;
            if (partNode.Attribute("canPickUp") != null)
                flags |= BodyPartFlags.CanPickUpItem;
            if (partNode.Attribute("missingno") != null)
                flags |= BodyPartFlags.LifeCritical;

            return new BodyPart(
                partNode.Attribute("name").Value,
                int.Parse(partNode.Attribute("health").Value),
                flags,
                null
            );
        }