Unity-jump-proj
This commit is contained in:
@ -0,0 +1,8 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 7fefc1732dfc34349a75daedca973c10
|
||||
folderAsset: yes
|
||||
DefaultImporter:
|
||||
externalObjects: {}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
@ -0,0 +1,45 @@
|
||||
using UnityEditor;
|
||||
using UnityEngine;
|
||||
|
||||
namespace Timeline.Samples
|
||||
{
|
||||
// Custom property drawer that draws all child properties inline
|
||||
[CustomPropertyDrawer(typeof(NoFoldOutAttribute))]
|
||||
public class NoFoldOutPropertyDrawer : PropertyDrawer
|
||||
{
|
||||
public override float GetPropertyHeight(SerializedProperty property, GUIContent label)
|
||||
{
|
||||
if (!property.hasChildren)
|
||||
return base.GetPropertyHeight(property, label);
|
||||
property.isExpanded = true;
|
||||
return EditorGUI.GetPropertyHeight(property, label, true) -
|
||||
EditorGUI.GetPropertyHeight(property, label, false);
|
||||
}
|
||||
|
||||
public override void OnGUI(Rect position, SerializedProperty property, GUIContent label)
|
||||
{
|
||||
if (!property.hasChildren)
|
||||
EditorGUI.PropertyField(position, property, label);
|
||||
else
|
||||
{
|
||||
SerializedProperty iter = property.Copy();
|
||||
var nextSibling = property.Copy();
|
||||
nextSibling.Next(false);
|
||||
property.Next(true);
|
||||
do
|
||||
{
|
||||
// We need to check against nextSibling to properly stop
|
||||
// otherwise we will draw properties that are not child of this
|
||||
// foldout.
|
||||
if (SerializedProperty.EqualContents(property, nextSibling))
|
||||
break;
|
||||
float height = EditorGUI.GetPropertyHeight(property, property.hasVisibleChildren);
|
||||
position.height = height;
|
||||
EditorGUI.PropertyField(position, property, property.hasVisibleChildren);
|
||||
position.y = position.y + height;
|
||||
}
|
||||
while (property.NextVisible(false));
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
@ -0,0 +1,11 @@
|
||||
fileFormatVersion: 2
|
||||
guid: fa71063a2265c0f46a8c2473f8ca8e40
|
||||
MonoImporter:
|
||||
externalObjects: {}
|
||||
serializedVersion: 2
|
||||
defaultReferences: []
|
||||
executionOrder: 0
|
||||
icon: {instanceID: 0}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
@ -0,0 +1,17 @@
|
||||
{
|
||||
"name": "Timeline.Samples.Utilities.Editor",
|
||||
"references": [
|
||||
"GUID:ef63a73cb159aa04997399c27d4eb08a"
|
||||
],
|
||||
"includePlatforms": [
|
||||
"Editor"
|
||||
],
|
||||
"excludePlatforms": [],
|
||||
"allowUnsafeCode": false,
|
||||
"overrideReferences": false,
|
||||
"precompiledReferences": [],
|
||||
"autoReferenced": true,
|
||||
"defineConstraints": [],
|
||||
"versionDefines": [],
|
||||
"noEngineReferences": false
|
||||
}
|
@ -0,0 +1,7 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 6a967aa03bf014540b1c53a0617cea1d
|
||||
AssemblyDefinitionImporter:
|
||||
externalObjects: {}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
@ -0,0 +1,9 @@
|
||||
using UnityEngine;
|
||||
|
||||
namespace Timeline.Samples
|
||||
{
|
||||
// Helper attribute that removes the fold out and draws all child properties inline.
|
||||
public class NoFoldOutAttribute : PropertyAttribute
|
||||
{
|
||||
}
|
||||
}
|
@ -0,0 +1,11 @@
|
||||
fileFormatVersion: 2
|
||||
guid: a4464438bd2269f4aac5fab4a71463e1
|
||||
MonoImporter:
|
||||
externalObjects: {}
|
||||
serializedVersion: 2
|
||||
defaultReferences: []
|
||||
executionOrder: 0
|
||||
icon: {instanceID: 0}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
@ -0,0 +1,39 @@
|
||||
using UnityEngine;
|
||||
|
||||
namespace Timeline.Samples
|
||||
{
|
||||
public static class QuaternionUtils
|
||||
{
|
||||
const float k_FloatMin = 1e-10f;
|
||||
|
||||
public static readonly Quaternion zero = new Quaternion(0f, 0f, 0f, 0f);
|
||||
|
||||
public static Quaternion Scale(this Quaternion q, float scale)
|
||||
{
|
||||
return new Quaternion(q.x * scale, q.y * scale, q.z * scale, q.w * scale);
|
||||
}
|
||||
|
||||
public static Quaternion NormalizeSafe(this Quaternion q)
|
||||
{
|
||||
float dot = Quaternion.Dot(q, q);
|
||||
if (dot > k_FloatMin)
|
||||
{
|
||||
float rsqrt = 1.0f / Mathf.Sqrt(dot);
|
||||
return new Quaternion(q.x * rsqrt, q.y * rsqrt, q.z * rsqrt, q.w * rsqrt);
|
||||
}
|
||||
|
||||
return Quaternion.identity;
|
||||
}
|
||||
|
||||
public static Quaternion Blend(this Quaternion q1, Quaternion q2, float weight)
|
||||
{
|
||||
return q1.Add(q2.Scale(weight));
|
||||
}
|
||||
|
||||
public static Quaternion Add(this Quaternion rhs, Quaternion lhs)
|
||||
{
|
||||
float sign = Mathf.Sign(Quaternion.Dot(rhs, lhs));
|
||||
return new Quaternion(rhs.x + sign * lhs.x, rhs.y + sign * lhs.y, rhs.z + sign * lhs.z, rhs.w + sign * lhs.w);
|
||||
}
|
||||
}
|
||||
}
|
@ -0,0 +1,11 @@
|
||||
fileFormatVersion: 2
|
||||
guid: dc3278264906016459457b6aa9b1b1bd
|
||||
MonoImporter:
|
||||
externalObjects: {}
|
||||
serializedVersion: 2
|
||||
defaultReferences: []
|
||||
executionOrder: 0
|
||||
icon: {instanceID: 0}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
@ -0,0 +1,13 @@
|
||||
{
|
||||
"name": "Timeline.Samples.Utilities",
|
||||
"references": [],
|
||||
"includePlatforms": [],
|
||||
"excludePlatforms": [],
|
||||
"allowUnsafeCode": false,
|
||||
"overrideReferences": false,
|
||||
"precompiledReferences": [],
|
||||
"autoReferenced": true,
|
||||
"defineConstraints": [],
|
||||
"versionDefines": [],
|
||||
"noEngineReferences": false
|
||||
}
|
@ -0,0 +1,7 @@
|
||||
fileFormatVersion: 2
|
||||
guid: ef63a73cb159aa04997399c27d4eb08a
|
||||
AssemblyDefinitionImporter:
|
||||
externalObjects: {}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
Reference in New Issue
Block a user