static void ValidateCompatibility(RagdollProfile profile, RagdollDefinition definition) { if (!profile.IsCompatibleWith(definition)) { throw new IncompatibleRagdollProfileException(profile, definition); } }
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)); }
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); } }
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"; } }
public virtual bool IsCompatibleWith(RagdollDefinition otherDefinition) { ThrowExceptionIfNotValid(); return(definition == otherDefinition); }