Пример #1
0
 static void ValidateCompatibility(RagdollProfile profile, RagdollDefinition definition)
 {
     if (!profile.IsCompatibleWith(definition))
     {
         throw new IncompatibleRagdollProfileException(profile, definition);
     }
 }
Пример #2
0
        public static bool Validate(RagdollDefinition definition, bool doGUI)
        {
            SerializedObject   serializedObject = new SerializedObject(definition);
            SerializedProperty boneList         = serializedObject.FindProperty("bones");
            SerializedProperty rootProperty     = serializedObject.FindProperty("_root");

            return(ValidateNotEmpty(boneList, doGUI) &&
                   ValidateThereIsARoot(rootProperty, boneList, doGUI) &&
                   ValidateNoEmptyNames(boneList, doGUI) &&
                   ValidateNoDuplicateNames(boneList, doGUI));
        }
Пример #3
0
 public static void ValidateAsInspectorField(RagdollProfile profile, RagdollDefinition definition, bool isRequired, string nullMessage = "")
 {
     if (!profile)
     {
         if (isRequired && Application.isPlaying)
         {
             throw new UnassignedReferenceException(nullMessage);
         }
     }
     else
     {
         ValidateCompatibility(profile, definition);
     }
 }
Пример #4
0
 public static void ValidateAsArgument(RagdollProfile profile, RagdollDefinition definition, bool isRequired, string nullMessage = "")
 {
     if (!profile)
     {
         if (isRequired && Application.isPlaying)
         {
             throw new System.ArgumentNullException(nullMessage);
         }
     }
     else
     {
         ValidateCompatibility(profile, definition);
     }
 }
        public IncompatibleRagdollProfileException(RagdollProfile profile, RagdollDefinition definition)
        {
            if (profile)
            {
                this.profile = profile.name;
            }
            else
            {
                this.profile = "null";
            }

            if (definition)
            {
                this.definition = definition.name;
            }
            else
            {
                this.definition = "null";
            }
        }
Пример #6
0
        public virtual bool IsCompatibleWith(RagdollDefinition otherDefinition)
        {
            ThrowExceptionIfNotValid();

            return(definition == otherDefinition);
        }