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

            return(definition == otherDefinition);
        }