public override bool IsAssignableFrom(PLanguageType otherType) { // if this type is "any", then it's always good. Otherwise, the types have to match exactly. switch (CanonicalRepresentation) { case "any": return(true); case "machine": return(otherType.CanonicalRepresentation.Equals("machine") || otherType.CanonicalRepresentation.Equals("null") || otherType is PermissionType); case "int": return(otherType.CanonicalRepresentation.Equals("int")); case "string": return(otherType.CanonicalRepresentation.Equals("string")); case "event": return(otherType.CanonicalRepresentation.Equals("event") || otherType.CanonicalRepresentation.Equals("null")); default: return(CanonicalRepresentation.Equals(otherType.CanonicalRepresentation)); } }
public static void CreateBoneMapping() { string name = "New"; BoneMapAsset bm = ScriptableObject.CreateInstance <BoneMapAsset>(); //SkeletonConfiguration cpp = Selection.activeGameObject.transform.GetComponent<SkeletonConfiguration>(); Transform root = Selection.activeGameObject.transform; //if (cpp == null) cpp = Selection.activeGameObject.transform.GetComponentInChildren<SkeletonConfiguration>(); //if (cpp == null) cpp = Selection.activeGameObject.transform.GetComponentInParent<SkeletonConfiguration>(); //if (cpp != null) { name = root.name; Transform[] bones = CanonicalRepresentation.Bones(root); //if (cpp.rootBone != null) // bones = CanonicalRepresentation.Bones(cpp.rootBone); //else bones = CanonicalRepresentation.Bones(cpp.transform); bones = CanonicalRepresentation.Bones(root); bm.mappings = new BoneMapAsset.HAnimBoneMapping[bones.Length]; for (int t = 0; t < bones.Length; t++) { bm.mappings[t].src_bone = bones[t].name; bm.mappings[t].hanim_bone = CanonicalRepresentation.HAnimBones.NONE; } //} else { // Debug.LogError("Failed to create a BoneMap. Select a SkeletonConfiguration in the hierarchy panel."); //} AssetDatabase.CreateAsset(bm, "Assets/" + name + "BoneMapping.asset"); AssetDatabase.SaveAssets(); EditorUtility.FocusProjectWindow(); Selection.activeObject = bm; }
public override int GetHashCode() { return(CanonicalRepresentation.GetHashCode()); }