Пример #1
0
 private void treat_limb(BodySection section)
 {
     if (section.Status == Game.BodySectionStatus.Missing)
     {
         bodySectionProperty.SetValue(section, Game.BodySectionStatus.Destroyed);
         bodyPartProperty.SetValue(section.BodyPart, Game.BodyPartStatus.Disabled);
     }
     section.RepairDestroyedBodySection();
     bodySectionProperty.SetValue(section, Game.BodySectionStatus.Good);
     bodyPartProperty.SetValue(section.BodyPart, Game.BodyPartStatus.Good);
 }
Пример #2
0
        private void treat_limb(BodySection section)
        {
            System.Reflection.FieldInfo bodyPartProperty = typeof(BodyPart)
                                                           .GetFields(System.Reflection.BindingFlags.Instance | System.Reflection.BindingFlags.NonPublic)
                                                           .Where(field => (field.FieldType == typeof(Game.BodyPartStatus)))
                                                           .Single();
            System.Reflection.FieldInfo bodySectionProperty = typeof(BodySection)
                                                              .GetFields(System.Reflection.BindingFlags.Instance | System.Reflection.BindingFlags.NonPublic)
                                                              .Where(field => (field.FieldType == typeof(Game.BodySectionStatus)))
                                                              .Single();

            if (section.Status == Game.BodySectionStatus.Missing)
            {
                bodySectionProperty.SetValue(section, Game.BodySectionStatus.Destroyed);
                bodyPartProperty.SetValue(section.BodyPart, Game.BodyPartStatus.Disabled);
            }
            section.RepairDestroyedBodySection();
            bodySectionProperty.SetValue(section, Game.BodySectionStatus.Good);
            bodyPartProperty.SetValue(section.BodyPart, Game.BodyPartStatus.Good);
        }