蓝色星空 пре 1 година
родитељ
комит
39c98126cf
100 измењених фајлова са 5817 додато и 6203 уклоњено
  1. 11 0
      .gitignore
  2. 0 26
      Assembly-CSharp-Editor-firstpass.csproj
  3. 0 26
      Assembly-CSharp-Editor.csproj
  4. 0 26
      Assembly-CSharp-firstpass.csproj
  5. 0 26
      Assembly-CSharp.csproj
  6. 1901 1901
      Assets/DefaultPlayables/Editor/TimelinePlayableWizard.cs
  7. 12 12
      Assets/DefaultPlayables/Editor/TimelinePlayableWizard.cs.meta
  8. 33 33
      Assets/DefaultPlayables/LightControl/Editor/LightControlDrawer.cs
  9. 12 12
      Assets/DefaultPlayables/LightControl/Editor/LightControlDrawer.cs.meta
  10. 13 13
      Assets/DefaultPlayables/LightControl/LightControlBehaviour.cs
  11. 12 12
      Assets/DefaultPlayables/LightControl/LightControlBehaviour.cs.meta
  12. 20 20
      Assets/DefaultPlayables/LightControl/LightControlClip.cs
  13. 12 12
      Assets/DefaultPlayables/LightControl/LightControlClip.cs.meta
  14. 81 81
      Assets/DefaultPlayables/LightControl/LightControlMixerBehaviour.cs
  15. 12 12
      Assets/DefaultPlayables/LightControl/LightControlMixerBehaviour.cs.meta
  16. 29 29
      Assets/DefaultPlayables/LightControl/LightControlTrack.cs
  17. 12 12
      Assets/DefaultPlayables/LightControl/LightControlTrack.cs.meta
  18. 16 16
      Assets/DefaultPlayables/NavMeshAgentControl/NavMeshAgentControlBehaviour.cs
  19. 12 12
      Assets/DefaultPlayables/NavMeshAgentControl/NavMeshAgentControlBehaviour.cs.meta
  20. 25 25
      Assets/DefaultPlayables/NavMeshAgentControl/NavMeshAgentControlClip.cs
  21. 12 12
      Assets/DefaultPlayables/NavMeshAgentControl/NavMeshAgentControlClip.cs.meta
  22. 34 34
      Assets/DefaultPlayables/NavMeshAgentControl/NavMeshAgentControlMixerBehaviour.cs
  23. 12 12
      Assets/DefaultPlayables/NavMeshAgentControl/NavMeshAgentControlMixerBehaviour.cs.meta
  24. 15 15
      Assets/DefaultPlayables/NavMeshAgentControl/NavMeshAgentControlTrack.cs
  25. 12 12
      Assets/DefaultPlayables/NavMeshAgentControl/NavMeshAgentControlTrack.cs.meta
  26. 22 22
      Assets/DefaultPlayables/ScreenFader/Editor/ScreenFaderDrawer.cs
  27. 12 12
      Assets/DefaultPlayables/ScreenFader/Editor/ScreenFaderDrawer.cs.meta
  28. 11 11
      Assets/DefaultPlayables/ScreenFader/ScreenFaderBehaviour.cs
  29. 12 12
      Assets/DefaultPlayables/ScreenFader/ScreenFaderBehaviour.cs.meta
  30. 20 20
      Assets/DefaultPlayables/ScreenFader/ScreenFaderClip.cs
  31. 12 12
      Assets/DefaultPlayables/ScreenFader/ScreenFaderClip.cs.meta
  32. 64 64
      Assets/DefaultPlayables/ScreenFader/ScreenFaderMixerBehaviour.cs
  33. 12 12
      Assets/DefaultPlayables/ScreenFader/ScreenFaderMixerBehaviour.cs.meta
  34. 36 36
      Assets/DefaultPlayables/ScreenFader/ScreenFaderTrack.cs
  35. 12 12
      Assets/DefaultPlayables/ScreenFader/ScreenFaderTrack.cs.meta
  36. 30 30
      Assets/DefaultPlayables/TextSwitcher/Editor/TextSwitcherDrawer.cs
  37. 12 12
      Assets/DefaultPlayables/TextSwitcher/Editor/TextSwitcherDrawer.cs.meta
  38. 13 13
      Assets/DefaultPlayables/TextSwitcher/TextSwitcherBehaviour.cs
  39. 12 12
      Assets/DefaultPlayables/TextSwitcher/TextSwitcherBehaviour.cs.meta
  40. 20 20
      Assets/DefaultPlayables/TextSwitcher/TextSwitcherClip.cs
  41. 12 12
      Assets/DefaultPlayables/TextSwitcher/TextSwitcherClip.cs.meta
  42. 78 78
      Assets/DefaultPlayables/TextSwitcher/TextSwitcherMixerBehaviour.cs
  43. 12 12
      Assets/DefaultPlayables/TextSwitcher/TextSwitcherMixerBehaviour.cs.meta
  44. 36 36
      Assets/DefaultPlayables/TextSwitcher/TextSwitcherTrack.cs
  45. 12 12
      Assets/DefaultPlayables/TextSwitcher/TextSwitcherTrack.cs.meta
  46. 20 20
      Assets/DefaultPlayables/TimeDilation/Editor/TimeDilationDrawer.cs
  47. 12 12
      Assets/DefaultPlayables/TimeDilation/Editor/TimeDilationDrawer.cs.meta
  48. 10 10
      Assets/DefaultPlayables/TimeDilation/TimeDilationBehaviour.cs
  49. 12 12
      Assets/DefaultPlayables/TimeDilation/TimeDilationBehaviour.cs.meta
  50. 21 21
      Assets/DefaultPlayables/TimeDilation/TimeDilationClip.cs
  51. 12 12
      Assets/DefaultPlayables/TimeDilation/TimeDilationClip.cs.meta
  52. 41 41
      Assets/DefaultPlayables/TimeDilation/TimeDilationMixerBehaviour.cs
  53. 12 12
      Assets/DefaultPlayables/TimeDilation/TimeDilationMixerBehaviour.cs.meta
  54. 13 13
      Assets/DefaultPlayables/TimeDilation/TimeDilationTrack.cs
  55. 12 12
      Assets/DefaultPlayables/TimeDilation/TimeDilationTrack.cs.meta
  56. 44 44
      Assets/DefaultPlayables/TransformTween/Editor/TransformTweenDrawer.cs
  57. 12 12
      Assets/DefaultPlayables/TransformTween/Editor/TransformTweenDrawer.cs.meta
  58. 80 80
      Assets/DefaultPlayables/TransformTween/TransformTweenBehaviour.cs
  59. 12 12
      Assets/DefaultPlayables/TransformTween/TransformTweenBehaviour.cs.meta
  60. 25 25
      Assets/DefaultPlayables/TransformTween/TransformTweenClip.cs
  61. 12 12
      Assets/DefaultPlayables/TransformTween/TransformTweenClip.cs.meta
  62. 118 118
      Assets/DefaultPlayables/TransformTween/TransformTweenMixerBehaviour.cs
  63. 12 12
      Assets/DefaultPlayables/TransformTween/TransformTweenMixerBehaviour.cs.meta
  64. 32 32
      Assets/DefaultPlayables/TransformTween/TransformTweenTrack.cs
  65. 12 12
      Assets/DefaultPlayables/TransformTween/TransformTweenTrack.cs.meta
  66. 176 176
      Assets/DefaultPlayables/Video/VideoPlayableBehaviour.cs
  67. 12 12
      Assets/DefaultPlayables/Video/VideoPlayableBehaviour.cs.meta
  68. 52 52
      Assets/DefaultPlayables/Video/VideoSchedulerPlayableBehaviour.cs
  69. 12 12
      Assets/DefaultPlayables/Video/VideoSchedulerPlayableBehaviour.cs.meta
  70. 45 45
      Assets/DefaultPlayables/Video/VideoScriptPlayableAsset.cs
  71. 12 12
      Assets/DefaultPlayables/Video/VideoScriptPlayableAsset.cs.meta
  72. 34 34
      Assets/DefaultPlayables/Video/VideoScriptPlayableTrack.cs
  73. 12 12
      Assets/DefaultPlayables/Video/VideoScriptPlayableTrack.cs.meta
  74. 60 60
      Assets/DrawingAir/DrawListManager.cs
  75. 85 85
      Assets/DrawingAir/Paint.cs
  76. 152 152
      Assets/DrawingAir/PaintBoard.cs
  77. 57 57
      Assets/DrawingAir/Painter.cs
  78. 0 96
      Assets/FT_MagicEffects_Vol01/Model/FTME01_sphere01.obj.meta
  79. 0 96
      Assets/FT_MagicEffects_Vol01/Model/FTME01_sphere02.obj.meta
  80. 0 101
      Assets/Hard Surface Pro/Shared/Props/Candles/CandleLow.OBJ.meta
  81. 36 36
      Assets/MaterializeFX/MaterializationFX/Scripts/ShaderParameterSetter.cs
  82. 40 40
      Assets/MaterializeFX/MaterializationFX/Scripts/Utils/DemoPrefabController.cs
  83. 58 58
      Assets/MaterializeFX/MaterializationFX/Scripts/Utils/MouseOrbitController.cs
  84. 30 30
      Assets/MathClass/Scripts/Line.cs
  85. 52 52
      Assets/MathClass/Scripts/MethodExtensionForUnity.cs
  86. 59 59
      Assets/MathClass/Scripts/Play.cs
  87. 54 54
      Assets/MathClass/Scripts/PolygonDrawer.cs
  88. 120 120
      Assets/MathClass/Scripts/Triangulator.cs
  89. 9 9
      Assets/MathClass/Scripts/test.cs
  90. 100 100
      Assets/Mirza Beig/Demos/The Last Particle/Scripts/AudioPitchAndVolumeByVelocity.cs
  91. 369 369
      Assets/Mirza Beig/Demos/The Last Particle/Scripts/CameraController.cs
  92. 95 95
      Assets/Mirza Beig/Demos/The Last Particle/Scripts/Collectable.cs
  93. 106 106
      Assets/Mirza Beig/Demos/The Last Particle/Scripts/CollectableSpawner.cs
  94. 79 79
      Assets/Mirza Beig/Demos/The Last Particle/Scripts/Damping.cs
  95. 83 83
      Assets/Mirza Beig/Demos/The Last Particle/Scripts/DestroyOnAudioStop.cs
  96. 78 78
      Assets/Mirza Beig/Demos/The Last Particle/Scripts/InstantiatePrefabOnCollisionEnter.cs
  97. 77 77
      Assets/Mirza Beig/Demos/The Last Particle/Scripts/OnTriggerEvents.cs
  98. 186 186
      Assets/Mirza Beig/Demos/The Last Particle/Scripts/Player.cs
  99. 105 105
      Assets/Mirza Beig/Demos/The Last Particle/Scripts/RandomInvoke.cs
  100. 100 100
      Assets/Mirza Beig/Demos/The Last Particle/Scripts/RandomInvoke_EmitParticle.cs

+ 11 - 0
.gitignore

@@ -0,0 +1,11 @@
+/*.csproj
+/Library
+/Temp
+/obj
+/UserSettings
+/.vsconfig
+/*.apk
+/QCAR
+/*.sln
+/.vs
+/.vscode 

Разлика између датотеке није приказан због своје велике величине
+ 0 - 26
Assembly-CSharp-Editor-firstpass.csproj


Разлика између датотеке није приказан због своје велике величине
+ 0 - 26
Assembly-CSharp-Editor.csproj


Разлика између датотеке није приказан због своје велике величине
+ 0 - 26
Assembly-CSharp-firstpass.csproj


Разлика између датотеке није приказан због своје велике величине
+ 0 - 26
Assembly-CSharp.csproj


+ 1901 - 1901
Assets/DefaultPlayables/Editor/TimelinePlayableWizard.cs

@@ -1,1901 +1,1901 @@
-using System;
+using System;
-using System.IO;
+using System.IO;
-using System.Collections.Generic;
+using System.Collections.Generic;
-using System.Linq;
+using System.Linq;
-using System.CodeDom.Compiler;
+using System.CodeDom.Compiler;
-using System.Reflection;
+using System.Reflection;
-using UnityEditor;
+using UnityEditor;
-using UnityEngine;
+using UnityEngine;
-using UnityEngine.Timeline;
+using UnityEngine.Timeline;
-
+
-public class TimelinePlayableWizard : EditorWindow
+public class TimelinePlayableWizard : EditorWindow
-{
+{
-    public class Variable : IComparable
+    public class Variable : IComparable
-    {
+    {
-        public string name;
+        public string name;
-        public UsableType usableType;
+        public UsableType usableType;
-
+
-        int m_TypeIndex;
+        int m_TypeIndex;
-        
+        
-        public Variable (string name, UsableType usableType)
+        public Variable (string name, UsableType usableType)
-        {
+        {
-            this.name = name;
+            this.name = name;
-            this.usableType = usableType;
+            this.usableType = usableType;
-        }
+        }
-
+
-        public bool GUI (UsableType[] usableTypes)
+        public bool GUI (UsableType[] usableTypes)
-        {
+        {
-            bool removeThis = false;
+            bool removeThis = false;
-            EditorGUILayout.BeginHorizontal();
+            EditorGUILayout.BeginHorizontal();
-            name = EditorGUILayout.TextField(name);
+            name = EditorGUILayout.TextField(name);
-            m_TypeIndex = EditorGUILayout.Popup(m_TypeIndex, UsableType.GetNamewithSortingArray (usableTypes));
+            m_TypeIndex = EditorGUILayout.Popup(m_TypeIndex, UsableType.GetNamewithSortingArray (usableTypes));
-            usableType = usableTypes[m_TypeIndex];
+            usableType = usableTypes[m_TypeIndex];
-            if (GUILayout.Button("Remove", GUILayout.Width(60f)))
+            if (GUILayout.Button("Remove", GUILayout.Width(60f)))
-            {
+            {
-                removeThis = true;
+                removeThis = true;
-            }
+            }
-            EditorGUILayout.EndHorizontal();
+            EditorGUILayout.EndHorizontal();
-
+
-            return removeThis;
+            return removeThis;
-        }
+        }
-
+
-        public int CompareTo (object obj)
+        public int CompareTo (object obj)
-        {
+        {
-            if (obj == null)
+            if (obj == null)
-                return 1;
+                return 1;
-
+
-            UsableType other = (UsableType)obj;
+            UsableType other = (UsableType)obj;
-
+
-            if (other == null)
+            if (other == null)
-                throw new ArgumentException("This object is not a Variable.");
+                throw new ArgumentException("This object is not a Variable.");
-
+
-            return name.ToLower().CompareTo(other.name.ToLower());
+            return name.ToLower().CompareTo(other.name.ToLower());
-        }
+        }
-
+
-        public static UsableType[] GetUsableTypesFromVariableArray (Variable[] variables)
+        public static UsableType[] GetUsableTypesFromVariableArray (Variable[] variables)
-        {
+        {
-            UsableType[] usableTypes = new UsableType[variables.Length];
+            UsableType[] usableTypes = new UsableType[variables.Length];
-            for (int i = 0; i < usableTypes.Length; i++)
+            for (int i = 0; i < usableTypes.Length; i++)
-            {
+            {
-                usableTypes[i] = variables[i].usableType;
+                usableTypes[i] = variables[i].usableType;
-            }
+            }
-            return usableTypes;
+            return usableTypes;
-        }
+        }
-    }
+    }
-
+
-
+
-    public class UsableType : IComparable
+    public class UsableType : IComparable
-    {
+    {
-        public readonly string name;
+        public readonly string name;
-        public readonly string nameWithSorting;
+        public readonly string nameWithSorting;
-        public readonly string additionalNamespace;
+        public readonly string additionalNamespace;
-        public readonly GUIContent guiContentWithSorting;
+        public readonly GUIContent guiContentWithSorting;
-        public readonly Type type;
+        public readonly Type type;
-
+
-        public readonly string[] unrequiredNamespaces =
+        public readonly string[] unrequiredNamespaces =
-        {
+        {
-            "UnityEngine",
+            "UnityEngine",
-            "UnityEngine.Timeline",
+            "UnityEngine.Timeline",
-            "UnityEngine.Playables"
+            "UnityEngine.Playables"
-        };
+        };
-        public const string blankAdditionalNamespace = "";
+        public const string blankAdditionalNamespace = "";
-
+
-        const string k_NameForNullType = "None";
+        const string k_NameForNullType = "None";
-
+
-        public UsableType (Type usableType)
+        public UsableType (Type usableType)
-        {
+        {
-            type = usableType;
+            type = usableType;
-
+
-            if (type != null)
+            if (type != null)
-            {
+            {
-                name = usableType.Name;
+                name = usableType.Name;
-                nameWithSorting = name.ToUpper ()[0] + "/" + name;
+                nameWithSorting = name.ToUpper ()[0] + "/" + name;
-                additionalNamespace = unrequiredNamespaces.All (t => usableType.Namespace != t) ? usableType.Namespace : blankAdditionalNamespace;
+                additionalNamespace = unrequiredNamespaces.All (t => usableType.Namespace != t) ? usableType.Namespace : blankAdditionalNamespace;
-            }
+            }
-            else
+            else
-            {
+            {
-                name = k_NameForNullType;
+                name = k_NameForNullType;
-                nameWithSorting = k_NameForNullType;
+                nameWithSorting = k_NameForNullType;
-                additionalNamespace = blankAdditionalNamespace;
+                additionalNamespace = blankAdditionalNamespace;
-            }
+            }
-
+
-            guiContentWithSorting = new GUIContent(nameWithSorting);
+            guiContentWithSorting = new GUIContent(nameWithSorting);
-        }
+        }
-
+
-        public UsableType (string name)
+        public UsableType (string name)
-        {
+        {
-            this.name = name;
+            this.name = name;
-            nameWithSorting = name.ToUpper()[0] + "/" + name;
+            nameWithSorting = name.ToUpper()[0] + "/" + name;
-            additionalNamespace = blankAdditionalNamespace;
+            additionalNamespace = blankAdditionalNamespace;
-            guiContentWithSorting = new GUIContent(nameWithSorting);
+            guiContentWithSorting = new GUIContent(nameWithSorting);
-        }
+        }
-
+
-        public int CompareTo (object obj)
+        public int CompareTo (object obj)
-        {
+        {
-            if (obj == null)
+            if (obj == null)
-                return 1;
+                return 1;
-
+
-            UsableType other = (UsableType)obj;
+            UsableType other = (UsableType)obj;
-            
+            
-            if(other == null)
+            if(other == null)
-                throw new ArgumentException("This object is not a UsableType.");
+                throw new ArgumentException("This object is not a UsableType.");
-
+
-            return name.ToLower().CompareTo (other.name.ToLower());
+            return name.ToLower().CompareTo (other.name.ToLower());
-        }
+        }
-
+
-        public static UsableType[] GetUsableTypeArray (Type[] types, params UsableType[] additionalUsableTypes)
+        public static UsableType[] GetUsableTypeArray (Type[] types, params UsableType[] additionalUsableTypes)
-        {
+        {
-            List<UsableType> usableTypeList = new List<UsableType> ();
+            List<UsableType> usableTypeList = new List<UsableType> ();
-            for (int i = 0; i < types.Length; i++)
+            for (int i = 0; i < types.Length; i++)
-            {
+            {
-                usableTypeList.Add (new UsableType (types[i]));
+                usableTypeList.Add (new UsableType (types[i]));
-            }
+            }
-            usableTypeList.AddRange (additionalUsableTypes);
+            usableTypeList.AddRange (additionalUsableTypes);
-            return usableTypeList.ToArray ();
+            return usableTypeList.ToArray ();
-        }
+        }
-
+
-        public static UsableType[] AmalgamateUsableTypes (UsableType[] usableTypeArray, params UsableType[] usableTypes)
+        public static UsableType[] AmalgamateUsableTypes (UsableType[] usableTypeArray, params UsableType[] usableTypes)
-        {
+        {
-            List<UsableType> usableTypeList = new List<UsableType> ();
+            List<UsableType> usableTypeList = new List<UsableType> ();
-            for (int i = 0; i < usableTypes.Length; i++)
+            for (int i = 0; i < usableTypes.Length; i++)
-            {
+            {
-                usableTypeList.Add (usableTypes[i]);
+                usableTypeList.Add (usableTypes[i]);
-            }
+            }
-            usableTypeList.AddRange(usableTypeArray);
+            usableTypeList.AddRange(usableTypeArray);
-            return usableTypeList.ToArray();
+            return usableTypeList.ToArray();
-        }
+        }
-
+
-        public static string[] GetNamewithSortingArray(UsableType[] usableTypes)
+        public static string[] GetNamewithSortingArray(UsableType[] usableTypes)
-        {
+        {
-            if (usableTypes == null || usableTypes.Length == 0)
+            if (usableTypes == null || usableTypes.Length == 0)
-                return new string[0];
+                return new string[0];
-
+
-            string[] displayNames = new string[usableTypes.Length];
+            string[] displayNames = new string[usableTypes.Length];
-            for (int i = 0; i < displayNames.Length; i++)
+            for (int i = 0; i < displayNames.Length; i++)
-            {
+            {
-                displayNames[i] = usableTypes[i].nameWithSorting;
+                displayNames[i] = usableTypes[i].nameWithSorting;
-            }
+            }
-            return displayNames;
+            return displayNames;
-        }
+        }
-
+
-        public static GUIContent[] GetGUIContentWithSortingArray (UsableType[] usableTypes)
+        public static GUIContent[] GetGUIContentWithSortingArray (UsableType[] usableTypes)
-        {
+        {
-            if(usableTypes == null || usableTypes.Length == 0)
+            if(usableTypes == null || usableTypes.Length == 0)
-                return new GUIContent[0];
+                return new GUIContent[0];
-
+
-            GUIContent[] guiContents = new GUIContent[usableTypes.Length];
+            GUIContent[] guiContents = new GUIContent[usableTypes.Length];
-            for (int i = 0; i < guiContents.Length; i++)
+            for (int i = 0; i < guiContents.Length; i++)
-            {
+            {
-                guiContents[i] = usableTypes[i].guiContentWithSorting;
+                guiContents[i] = usableTypes[i].guiContentWithSorting;
-            }
+            }
-            return guiContents;
+            return guiContents;
-        }
+        }
-
+
-        public static string[] GetDistinctAdditionalNamespaces (UsableType[] usableTypes)
+        public static string[] GetDistinctAdditionalNamespaces (UsableType[] usableTypes)
-        {
+        {
-            if (usableTypes == null || usableTypes.Length == 0)
+            if (usableTypes == null || usableTypes.Length == 0)
-                return new string[0];
+                return new string[0];
-
+
-            string[] namespaceArray = new string[usableTypes.Length];
+            string[] namespaceArray = new string[usableTypes.Length];
-            for (int i = 0; i < namespaceArray.Length; i++)
+            for (int i = 0; i < namespaceArray.Length; i++)
-            {
+            {
-                namespaceArray[i] = usableTypes[i].additionalNamespace;
+                namespaceArray[i] = usableTypes[i].additionalNamespace;
-            }
+            }
-            return namespaceArray.Distinct().ToArray();
+            return namespaceArray.Distinct().ToArray();
-        }
+        }
-    }
+    }
-
+
-
+
-    public class UsableProperty : IComparable
+    public class UsableProperty : IComparable
-    {
+    {
-        public enum Usability
+        public enum Usability
-        {
+        {
-            Blendable, Assignable, Not
+            Blendable, Assignable, Not
-        }
+        }
-        
+        
-        public enum UsablePropertyType
+        public enum UsablePropertyType
-        {
+        {
-            Property, Field
+            Property, Field
-        }
+        }
-        
+        
-        public string type;
+        public string type;
-        public string name;
+        public string name;
-        public string defaultValue;
+        public string defaultValue;
-        public Usability usability;
+        public Usability usability;
-        public UsablePropertyType usablePropertyType;
+        public UsablePropertyType usablePropertyType;
-        public PropertyInfo propertyInfo;
+        public PropertyInfo propertyInfo;
-        public FieldInfo fieldInfo;
+        public FieldInfo fieldInfo;
-
+
-        int m_TypeIndex;
+        int m_TypeIndex;
-        
+        
-        public string NameWithCaptial
+        public string NameWithCaptial
-        {
+        {
-            get { return name.First().ToString().ToUpper() + name.Substring(1); }
+            get { return name.First().ToString().ToUpper() + name.Substring(1); }
-        }
+        }
-
+
-        public string NameAsPrivate
+        public string NameAsPrivate
-        {
+        {
-            get { return "m_" + NameWithCaptial; }
+            get { return "m_" + NameWithCaptial; }
-        }
+        }
-
+
-        public string NameAsPrivateDefault
+        public string NameAsPrivateDefault
-        {
+        {
-            get { return "m_Default" + NameWithCaptial; }
+            get { return "m_Default" + NameWithCaptial; }
-        }
+        }
-
+
-        public string NameAsPrivateAssigned
+        public string NameAsPrivateAssigned
-        {
+        {
-            get { return "m_Assigned" + NameWithCaptial; }
+            get { return "m_Assigned" + NameWithCaptial; }
-        }
+        }
-
+
-        public string NameAsLocalBlended
+        public string NameAsLocalBlended
-        {
+        {
-            get { return "blended" + NameWithCaptial; }
+            get { return "blended" + NameWithCaptial; }
-        }
+        }
-
+
-        public string NameAsLocalSerializedProperty
+        public string NameAsLocalSerializedProperty
-        {
+        {
-            get { return name + "Prop"; }
+            get { return name + "Prop"; }
-        }
+        }
-        
+        
-        public UsableProperty (PropertyInfo propertyInfo)
+        public UsableProperty (PropertyInfo propertyInfo)
-        {
+        {
-            usablePropertyType = UsablePropertyType.Property;
+            usablePropertyType = UsablePropertyType.Property;
-            this.propertyInfo = propertyInfo;
+            this.propertyInfo = propertyInfo;
-
+
-            if (propertyInfo.PropertyType.Name == "Single")
+            if (propertyInfo.PropertyType.Name == "Single")
-                type = "float";
+                type = "float";
-            else if (propertyInfo.PropertyType.Name == "Int32")
+            else if (propertyInfo.PropertyType.Name == "Int32")
-                type = "int";
+                type = "int";
-            else if (propertyInfo.PropertyType.Name == "Double")
+            else if (propertyInfo.PropertyType.Name == "Double")
-                type = "double";
+                type = "double";
-            else if (propertyInfo.PropertyType.Name == "Boolean")
+            else if (propertyInfo.PropertyType.Name == "Boolean")
-                type = "bool";
+                type = "bool";
-            else if (propertyInfo.PropertyType.Name == "String")
+            else if (propertyInfo.PropertyType.Name == "String")
-                type = "string";
+                type = "string";
-            else
+            else
-                type = propertyInfo.PropertyType.Name;
+                type = propertyInfo.PropertyType.Name;
-
+
-            name = propertyInfo.Name;
+            name = propertyInfo.Name;
-
+
-            if (IsTypeBlendable(propertyInfo.PropertyType))
+            if (IsTypeBlendable(propertyInfo.PropertyType))
-                usability = Usability.Blendable;
+                usability = Usability.Blendable;
-            else if (IsTypeAssignable(propertyInfo.PropertyType))
+            else if (IsTypeAssignable(propertyInfo.PropertyType))
-                usability = Usability.Assignable;
+                usability = Usability.Assignable;
-            else
+            else
-                usability = Usability.Not;
+                usability = Usability.Not;
-        }
+        }
-
+
-        public UsableProperty (FieldInfo fieldInfo)
+        public UsableProperty (FieldInfo fieldInfo)
-        {
+        {
-            usablePropertyType = UsablePropertyType.Field;
+            usablePropertyType = UsablePropertyType.Field;
-            this.fieldInfo = fieldInfo;
+            this.fieldInfo = fieldInfo;
-            
+            
-            if (fieldInfo.FieldType.Name == "Single")
+            if (fieldInfo.FieldType.Name == "Single")
-                type = "float";
+                type = "float";
-            else if (fieldInfo.FieldType.Name == "Int32")
+            else if (fieldInfo.FieldType.Name == "Int32")
-                type = "int";
+                type = "int";
-            else if (fieldInfo.FieldType.Name == "Double")
+            else if (fieldInfo.FieldType.Name == "Double")
-                type = "double";
+                type = "double";
-            else if (fieldInfo.FieldType.Name == "Boolean")
+            else if (fieldInfo.FieldType.Name == "Boolean")
-                type = "bool";
+                type = "bool";
-            else if (fieldInfo.FieldType.Name == "String")
+            else if (fieldInfo.FieldType.Name == "String")
-                type = "string";
+                type = "string";
-            else
+            else
-                type = fieldInfo.FieldType.Name;
+                type = fieldInfo.FieldType.Name;
-
+
-            name = fieldInfo.Name;
+            name = fieldInfo.Name;
-            
+            
-            if (IsTypeBlendable(fieldInfo.FieldType))
+            if (IsTypeBlendable(fieldInfo.FieldType))
-                usability = Usability.Blendable;
+                usability = Usability.Blendable;
-            else if (IsTypeAssignable(fieldInfo.FieldType))
+            else if (IsTypeAssignable(fieldInfo.FieldType))
-                usability = Usability.Assignable;
+                usability = Usability.Assignable;
-            else
+            else
-                usability = Usability.Not;
+                usability = Usability.Not;
-        }
+        }
-
+
-        public string ZeroValueAsString ()
+        public string ZeroValueAsString ()
-        {
+        {
-            if(usability != Usability.Blendable)
+            if(usability != Usability.Blendable)
-                throw new UnityException("UsableType is not blendable, shouldn't be looking for zero value as string.");
+                throw new UnityException("UsableType is not blendable, shouldn't be looking for zero value as string.");
-
+
-            switch (type)
+            switch (type)
-            {
+            {
-                case "float":
+                case "float":
-                    return "0f";
+                    return "0f";
-                case "int":
+                case "int":
-                    return "0";
+                    return "0";
-                case "double":
+                case "double":
-                    return "0.0";
+                    return "0.0";
-                case "Vector2":
+                case "Vector2":
-                    return "Vector2.zero";
+                    return "Vector2.zero";
-                case "Vector3":
+                case "Vector3":
-                    return "Vector3.zero";
+                    return "Vector3.zero";
-                case "Color":
+                case "Color":
-                    return "Color.clear";
+                    return "Color.clear";
-            }
+            }
-            return "";
+            return "";
-        }
+        }
-
+
-        public void CreateSettingDefaultValueString (Component defaultValuesComponent)
+        public void CreateSettingDefaultValueString (Component defaultValuesComponent)
-        {
+        {
-            if (defaultValuesComponent == null)
+            if (defaultValuesComponent == null)
-            {
+            {
-                defaultValue = "";
+                defaultValue = "";
-                return;
+                return;
-            }
+            }
-            
+            
-            object defaultValueObj = usablePropertyType == UsablePropertyType.Property ? propertyInfo.GetValue (defaultValuesComponent, null) : fieldInfo.GetValue (defaultValuesComponent);
+            object defaultValueObj = usablePropertyType == UsablePropertyType.Property ? propertyInfo.GetValue (defaultValuesComponent, null) : fieldInfo.GetValue (defaultValuesComponent);
-            
+            
-            switch (type)
+            switch (type)
-            {
+            {
-                case "float":
+                case "float":
-                    float defaultFloatValue = (float)defaultValueObj;
+                    float defaultFloatValue = (float)defaultValueObj;
-                    defaultValue = defaultFloatValue + "f";
+                    defaultValue = defaultFloatValue + "f";
-                    break;
+                    break;
-                case "int":
+                case "int":
-                    int defaultIntValue = (int)defaultValueObj;
+                    int defaultIntValue = (int)defaultValueObj;
-                    defaultValue = defaultIntValue.ToString();
+                    defaultValue = defaultIntValue.ToString();
-                    break;
+                    break;
-                case "double":
+                case "double":
-                    double defaultDoubleValue = (double)defaultValueObj;
+                    double defaultDoubleValue = (double)defaultValueObj;
-                    defaultValue = defaultDoubleValue.ToString();
+                    defaultValue = defaultDoubleValue.ToString();
-                    break;
+                    break;
-                case "Vector2":
+                case "Vector2":
-                    Vector2 defaultVector2Value = (Vector2)defaultValueObj;
+                    Vector2 defaultVector2Value = (Vector2)defaultValueObj;
-                    defaultValue = "new Vector2(" + defaultVector2Value.x + "f, " + defaultVector2Value.y + "f)";
+                    defaultValue = "new Vector2(" + defaultVector2Value.x + "f, " + defaultVector2Value.y + "f)";
-                    break;
+                    break;
-                case "Vector3":
+                case "Vector3":
-                    Vector3 defaultVector3Value = (Vector3)defaultValueObj;
+                    Vector3 defaultVector3Value = (Vector3)defaultValueObj;
-                    defaultValue = "new Vector3(" + defaultVector3Value.x + "f, " + defaultVector3Value.y + "f, " + defaultVector3Value.z + "f)";
+                    defaultValue = "new Vector3(" + defaultVector3Value.x + "f, " + defaultVector3Value.y + "f, " + defaultVector3Value.z + "f)";
-                    break;
+                    break;
-                case "Color":
+                case "Color":
-                    Color defaultColorValue = (Color)defaultValueObj;
+                    Color defaultColorValue = (Color)defaultValueObj;
-                    defaultValue = "new Color(" + defaultColorValue.r + "f, " + defaultColorValue.g + "f, " + defaultColorValue.b + "f, " + defaultColorValue.a + "f)";
+                    defaultValue = "new Color(" + defaultColorValue.r + "f, " + defaultColorValue.g + "f, " + defaultColorValue.b + "f, " + defaultColorValue.a + "f)";
-                    break;
+                    break;
-                case "string":
+                case "string":
-                    defaultValue = "\"" + defaultValueObj + "\"";
+                    defaultValue = "\"" + defaultValueObj + "\"";
-                    break;
+                    break;
-                case "bool":
+                case "bool":
-                    bool defaultBoolValue = (bool)defaultValueObj;
+                    bool defaultBoolValue = (bool)defaultValueObj;
-                    defaultValue = defaultBoolValue.ToString ().ToLower();
+                    defaultValue = defaultBoolValue.ToString ().ToLower();
-                    break;
+                    break;
-                default:
+                default:
-                    Enum defaultEnumValue = (Enum)defaultValueObj;
+                    Enum defaultEnumValue = (Enum)defaultValueObj;
-                    Type enumSystemType = defaultEnumValue.GetType ();
+                    Type enumSystemType = defaultEnumValue.GetType ();
-                    string[] splits = enumSystemType.ToString().Split('+');
+                    string[] splits = enumSystemType.ToString().Split('+');
-                    string enumType = splits[splits.Length - 1];
+                    string enumType = splits[splits.Length - 1];
-                    string enumConstantName = Enum.GetName (enumSystemType, defaultEnumValue);
+                    string enumConstantName = Enum.GetName (enumSystemType, defaultEnumValue);
-                    defaultValue = enumType + "." + enumConstantName;
+                    defaultValue = enumType + "." + enumConstantName;
-                    break;
+                    break;
-            }
+            }
-        }
+        }
-
+
-        public bool GUI (List<UsableProperty> allUsableProperties)
+        public bool GUI (List<UsableProperty> allUsableProperties)
-        {
+        {
-            bool removeThis = false;
+            bool removeThis = false;
-            EditorGUILayout.BeginHorizontal();
+            EditorGUILayout.BeginHorizontal();
-            m_TypeIndex = EditorGUILayout.Popup(m_TypeIndex, GetNameWithSortingArray (allUsableProperties));
+            m_TypeIndex = EditorGUILayout.Popup(m_TypeIndex, GetNameWithSortingArray (allUsableProperties));
-            type = allUsableProperties[m_TypeIndex].type;
+            type = allUsableProperties[m_TypeIndex].type;
-            name = allUsableProperties[m_TypeIndex].name;
+            name = allUsableProperties[m_TypeIndex].name;
-            usablePropertyType = allUsableProperties[m_TypeIndex].usablePropertyType;
+            usablePropertyType = allUsableProperties[m_TypeIndex].usablePropertyType;
-            propertyInfo = allUsableProperties[m_TypeIndex].propertyInfo;
+            propertyInfo = allUsableProperties[m_TypeIndex].propertyInfo;
-            fieldInfo = allUsableProperties[m_TypeIndex].fieldInfo;
+            fieldInfo = allUsableProperties[m_TypeIndex].fieldInfo;
-            usability = allUsableProperties[m_TypeIndex].usability;
+            usability = allUsableProperties[m_TypeIndex].usability;
-            if (GUILayout.Button("Remove", GUILayout.Width(60f)))
+            if (GUILayout.Button("Remove", GUILayout.Width(60f)))
-            {
+            {
-                removeThis = true;
+                removeThis = true;
-            }
+            }
-            EditorGUILayout.EndHorizontal();
+            EditorGUILayout.EndHorizontal();
-            return removeThis;
+            return removeThis;
-        }
+        }
-
+
-        public int CompareTo(object obj)
+        public int CompareTo(object obj)
-        {
+        {
-            if (obj == null)
+            if (obj == null)
-                return 1;
+                return 1;
-
+
-            UsableType other = (UsableType)obj;
+            UsableType other = (UsableType)obj;
-
+
-            if (other == null)
+            if (other == null)
-                throw new ArgumentException("This object is not a UsableProperty.");
+                throw new ArgumentException("This object is not a UsableProperty.");
-
+
-            return name.ToLower().CompareTo(other.name.ToLower());
+            return name.ToLower().CompareTo(other.name.ToLower());
-        }
+        }
-
+
-        public static string[] GetNameWithSortingArray (List<UsableProperty> usableProperties)
+        public static string[] GetNameWithSortingArray (List<UsableProperty> usableProperties)
-        {
+        {
-            string[] returnVal = new string[usableProperties.Count];
+            string[] returnVal = new string[usableProperties.Count];
-            for (int i = 0; i < returnVal.Length; i++)
+            for (int i = 0; i < returnVal.Length; i++)
-            {
+            {
-                returnVal[i] = usableProperties[i].name;
+                returnVal[i] = usableProperties[i].name;
-            }
+            }
-            return returnVal;
+            return returnVal;
-        }
+        }
-
+
-        public UsableProperty GetDuplicate ()
+        public UsableProperty GetDuplicate ()
-        {
+        {
-            UsableProperty duplicate = usablePropertyType == UsablePropertyType.Property ? new UsableProperty (propertyInfo) : new UsableProperty (fieldInfo);
+            UsableProperty duplicate = usablePropertyType == UsablePropertyType.Property ? new UsableProperty (propertyInfo) : new UsableProperty (fieldInfo);
-            duplicate.defaultValue = defaultValue;
+            duplicate.defaultValue = defaultValue;
-            return duplicate;
+            return duplicate;
-        }
+        }
-    }
+    }
-
+
-    public enum CreationError
+    public enum CreationError
-    {
+    {
-        NoError,
+        NoError,
-        PlayableAssetAlreadyExists,
+        PlayableAssetAlreadyExists,
-        PlayableBehaviourAlreadyExists,
+        PlayableBehaviourAlreadyExists,
-        PlayableBehaviourMixerAlreadyExists,
+        PlayableBehaviourMixerAlreadyExists,
-        TrackAssetAlreadyExists,
+        TrackAssetAlreadyExists,
-        PlayableDrawerAlreadyExists,
+        PlayableDrawerAlreadyExists,
-    }
+    }
-
+
-
+
-    public bool showHelpBoxes = true;
+    public bool showHelpBoxes = true;
-    public string playableName = "";
+    public string playableName = "";
-    public bool isStandardBlendPlayable;
+    public bool isStandardBlendPlayable;
-    public UsableType trackBinding;
+    public UsableType trackBinding;
-    public Component defaultValuesComponent;
+    public Component defaultValuesComponent;
-    public List<Variable> exposedReferences = new List<Variable> ();
+    public List<Variable> exposedReferences = new List<Variable> ();
-    public List<Variable> playableBehaviourVariables = new List<Variable> ();
+    public List<Variable> playableBehaviourVariables = new List<Variable> ();
-    public List<UsableProperty> standardBlendPlayableProperties = new List<UsableProperty> ();
+    public List<UsableProperty> standardBlendPlayableProperties = new List<UsableProperty> ();
-    public ClipCaps clipCaps;
+    public ClipCaps clipCaps;
-    /*public bool setClipDefaults;
+    /*public bool setClipDefaults;
-    public float clipDefaultDurationSeconds = 5f;
+    public float clipDefaultDurationSeconds = 5f;
-    public float clipDefaultEaseInSeconds;
+    public float clipDefaultEaseInSeconds;
-    public float clipDefaultEaseOutSeconds;
+    public float clipDefaultEaseOutSeconds;
-    public float clipDefaultClipInSeconds;
+    public float clipDefaultClipInSeconds;
-    public float clipDefaultSpeedMultiplier = 1f;*/
+    public float clipDefaultSpeedMultiplier = 1f;*/
-    public Color trackColor = new Color(0.855f, 0.8623f, 0.870f);
+    public Color trackColor = new Color(0.855f, 0.8623f, 0.870f);
-
+
-    int m_TrackBindingTypeIndex;
+    int m_TrackBindingTypeIndex;
-    int m_ComponentBindingTypeIndex;
+    int m_ComponentBindingTypeIndex;
-    PropertyInfo[] m_TrackBindingProperties;
+    PropertyInfo[] m_TrackBindingProperties;
-    FieldInfo[] m_TrackBindingFields;
+    FieldInfo[] m_TrackBindingFields;
-    List<UsableProperty> m_TrackBindingUsableProperties = new List<UsableProperty> ();
+    List<UsableProperty> m_TrackBindingUsableProperties = new List<UsableProperty> ();
-    bool m_CreateDrawer;
+    bool m_CreateDrawer;
-    bool m_CreateButtonPressed;
+    bool m_CreateButtonPressed;
-    Vector2 m_ScrollViewPos;
+    Vector2 m_ScrollViewPos;
-    CreationError m_CreationError;
+    CreationError m_CreationError;
-    
+    
-    readonly GUIContent m_ShowHelpBoxesContent = new GUIContent("Show Help", "Do you want to see the help boxes as part of this wizard?");
+    readonly GUIContent m_ShowHelpBoxesContent = new GUIContent("Show Help", "Do you want to see the help boxes as part of this wizard?");
-    readonly GUIContent m_PlayableNameContent = new GUIContent("Playable Name", "This is the name that will represent the playable.  E.G. TransformTween.  It will be the basis for the class names so it is best not to use the postfixes: 'Clip', 'Behaviour', 'MixerBehaviour' or 'Drawer'.");
+    readonly GUIContent m_PlayableNameContent = new GUIContent("Playable Name", "This is the name that will represent the playable.  E.G. TransformTween.  It will be the basis for the class names so it is best not to use the postfixes: 'Clip', 'Behaviour', 'MixerBehaviour' or 'Drawer'.");
-    readonly GUIContent m_StandardBlendPlayableContent = new GUIContent("Standard Blend Playable", "Often when creating a playable it's intended purpose is just to briefly override the properties of a component for the playable's duration and then blend back to the defaults.  For example a playable that changes the color of a Light but changes it back.  To make a playable with this functionality, check this box.");
+    readonly GUIContent m_StandardBlendPlayableContent = new GUIContent("Standard Blend Playable", "Often when creating a playable it's intended purpose is just to briefly override the properties of a component for the playable's duration and then blend back to the defaults.  For example a playable that changes the color of a Light but changes it back.  To make a playable with this functionality, check this box.");
-    readonly GUIContent m_TrackBindingTypeContent = new GUIContent("Track Binding Type", "This is the type of object the Playable will affect.  E.G. To affect the position choose Transform.");
+    readonly GUIContent m_TrackBindingTypeContent = new GUIContent("Track Binding Type", "This is the type of object the Playable will affect.  E.G. To affect the position choose Transform.");
-    readonly GUIContent m_DefaultValuesComponentContent = new GUIContent("Default Values", "When the scripts are created, each of the selected properties are assigned a default from the selected Component.  If this is left blank no defaults will be used.");
+    readonly GUIContent m_DefaultValuesComponentContent = new GUIContent("Default Values", "When the scripts are created, each of the selected properties are assigned a default from the selected Component.  If this is left blank no defaults will be used.");
-    readonly GUIContent m_ExposedReferencesContent = new GUIContent("Exposed References", "Exposed References are references to objects in a scene that your Playable needs. For example, if you want to tween between two Transforms, they will need to be Exposed References.");
+    readonly GUIContent m_ExposedReferencesContent = new GUIContent("Exposed References", "Exposed References are references to objects in a scene that your Playable needs. For example, if you want to tween between two Transforms, they will need to be Exposed References.");
-    readonly GUIContent m_BehaviourVariablesContent = new GUIContent("Behaviour Variables", "Behaviour Variables are all the variables you wish to use in your playable that do NOT need a reference to something in a scene.  For example a float for speed.");
+    readonly GUIContent m_BehaviourVariablesContent = new GUIContent("Behaviour Variables", "Behaviour Variables are all the variables you wish to use in your playable that do NOT need a reference to something in a scene.  For example a float for speed.");
-    readonly GUIContent m_TrackColorContent = new GUIContent("Track Color", "Timeline tracks have a colored outline, use this to select that color for your track.");
+    readonly GUIContent m_TrackColorContent = new GUIContent("Track Color", "Timeline tracks have a colored outline, use this to select that color for your track.");
-    readonly GUIContent m_CreateDrawerContent = new GUIContent("Create Drawer?", "Checking this box will enable the creation of a PropertyDrawer for your playable.  Having this script will make it easier to customise how your playable appears in the inspector.");
+    readonly GUIContent m_CreateDrawerContent = new GUIContent("Create Drawer?", "Checking this box will enable the creation of a PropertyDrawer for your playable.  Having this script will make it easier to customise how your playable appears in the inspector.");
-    readonly GUIContent m_StandardBlendPlayablePropertiesContent = new GUIContent("Standard Blend Playable Properties", "Having already selected a Track Binding type, you can select the properties of the bound component you want the playable to affect.  For example, if your playable is bound to a Transform, you can affect the position property.  Note that changing the component binding will clear the list of properties.");
+    readonly GUIContent m_StandardBlendPlayablePropertiesContent = new GUIContent("Standard Blend Playable Properties", "Having already selected a Track Binding type, you can select the properties of the bound component you want the playable to affect.  For example, if your playable is bound to a Transform, you can affect the position property.  Note that changing the component binding will clear the list of properties.");
-    readonly GUIContent m_ClipCapsContent = new GUIContent("Clip Caps", "Clip Caps are used to change the way Timelines work with your playables.  For example, enabling Blending will mean that your playables can blend when they overlap and have ease in and out durations.  To find out a little about each hover the cursor over the options.  For details, please see the documentation.");
+    readonly GUIContent m_ClipCapsContent = new GUIContent("Clip Caps", "Clip Caps are used to change the way Timelines work with your playables.  For example, enabling Blending will mean that your playables can blend when they overlap and have ease in and out durations.  To find out a little about each hover the cursor over the options.  For details, please see the documentation.");
-    readonly GUIContent m_CCNoneContent = new GUIContent("None", "Your playable supports none of the features below.");
+    readonly GUIContent m_CCNoneContent = new GUIContent("None", "Your playable supports none of the features below.");
-    readonly GUIContent m_CCLoopingContent = new GUIContent("Looping", "Your playable has a specified time that it takes and will start again after it finishes until the clip's duration has played.");
+    readonly GUIContent m_CCLoopingContent = new GUIContent("Looping", "Your playable has a specified time that it takes and will start again after it finishes until the clip's duration has played.");
-    readonly GUIContent m_CCExtrapolationContent = new GUIContent("Extrapolation", "Your playable will persist beyond its end time and its results will continue until the next clip is encountered.");
+    readonly GUIContent m_CCExtrapolationContent = new GUIContent("Extrapolation", "Your playable will persist beyond its end time and its results will continue until the next clip is encountered.");
-    readonly GUIContent m_CCClipInContent = new GUIContent("Clip In", "Your playable need not be at the start of the Timeline.");
+    readonly GUIContent m_CCClipInContent = new GUIContent("Clip In", "Your playable need not be at the start of the Timeline.");
-    readonly GUIContent m_CCSpeedMultiplierContent = new GUIContent("Speed Multiplier", "Your playable supports changes to the time scale.");
+    readonly GUIContent m_CCSpeedMultiplierContent = new GUIContent("Speed Multiplier", "Your playable supports changes to the time scale.");
-    readonly GUIContent m_CCBlendingContent = new GUIContent("Blending", "Your playable supports overlapping of clips to blend between them.");
+    readonly GUIContent m_CCBlendingContent = new GUIContent("Blending", "Your playable supports overlapping of clips to blend between them.");
-    readonly GUIContent m_CCAllContent = new GUIContent("All", "Your playable supports all of the above features.");
+    readonly GUIContent m_CCAllContent = new GUIContent("All", "Your playable supports all of the above features.");
-    /*readonly GUIContent m_SetClipDefaultsContent = new GUIContent("Set Clip Defaults", "Do you want to set the default timings and other settings for clips when they are first created?");
+    /*readonly GUIContent m_SetClipDefaultsContent = new GUIContent("Set Clip Defaults", "Do you want to set the default timings and other settings for clips when they are first created?");
-    readonly GUIContent m_ClipDefaultsContent = new GUIContent("Clip Defaults");
+    readonly GUIContent m_ClipDefaultsContent = new GUIContent("Clip Defaults");
-    readonly GUIContent m_CDClipTimingContent = new GUIContent("Clip Timing", "Various settings that affect the durations over which the playable will be active.");
+    readonly GUIContent m_CDClipTimingContent = new GUIContent("Clip Timing", "Various settings that affect the durations over which the playable will be active.");
-    readonly GUIContent m_CDDurationContent = new GUIContent("Duration", "The default length of the clip in seconds.");
+    readonly GUIContent m_CDDurationContent = new GUIContent("Duration", "The default length of the clip in seconds.");
-    readonly GUIContent m_CDEaseInContent = new GUIContent("Ease In Duration", "The default duration over which the clip's weight increases to one.  When clips are overlapped, this is controlled by their overlap.  A clip requires the Blending ClipCap to support this.");
+    readonly GUIContent m_CDEaseInContent = new GUIContent("Ease In Duration", "The default duration over which the clip's weight increases to one.  When clips are overlapped, this is controlled by their overlap.  A clip requires the Blending ClipCap to support this.");
-    readonly GUIContent m_CDEaseOutContent = new GUIContent("Ease Out Duration", "The default duration over which the clip's weight decreases to zero.  When clips are overlapped, this is controlled by their overlap.  A clip requires the Blending ClipCap to support this.");
+    readonly GUIContent m_CDEaseOutContent = new GUIContent("Ease Out Duration", "The default duration over which the clip's weight decreases to zero.  When clips are overlapped, this is controlled by their overlap.  A clip requires the Blending ClipCap to support this.");
-    readonly GUIContent m_CDClipInContent = new GUIContent("Clip In", "The length of time after the start that the clip should start.  A clip requires the ClipIn ClipCap to support this.");
+    readonly GUIContent m_CDClipInContent = new GUIContent("Clip In", "The length of time after the start that the clip should start.  A clip requires the ClipIn ClipCap to support this.");
-    readonly GUIContent m_CDSpeedMultiplierContent = new GUIContent("Speed Multiplier", "The amount a clip's time dependent aspects will speed up or slow down by.  A clip requires the SpeedMultiplier ClipCap to support this.");
+    readonly GUIContent m_CDSpeedMultiplierContent = new GUIContent("Speed Multiplier", "The amount a clip's time dependent aspects will speed up or slow down by.  A clip requires the SpeedMultiplier ClipCap to support this.");
-    */
+    */
-    const string k_Tab = "    ";
+    const string k_Tab = "    ";
-    const string k_ShowHelpBoxesKey = "TimelinePlayableWizard_ShowHelpBoxes";
+    const string k_ShowHelpBoxesKey = "TimelinePlayableWizard_ShowHelpBoxes";
-    const string k_TimelineClipAssetSuffix = "Clip";
+    const string k_TimelineClipAssetSuffix = "Clip";
-    const string k_TimelineClipBehaviourSuffix = "Behaviour";
+    const string k_TimelineClipBehaviourSuffix = "Behaviour";
-    const string k_PlayableBehaviourMixerSuffix = "MixerBehaviour";
+    const string k_PlayableBehaviourMixerSuffix = "MixerBehaviour";
-    const string k_TrackAssetSuffix = "Track";
+    const string k_TrackAssetSuffix = "Track";
-    const string k_PropertyDrawerSuffix = "Drawer";
+    const string k_PropertyDrawerSuffix = "Drawer";
-    const int k_PlayableNameCharLimit = 64;
+    const int k_PlayableNameCharLimit = 64;
-    const float k_WindowWidth = 500f;
+    const float k_WindowWidth = 500f;
-    const float k_MaxWindowHeight = 800f;
+    const float k_MaxWindowHeight = 800f;
-    const float k_ScreenSizeWindowBuffer = 50f;
+    const float k_ScreenSizeWindowBuffer = 50f;
-
+
-    static UsableType[] s_ComponentTypes;
+    static UsableType[] s_ComponentTypes;
-    static UsableType[] s_TrackBindingTypes;
+    static UsableType[] s_TrackBindingTypes;
-    static UsableType[] s_ExposedReferenceTypes;
+    static UsableType[] s_ExposedReferenceTypes;
-    static UsableType[] s_BehaviourVariableTypes;
+    static UsableType[] s_BehaviourVariableTypes;
-    static Type[] s_BlendableTypes =
+    static Type[] s_BlendableTypes =
-    {
+    {
-        typeof(float), typeof(int), typeof(double), typeof(Vector2), typeof(Vector3), typeof(Color), 
+        typeof(float), typeof(int), typeof(double), typeof(Vector2), typeof(Vector3), typeof(Color), 
-    };
+    };
-    static Type[] s_AssignableTypes =
+    static Type[] s_AssignableTypes =
-    {
+    {
-        typeof(string), typeof(bool)
+        typeof(string), typeof(bool)
-    };
+    };
-    static string[] s_DisallowedPropertyNames =
+    static string[] s_DisallowedPropertyNames =
-    {
+    {
-        "name",
+        "name",
-    };
+    };
-
+
-    [MenuItem("Window/Timeline Playable Wizard...")]
+    [MenuItem("Window/Timeline Playable Wizard...")]
-    static void CreateWindow ()
+    static void CreateWindow ()
-    {
+    {
-        TimelinePlayableWizard wizard = GetWindow<TimelinePlayableWizard>(true, "Timeline Playable Wizard", true);
+        TimelinePlayableWizard wizard = GetWindow<TimelinePlayableWizard>(true, "Timeline Playable Wizard", true);
-        
+        
-        Vector2 position = Vector2.zero;
+        Vector2 position = Vector2.zero;
-        SceneView sceneView = SceneView.lastActiveSceneView;
+        SceneView sceneView = SceneView.lastActiveSceneView;
-        if (sceneView != null)
+        if (sceneView != null)
-            position = new Vector2(sceneView.position.x, sceneView.position.y);
+            position = new Vector2(sceneView.position.x, sceneView.position.y);
-        wizard.position = new Rect(position.x + k_ScreenSizeWindowBuffer, position.y + k_ScreenSizeWindowBuffer, k_WindowWidth, Mathf.Min(Screen.currentResolution.height - k_ScreenSizeWindowBuffer, k_MaxWindowHeight));
+        wizard.position = new Rect(position.x + k_ScreenSizeWindowBuffer, position.y + k_ScreenSizeWindowBuffer, k_WindowWidth, Mathf.Min(Screen.currentResolution.height - k_ScreenSizeWindowBuffer, k_MaxWindowHeight));
-        
+        
-        wizard.showHelpBoxes = EditorPrefs.GetBool (k_ShowHelpBoxesKey);
+        wizard.showHelpBoxes = EditorPrefs.GetBool (k_ShowHelpBoxesKey);
-        wizard.Show();
+        wizard.Show();
-        
+        
-        Init ();
+        Init ();
-    }
+    }
-
+
-    static void Init ()
+    static void Init ()
-    {
+    {
-        Type[] componentTypes = AppDomain.CurrentDomain.GetAssemblies().SelectMany(a => a.GetTypes()).Where(t => typeof(Component).IsAssignableFrom(t)).Where (t => t.IsPublic).ToArray();
+        Type[] componentTypes = AppDomain.CurrentDomain.GetAssemblies().SelectMany(a => a.GetTypes()).Where(t => typeof(Component).IsAssignableFrom(t)).Where (t => t.IsPublic).ToArray();
-        
+        
-        List<UsableType> componentUsableTypesList = UsableType.GetUsableTypeArray(componentTypes).ToList();
+        List<UsableType> componentUsableTypesList = UsableType.GetUsableTypeArray(componentTypes).ToList();
-        componentUsableTypesList.Sort();
+        componentUsableTypesList.Sort();
-        s_ComponentTypes = componentUsableTypesList.ToArray ();
+        s_ComponentTypes = componentUsableTypesList.ToArray ();
-
+
-        UsableType gameObjectUsableType = new UsableType(typeof(GameObject));
+        UsableType gameObjectUsableType = new UsableType(typeof(GameObject));
-        UsableType[] defaultUsableTypes = UsableType.GetUsableTypeArray(componentTypes, gameObjectUsableType);
+        UsableType[] defaultUsableTypes = UsableType.GetUsableTypeArray(componentTypes, gameObjectUsableType);
-
+
-        List<UsableType> exposedRefTypeList = defaultUsableTypes.ToList ();
+        List<UsableType> exposedRefTypeList = defaultUsableTypes.ToList ();
-        exposedRefTypeList.Sort();
+        exposedRefTypeList.Sort();
-        s_ExposedReferenceTypes = exposedRefTypeList.ToArray();
+        s_ExposedReferenceTypes = exposedRefTypeList.ToArray();
-
+
-        UsableType noneType = new UsableType((Type)null);
+        UsableType noneType = new UsableType((Type)null);
-        s_TrackBindingTypes = UsableType.AmalgamateUsableTypes(s_ExposedReferenceTypes, noneType);
+        s_TrackBindingTypes = UsableType.AmalgamateUsableTypes(s_ExposedReferenceTypes, noneType);
-
+
-        s_BehaviourVariableTypes = UsableType.AmalgamateUsableTypes
+        s_BehaviourVariableTypes = UsableType.AmalgamateUsableTypes
-            (
+            (
-                s_ExposedReferenceTypes,
+                s_ExposedReferenceTypes,
-                new UsableType("int"),
+                new UsableType("int"),
-                new UsableType("bool"),
+                new UsableType("bool"),
-                new UsableType("float"),
+                new UsableType("float"),
-                new UsableType("Color"),
+                new UsableType("Color"),
-                new UsableType("double"),
+                new UsableType("double"),
-                new UsableType("string"),
+                new UsableType("string"),
-                new UsableType("Vector2"),
+                new UsableType("Vector2"),
-                new UsableType("Vector3"),
+                new UsableType("Vector3"),
-                new UsableType("AudioClip"),
+                new UsableType("AudioClip"),
-                new UsableType("AnimationCurve")
+                new UsableType("AnimationCurve")
-            );
+            );
-        List<UsableType> scriptVariableTypeList = s_BehaviourVariableTypes.ToList();
+        List<UsableType> scriptVariableTypeList = s_BehaviourVariableTypes.ToList();
-        scriptVariableTypeList.Sort();
+        scriptVariableTypeList.Sort();
-        s_BehaviourVariableTypes = scriptVariableTypeList.ToArray();
+        s_BehaviourVariableTypes = scriptVariableTypeList.ToArray();
-    }
+    }
-
+
-    void OnGUI ()
+    void OnGUI ()
-    {
+    {
-        if(s_ComponentTypes == null || s_TrackBindingTypes == null || s_ExposedReferenceTypes == null || s_BehaviourVariableTypes == null)
+        if(s_ComponentTypes == null || s_TrackBindingTypes == null || s_ExposedReferenceTypes == null || s_BehaviourVariableTypes == null)
-            Init ();
+            Init ();
-
+
-        if (s_ComponentTypes == null || s_TrackBindingTypes == null || s_ExposedReferenceTypes == null || s_BehaviourVariableTypes == null)
+        if (s_ComponentTypes == null || s_TrackBindingTypes == null || s_ExposedReferenceTypes == null || s_BehaviourVariableTypes == null)
-        {
+        {
-            EditorGUILayout.HelpBox ("Failed to initialise.", MessageType.Error);
+            EditorGUILayout.HelpBox ("Failed to initialise.", MessageType.Error);
-            return;
+            return;
-        }
+        }
-
+
-        m_ScrollViewPos = EditorGUILayout.BeginScrollView (m_ScrollViewPos);
+        m_ScrollViewPos = EditorGUILayout.BeginScrollView (m_ScrollViewPos);
-
+
-        bool oldShowHelpBoxes = showHelpBoxes;
+        bool oldShowHelpBoxes = showHelpBoxes;
-        showHelpBoxes = EditorGUILayout.Toggle (m_ShowHelpBoxesContent, showHelpBoxes);
+        showHelpBoxes = EditorGUILayout.Toggle (m_ShowHelpBoxesContent, showHelpBoxes);
-        if (oldShowHelpBoxes != showHelpBoxes)
+        if (oldShowHelpBoxes != showHelpBoxes)
-        {
+        {
-            EditorPrefs.SetBool (k_ShowHelpBoxesKey, showHelpBoxes);
+            EditorPrefs.SetBool (k_ShowHelpBoxesKey, showHelpBoxes);
-            EditorGUILayout.Space ();
+            EditorGUILayout.Space ();
-        }
+        }
-
+
-        if (showHelpBoxes)
+        if (showHelpBoxes)
-        {
+        {
-            EditorGUILayout.HelpBox("This wizard is used to create the basics of a custom playable for the Timeline. "
+            EditorGUILayout.HelpBox("This wizard is used to create the basics of a custom playable for the Timeline. "
-                               + "It will create 4 scripts that you can then edit to complete their functionality. "
+                               + "It will create 4 scripts that you can then edit to complete their functionality. "
-                               + "The purpose is to setup the boilerplate code for you.  If you are already familiar "
+                               + "The purpose is to setup the boilerplate code for you.  If you are already familiar "
-                               + "with playables and the Timeline, you may wish to create your own scripts instead.", MessageType.None);
+                               + "with playables and the Timeline, you may wish to create your own scripts instead.", MessageType.None);
-            EditorGUILayout.Space();
+            EditorGUILayout.Space();
-        }
+        }
-
+
-        EditorGUILayout.Space ();
+        EditorGUILayout.Space ();
-        EditorGUILayout.Space();
+        EditorGUILayout.Space();
-
+
-        EditorGUILayout.BeginVertical (GUI.skin.box);
+        EditorGUILayout.BeginVertical (GUI.skin.box);
-        if (showHelpBoxes)
+        if (showHelpBoxes)
-        {
+        {
-            EditorGUILayout.HelpBox(m_PlayableNameContent.tooltip, MessageType.Info);
+            EditorGUILayout.HelpBox(m_PlayableNameContent.tooltip, MessageType.Info);
-            EditorGUILayout.Space();
+            EditorGUILayout.Space();
-        }
+        }
-        playableName = EditorGUILayout.TextField (m_PlayableNameContent, playableName);
+        playableName = EditorGUILayout.TextField (m_PlayableNameContent, playableName);
-
+
-        bool playableNameNotEmpty = !string.IsNullOrEmpty (playableName);
+        bool playableNameNotEmpty = !string.IsNullOrEmpty (playableName);
-        bool playableNameFormatted = CodeGenerator.IsValidLanguageIndependentIdentifier(playableName);
+        bool playableNameFormatted = CodeGenerator.IsValidLanguageIndependentIdentifier(playableName);
-        if (!playableNameNotEmpty || !playableNameFormatted)
+        if (!playableNameNotEmpty || !playableNameFormatted)
-        {
+        {
-            EditorGUILayout.HelpBox ("The Playable needs a name which starts with a capital letter and contains no spaces or special characters.", MessageType.Error);
+            EditorGUILayout.HelpBox ("The Playable needs a name which starts with a capital letter and contains no spaces or special characters.", MessageType.Error);
-        }
+        }
-        bool playableNameTooLong = playableName.Length > k_PlayableNameCharLimit;
+        bool playableNameTooLong = playableName.Length > k_PlayableNameCharLimit;
-        if (playableNameTooLong)
+        if (playableNameTooLong)
-        {
+        {
-            EditorGUILayout.HelpBox ("The Playable needs a name which is fewer than " + k_PlayableNameCharLimit + " characters long.", MessageType.Error);
+            EditorGUILayout.HelpBox ("The Playable needs a name which is fewer than " + k_PlayableNameCharLimit + " characters long.", MessageType.Error);
-        }
+        }
-        EditorGUILayout.EndVertical ();
+        EditorGUILayout.EndVertical ();
-
+
-        EditorGUILayout.Space();
+        EditorGUILayout.Space();
-        EditorGUILayout.Space();
+        EditorGUILayout.Space();
-
+
-        EditorGUILayout.BeginVertical(GUI.skin.box);
+        EditorGUILayout.BeginVertical(GUI.skin.box);
-        if(showHelpBoxes)
+        if(showHelpBoxes)
-        {
+        {
-            EditorGUILayout.HelpBox(m_StandardBlendPlayableContent.tooltip, MessageType.Info);
+            EditorGUILayout.HelpBox(m_StandardBlendPlayableContent.tooltip, MessageType.Info);
-            EditorGUILayout.Space();
+            EditorGUILayout.Space();
-        }
+        }
-        bool oldStandardBlendPlayable = isStandardBlendPlayable;
+        bool oldStandardBlendPlayable = isStandardBlendPlayable;
-        isStandardBlendPlayable = EditorGUILayout.Toggle (m_StandardBlendPlayableContent, isStandardBlendPlayable);
+        isStandardBlendPlayable = EditorGUILayout.Toggle (m_StandardBlendPlayableContent, isStandardBlendPlayable);
-        EditorGUILayout.EndVertical ();
+        EditorGUILayout.EndVertical ();
-
+
-        EditorGUILayout.Space();
+        EditorGUILayout.Space();
-        EditorGUILayout.Space();
+        EditorGUILayout.Space();
-
+
-        EditorGUILayout.BeginVertical(GUI.skin.box);
+        EditorGUILayout.BeginVertical(GUI.skin.box);
-        if(showHelpBoxes)
+        if(showHelpBoxes)
-        {
+        {
-            EditorGUILayout.HelpBox(m_TrackBindingTypeContent.tooltip, MessageType.Info);
+            EditorGUILayout.HelpBox(m_TrackBindingTypeContent.tooltip, MessageType.Info);
-            EditorGUILayout.Space();
+            EditorGUILayout.Space();
-        }
+        }
-        int oldIndex = -1;
+        int oldIndex = -1;
-        if (isStandardBlendPlayable)
+        if (isStandardBlendPlayable)
-        {
+        {
-            oldIndex = m_ComponentBindingTypeIndex;
+            oldIndex = m_ComponentBindingTypeIndex;
-
+
-            m_ComponentBindingTypeIndex = EditorGUILayout.Popup (m_TrackBindingTypeContent, m_ComponentBindingTypeIndex, UsableType.GetGUIContentWithSortingArray (s_ComponentTypes));
+            m_ComponentBindingTypeIndex = EditorGUILayout.Popup (m_TrackBindingTypeContent, m_ComponentBindingTypeIndex, UsableType.GetGUIContentWithSortingArray (s_ComponentTypes));
-            trackBinding = s_ComponentTypes[m_ComponentBindingTypeIndex];
+            trackBinding = s_ComponentTypes[m_ComponentBindingTypeIndex];
-
+
-            EditorGUILayout.Space ();
+            EditorGUILayout.Space ();
-
+
-            defaultValuesComponent = EditorGUILayout.ObjectField (m_DefaultValuesComponentContent, defaultValuesComponent, trackBinding.type, true) as Component;
+            defaultValuesComponent = EditorGUILayout.ObjectField (m_DefaultValuesComponentContent, defaultValuesComponent, trackBinding.type, true) as Component;
-        }
+        }
-        else
+        else
-        {
+        {
-            m_TrackBindingTypeIndex = EditorGUILayout.Popup(m_TrackBindingTypeContent, m_TrackBindingTypeIndex, UsableType.GetGUIContentWithSortingArray(s_TrackBindingTypes));
+            m_TrackBindingTypeIndex = EditorGUILayout.Popup(m_TrackBindingTypeContent, m_TrackBindingTypeIndex, UsableType.GetGUIContentWithSortingArray(s_TrackBindingTypes));
-            trackBinding = s_TrackBindingTypes[m_TrackBindingTypeIndex];
+            trackBinding = s_TrackBindingTypes[m_TrackBindingTypeIndex];
-        }
+        }
-        EditorGUILayout.EndVertical ();
+        EditorGUILayout.EndVertical ();
-        
+        
-        bool exposedVariablesNamesValid = true;
+        bool exposedVariablesNamesValid = true;
-        bool scriptVariablesNamesValid = true;
+        bool scriptVariablesNamesValid = true;
-        bool allUniqueVariableNames = true;
+        bool allUniqueVariableNames = true;
-        
+        
-        EditorGUILayout.Space();
+        EditorGUILayout.Space();
-        EditorGUILayout.Space();
+        EditorGUILayout.Space();
-
+
-        if (isStandardBlendPlayable)
+        if (isStandardBlendPlayable)
-        {
+        {
-            StandardBlendPlayablePropertyGUI(oldIndex != m_ComponentBindingTypeIndex || oldStandardBlendPlayable != isStandardBlendPlayable);
+            StandardBlendPlayablePropertyGUI(oldIndex != m_ComponentBindingTypeIndex || oldStandardBlendPlayable != isStandardBlendPlayable);
-        }
+        }
-        else
+        else
-        {
+        {
-            exposedVariablesNamesValid = VariableListGUI(exposedReferences, s_ExposedReferenceTypes, m_ExposedReferencesContent, "newExposedReference");
+            exposedVariablesNamesValid = VariableListGUI(exposedReferences, s_ExposedReferenceTypes, m_ExposedReferencesContent, "newExposedReference");
-
+
-            EditorGUILayout.Space();
+            EditorGUILayout.Space();
-            EditorGUILayout.Space();
+            EditorGUILayout.Space();
-
+
-            scriptVariablesNamesValid = VariableListGUI(playableBehaviourVariables, s_BehaviourVariableTypes, m_BehaviourVariablesContent, "newBehaviourVariable");
+            scriptVariablesNamesValid = VariableListGUI(playableBehaviourVariables, s_BehaviourVariableTypes, m_BehaviourVariablesContent, "newBehaviourVariable");
-
+
-            EditorGUILayout.Space();
+            EditorGUILayout.Space();
-            EditorGUILayout.Space();
+            EditorGUILayout.Space();
-
+
-            allUniqueVariableNames = AllVariablesUniquelyNamed();
+            allUniqueVariableNames = AllVariablesUniquelyNamed();
-            if (!allUniqueVariableNames)
+            if (!allUniqueVariableNames)
-            {
+            {
-                EditorGUILayout.HelpBox("Your variables to not have unique names.  Make sure all of your Exposed References and Behaviour Variables have unique names.", MessageType.Error);
+                EditorGUILayout.HelpBox("Your variables to not have unique names.  Make sure all of your Exposed References and Behaviour Variables have unique names.", MessageType.Error);
-            }
+            }
-
+
-            EditorGUILayout.Space();
+            EditorGUILayout.Space();
-            EditorGUILayout.Space();
+            EditorGUILayout.Space();
-
+
-            ClipCapsGUI();
+            ClipCapsGUI();
-        }
+        }
-
+
-        EditorGUILayout.Space();
+        EditorGUILayout.Space();
-        EditorGUILayout.Space();
+        EditorGUILayout.Space();
-
+
-        /*ClipDefaultsGUI ();
+        /*ClipDefaultsGUI ();
-
+
-        EditorGUILayout.Space ();
+        EditorGUILayout.Space ();
-        EditorGUILayout.Space ();*/
+        EditorGUILayout.Space ();*/
-
+
-        EditorGUILayout.BeginVertical(GUI.skin.box);
+        EditorGUILayout.BeginVertical(GUI.skin.box);
-        if (showHelpBoxes)
+        if (showHelpBoxes)
-        {
+        {
-            EditorGUILayout.HelpBox(m_TrackColorContent.tooltip, MessageType.Info);
+            EditorGUILayout.HelpBox(m_TrackColorContent.tooltip, MessageType.Info);
-            EditorGUILayout.Space();
+            EditorGUILayout.Space();
-        }
+        }
-        trackColor = EditorGUILayout.ColorField(m_TrackColorContent, trackColor);
+        trackColor = EditorGUILayout.ColorField(m_TrackColorContent, trackColor);
-        EditorGUILayout.EndVertical ();
+        EditorGUILayout.EndVertical ();
-
+
-        if (!isStandardBlendPlayable)
+        if (!isStandardBlendPlayable)
-        {
+        {
-            EditorGUILayout.Space();
+            EditorGUILayout.Space();
-            EditorGUILayout.Space();
+            EditorGUILayout.Space();
-
+
-            EditorGUILayout.BeginVertical(GUI.skin.box);
+            EditorGUILayout.BeginVertical(GUI.skin.box);
-            if (showHelpBoxes)
+            if (showHelpBoxes)
-            {
+            {
-                EditorGUILayout.HelpBox(m_CreateDrawerContent.tooltip, MessageType.Info);
+                EditorGUILayout.HelpBox(m_CreateDrawerContent.tooltip, MessageType.Info);
-                EditorGUILayout.Space();
+                EditorGUILayout.Space();
-            }
+            }
-            m_CreateDrawer = EditorGUILayout.Toggle(m_CreateDrawerContent, m_CreateDrawer);
+            m_CreateDrawer = EditorGUILayout.Toggle(m_CreateDrawerContent, m_CreateDrawer);
-            EditorGUILayout.EndVertical ();
+            EditorGUILayout.EndVertical ();
-        }
+        }
-
+
-        EditorGUILayout.Space();
+        EditorGUILayout.Space();
-        EditorGUILayout.Space();
+        EditorGUILayout.Space();
-        
+        
-        if (playableNameNotEmpty && playableNameFormatted && allUniqueVariableNames && exposedVariablesNamesValid && scriptVariablesNamesValid && !playableNameTooLong)
+        if (playableNameNotEmpty && playableNameFormatted && allUniqueVariableNames && exposedVariablesNamesValid && scriptVariablesNamesValid && !playableNameTooLong)
-        {
+        {
-            if (GUILayout.Button("Create", GUILayout.Width(60f)))
+            if (GUILayout.Button("Create", GUILayout.Width(60f)))
-            {
+            {
-                m_CreateButtonPressed = true;
+                m_CreateButtonPressed = true;
-
+
-                for (int i = 0; i < standardBlendPlayableProperties.Count; i++)
+                for (int i = 0; i < standardBlendPlayableProperties.Count; i++)
-                {
+                {
-                    standardBlendPlayableProperties[i].CreateSettingDefaultValueString (defaultValuesComponent);
+                    standardBlendPlayableProperties[i].CreateSettingDefaultValueString (defaultValuesComponent);
-                }
+                }
-
+
-                m_CreationError = CreateScripts();
+                m_CreationError = CreateScripts();
-
+
-                if (m_CreationError == CreationError.NoError)
+                if (m_CreationError == CreationError.NoError)
-                {
+                {
-                    Close ();
+                    Close ();
-                }
+                }
-            }
+            }
-        }
+        }
-
+
-        EditorGUILayout.Space();
+        EditorGUILayout.Space();
-        EditorGUILayout.Space();
+        EditorGUILayout.Space();
-        
+        
-        if (m_CreateButtonPressed)
+        if (m_CreateButtonPressed)
-        {
+        {
-            switch (m_CreationError)
+            switch (m_CreationError)
-            {
+            {
-                case CreationError.NoError:
+                case CreationError.NoError:
-                    EditorGUILayout.HelpBox ("Playable was successfully created.", MessageType.Info);
+                    EditorGUILayout.HelpBox ("Playable was successfully created.", MessageType.Info);
-                    break;
+                    break;
-                case CreationError.PlayableAssetAlreadyExists:
+                case CreationError.PlayableAssetAlreadyExists:
-                    EditorGUILayout.HelpBox ("The type " + playableName + k_TimelineClipAssetSuffix + " already exists, no files were created.", MessageType.Error);
+                    EditorGUILayout.HelpBox ("The type " + playableName + k_TimelineClipAssetSuffix + " already exists, no files were created.", MessageType.Error);
-                    break;
+                    break;
-                case CreationError.PlayableBehaviourAlreadyExists:
+                case CreationError.PlayableBehaviourAlreadyExists:
-                    EditorGUILayout.HelpBox ("The type " + playableName + k_TimelineClipBehaviourSuffix + " already exists, no files were created.", MessageType.Error);
+                    EditorGUILayout.HelpBox ("The type " + playableName + k_TimelineClipBehaviourSuffix + " already exists, no files were created.", MessageType.Error);
-                    break;
+                    break;
-                case CreationError.PlayableBehaviourMixerAlreadyExists:
+                case CreationError.PlayableBehaviourMixerAlreadyExists:
-                    EditorGUILayout.HelpBox ("The type " + playableName + k_PlayableBehaviourMixerSuffix + " already exists, no files were created.", MessageType.Error);
+                    EditorGUILayout.HelpBox ("The type " + playableName + k_PlayableBehaviourMixerSuffix + " already exists, no files were created.", MessageType.Error);
-                    break;
+                    break;
-                case CreationError.TrackAssetAlreadyExists:
+                case CreationError.TrackAssetAlreadyExists:
-                    EditorGUILayout.HelpBox ("The type " + playableName + k_TrackAssetSuffix + " already exists, no files were created.", MessageType.Error);
+                    EditorGUILayout.HelpBox ("The type " + playableName + k_TrackAssetSuffix + " already exists, no files were created.", MessageType.Error);
-                    break;
+                    break;
-                case CreationError.PlayableDrawerAlreadyExists:
+                case CreationError.PlayableDrawerAlreadyExists:
-                    EditorGUILayout.HelpBox ("The type " + playableName + k_PropertyDrawerSuffix + " already exists, no files were created.", MessageType.Error);
+                    EditorGUILayout.HelpBox ("The type " + playableName + k_PropertyDrawerSuffix + " already exists, no files were created.", MessageType.Error);
-                    break;
+                    break;
-            }
+            }
-        }
+        }
-
+
-        if (GUILayout.Button ("Reset", GUILayout.Width (60f)))
+        if (GUILayout.Button ("Reset", GUILayout.Width (60f)))
-        {
+        {
-            ResetWindow ();
+            ResetWindow ();
-        }
+        }
-
+
-        EditorGUILayout.EndScrollView ();
+        EditorGUILayout.EndScrollView ();
-    }
+    }
-
+
-    void StandardBlendPlayablePropertyGUI (bool findNewProperties)
+    void StandardBlendPlayablePropertyGUI (bool findNewProperties)
-    {
+    {
-        if (findNewProperties || m_TrackBindingProperties == null && m_TrackBindingFields == null)
+        if (findNewProperties || m_TrackBindingProperties == null && m_TrackBindingFields == null)
-        {
+        {
-            m_TrackBindingUsableProperties.Clear ();
+            m_TrackBindingUsableProperties.Clear ();
-            
+            
-            IEnumerable<PropertyInfo> propertyInfos = trackBinding.type.GetProperties (BindingFlags.Instance | BindingFlags.Public | BindingFlags.SetProperty | BindingFlags.GetProperty);
+            IEnumerable<PropertyInfo> propertyInfos = trackBinding.type.GetProperties (BindingFlags.Instance | BindingFlags.Public | BindingFlags.SetProperty | BindingFlags.GetProperty);
-            propertyInfos = propertyInfos.Where (x => IsTypeBlendable(x.PropertyType) || IsTypeAssignable(x.PropertyType));
+            propertyInfos = propertyInfos.Where (x => IsTypeBlendable(x.PropertyType) || IsTypeAssignable(x.PropertyType));
-            propertyInfos = propertyInfos.Where (x => x.CanWrite && x.CanRead);
+            propertyInfos = propertyInfos.Where (x => x.CanWrite && x.CanRead);
-            propertyInfos = propertyInfos.Where (x => HasAllowedName (x));
+            propertyInfos = propertyInfos.Where (x => HasAllowedName (x));
-            // Uncomment the below to stop Obsolete properties being selectable.
+            // Uncomment the below to stop Obsolete properties being selectable.
-            //propertyInfos = propertyInfos.Where (x => !Attribute.IsDefined (x, typeof(ObsoleteAttribute)));
+            //propertyInfos = propertyInfos.Where (x => !Attribute.IsDefined (x, typeof(ObsoleteAttribute)));
-            m_TrackBindingProperties = propertyInfos.ToArray();
+            m_TrackBindingProperties = propertyInfos.ToArray();
-            foreach (PropertyInfo trackBindingProperty in m_TrackBindingProperties)
+            foreach (PropertyInfo trackBindingProperty in m_TrackBindingProperties)
-            {
+            {
-                m_TrackBindingUsableProperties.Add (new UsableProperty (trackBindingProperty));
+                m_TrackBindingUsableProperties.Add (new UsableProperty (trackBindingProperty));
-            }
+            }
-            
+            
-            IEnumerable<FieldInfo> fieldInfos = trackBinding.type.GetFields (BindingFlags.Instance | BindingFlags.Public);
+            IEnumerable<FieldInfo> fieldInfos = trackBinding.type.GetFields (BindingFlags.Instance | BindingFlags.Public);
-            fieldInfos = fieldInfos.Where(x => IsTypeBlendable(x.FieldType) || IsTypeAssignable(x.FieldType));
+            fieldInfos = fieldInfos.Where(x => IsTypeBlendable(x.FieldType) || IsTypeAssignable(x.FieldType));
-            m_TrackBindingFields = fieldInfos.ToArray ();
+            m_TrackBindingFields = fieldInfos.ToArray ();
-            foreach (FieldInfo trackBindingField in m_TrackBindingFields)
+            foreach (FieldInfo trackBindingField in m_TrackBindingFields)
-            {
+            {
-                m_TrackBindingUsableProperties.Add (new UsableProperty (trackBindingField));
+                m_TrackBindingUsableProperties.Add (new UsableProperty (trackBindingField));
-            }
+            }
-
+
-            m_TrackBindingUsableProperties = m_TrackBindingUsableProperties.OrderBy (x => x.name).ToList ();
+            m_TrackBindingUsableProperties = m_TrackBindingUsableProperties.OrderBy (x => x.name).ToList ();
-            standardBlendPlayableProperties.Clear ();
+            standardBlendPlayableProperties.Clear ();
-        }
+        }
-
+
-        EditorGUILayout.BeginVertical (GUI.skin.box);
+        EditorGUILayout.BeginVertical (GUI.skin.box);
-
+
-        if (showHelpBoxes)
+        if (showHelpBoxes)
-        {
+        {
-            EditorGUILayout.HelpBox(m_StandardBlendPlayablePropertiesContent.tooltip, MessageType.Info);
+            EditorGUILayout.HelpBox(m_StandardBlendPlayablePropertiesContent.tooltip, MessageType.Info);
-            EditorGUILayout.Space();
+            EditorGUILayout.Space();
-        }
+        }
-
+
-        EditorGUILayout.LabelField(m_StandardBlendPlayablePropertiesContent);
+        EditorGUILayout.LabelField(m_StandardBlendPlayablePropertiesContent);
-
+
-        int indexToRemove = -1;
+        int indexToRemove = -1;
-        for (int i = 0; i < standardBlendPlayableProperties.Count; i++)
+        for (int i = 0; i < standardBlendPlayableProperties.Count; i++)
-        {
+        {
-            if (standardBlendPlayableProperties[i].GUI(m_TrackBindingUsableProperties))
+            if (standardBlendPlayableProperties[i].GUI(m_TrackBindingUsableProperties))
-                indexToRemove = i;
+                indexToRemove = i;
-        }
+        }
-        if (indexToRemove != -1)
+        if (indexToRemove != -1)
-            standardBlendPlayableProperties.RemoveAt(indexToRemove);
+            standardBlendPlayableProperties.RemoveAt(indexToRemove);
-
+
-        if (GUILayout.Button("Add", GUILayout.Width(40f)))
+        if (GUILayout.Button("Add", GUILayout.Width(40f)))
-            standardBlendPlayableProperties.Add(m_TrackBindingUsableProperties[0].GetDuplicate ());
+            standardBlendPlayableProperties.Add(m_TrackBindingUsableProperties[0].GetDuplicate ());
-
+
-        if (standardBlendPlayableProperties.Any(IsObsolete))
+        if (standardBlendPlayableProperties.Any(IsObsolete))
-            EditorGUILayout.HelpBox ("One or more of your chosen properties are marked 'Obsolete'.  Consider changing them to avoid deprecation with future versions of Unity.", MessageType.Warning);
+            EditorGUILayout.HelpBox ("One or more of your chosen properties are marked 'Obsolete'.  Consider changing them to avoid deprecation with future versions of Unity.", MessageType.Warning);
-
+
-        EditorGUILayout.EndVertical ();
+        EditorGUILayout.EndVertical ();
-    }
+    }
-
+
-    static bool IsTypeBlendable (Type type)
+    static bool IsTypeBlendable (Type type)
-    {
+    {
-        for (int i = 0; i < s_BlendableTypes.Length; i++)
+        for (int i = 0; i < s_BlendableTypes.Length; i++)
-        {
+        {
-            if (type == s_BlendableTypes[i])
+            if (type == s_BlendableTypes[i])
-                return true;
+                return true;
-        }
+        }
-        return false;
+        return false;
-    }
+    }
-
+
-    static bool IsTypeAssignable (Type type)
+    static bool IsTypeAssignable (Type type)
-    {
+    {
-        for (int i = 0; i < s_AssignableTypes.Length; i++)
+        for (int i = 0; i < s_AssignableTypes.Length; i++)
-        {
+        {
-            if (type == s_AssignableTypes[i] || type.IsEnum)
+            if (type == s_AssignableTypes[i] || type.IsEnum)
-                return true;
+                return true;
-        }
+        }
-        return false;
+        return false;
-    }
+    }
-
+
-    static bool HasAllowedName (PropertyInfo propertyInfo)
+    static bool HasAllowedName (PropertyInfo propertyInfo)
-    {
+    {
-        for (int i = 0; i < s_DisallowedPropertyNames.Length; i++)
+        for (int i = 0; i < s_DisallowedPropertyNames.Length; i++)
-        {
+        {
-            if (propertyInfo.Name == s_DisallowedPropertyNames[i])
+            if (propertyInfo.Name == s_DisallowedPropertyNames[i])
-                return false;
+                return false;
-        }
+        }
-        return true;
+        return true;
-    }
+    }
-
+
-    static bool IsObsolete (UsableProperty usableProperty)
+    static bool IsObsolete (UsableProperty usableProperty)
-    {
+    {
-        if (usableProperty.usablePropertyType == UsableProperty.UsablePropertyType.Field)
+        if (usableProperty.usablePropertyType == UsableProperty.UsablePropertyType.Field)
-            return Attribute.IsDefined (usableProperty.fieldInfo, typeof(ObsoleteAttribute));
+            return Attribute.IsDefined (usableProperty.fieldInfo, typeof(ObsoleteAttribute));
-        return Attribute.IsDefined (usableProperty.propertyInfo, typeof(ObsoleteAttribute));
+        return Attribute.IsDefined (usableProperty.propertyInfo, typeof(ObsoleteAttribute));
-    }
+    }
-
+
-    bool VariableListGUI (List<Variable> variables, UsableType[] usableTypes, GUIContent guiContent, string newName)
+    bool VariableListGUI (List<Variable> variables, UsableType[] usableTypes, GUIContent guiContent, string newName)
-    {
+    {
-        EditorGUILayout.BeginVertical(GUI.skin.box);
+        EditorGUILayout.BeginVertical(GUI.skin.box);
-
+
-        if (showHelpBoxes)
+        if (showHelpBoxes)
-        {
+        {
-            EditorGUILayout.HelpBox(guiContent.tooltip, MessageType.Info);
+            EditorGUILayout.HelpBox(guiContent.tooltip, MessageType.Info);
-            EditorGUILayout.Space();
+            EditorGUILayout.Space();
-        }
+        }
-
+
-        EditorGUILayout.LabelField(guiContent);
+        EditorGUILayout.LabelField(guiContent);
-
+
-        int indexToRemove = -1;
+        int indexToRemove = -1;
-        bool allNamesValid = true;
+        bool allNamesValid = true;
-        for (int i = 0; i < variables.Count; i++)
+        for (int i = 0; i < variables.Count; i++)
-        {
+        {
-            if (variables[i].GUI(usableTypes))
+            if (variables[i].GUI(usableTypes))
-                indexToRemove = i;
+                indexToRemove = i;
-
+
-            if (!CodeGenerator.IsValidLanguageIndependentIdentifier(variables[i].name))
+            if (!CodeGenerator.IsValidLanguageIndependentIdentifier(variables[i].name))
-            {
+            {
-                allNamesValid = false;
+                allNamesValid = false;
-            }
+            }
-        }
+        }
-
+
-        if (indexToRemove != -1)
+        if (indexToRemove != -1)
-            variables.RemoveAt(indexToRemove);
+            variables.RemoveAt(indexToRemove);
-
+
-        if (GUILayout.Button("Add", GUILayout.Width(40f)))
+        if (GUILayout.Button("Add", GUILayout.Width(40f)))
-            variables.Add(new Variable(newName, usableTypes[0]));
+            variables.Add(new Variable(newName, usableTypes[0]));
-
+
-        if (!allNamesValid)
+        if (!allNamesValid)
-            EditorGUILayout.HelpBox("One of the variables has an invalid character, make sure they don't contain any spaces or special characters.", MessageType.Error);
+            EditorGUILayout.HelpBox("One of the variables has an invalid character, make sure they don't contain any spaces or special characters.", MessageType.Error);
-
+
-        EditorGUILayout.EndVertical();
+        EditorGUILayout.EndVertical();
-
+
-        return allNamesValid;
+        return allNamesValid;
-    }
+    }
-
+
-    bool AllVariablesUniquelyNamed ()
+    bool AllVariablesUniquelyNamed ()
-    {
+    {
-        for (int i = 0; i < exposedReferences.Count; i++)
+        for (int i = 0; i < exposedReferences.Count; i++)
-        {
+        {
-            string exposedRefName = exposedReferences[i].name;
+            string exposedRefName = exposedReferences[i].name;
-
+
-            for (int j = 0; j < exposedReferences.Count; j++)
+            for (int j = 0; j < exposedReferences.Count; j++)
-            {
+            {
-                if (i != j && exposedRefName == exposedReferences[j].name)
+                if (i != j && exposedRefName == exposedReferences[j].name)
-                    return false;
+                    return false;
-            }
+            }
-
+
-            for (int j = 0; j < playableBehaviourVariables.Count; j++)
+            for (int j = 0; j < playableBehaviourVariables.Count; j++)
-            {
+            {
-                if (exposedRefName == playableBehaviourVariables[j].name)
+                if (exposedRefName == playableBehaviourVariables[j].name)
-                    return false;
+                    return false;
-            }
+            }
-        }
+        }
-
+
-        for (int i = 0; i < playableBehaviourVariables.Count; i++)
+        for (int i = 0; i < playableBehaviourVariables.Count; i++)
-        {
+        {
-            string scriptPlayableVariableName = playableBehaviourVariables[i].name;
+            string scriptPlayableVariableName = playableBehaviourVariables[i].name;
-
+
-            for (int j = 0; j < exposedReferences.Count; j++)
+            for (int j = 0; j < exposedReferences.Count; j++)
-            {
+            {
-                if (scriptPlayableVariableName == exposedReferences[j].name)
+                if (scriptPlayableVariableName == exposedReferences[j].name)
-                    return false;
+                    return false;
-            }
+            }
-
+
-            for (int j = 0; j < playableBehaviourVariables.Count; j++)
+            for (int j = 0; j < playableBehaviourVariables.Count; j++)
-            {
+            {
-                if (i != j && scriptPlayableVariableName == playableBehaviourVariables[j].name)
+                if (i != j && scriptPlayableVariableName == playableBehaviourVariables[j].name)
-                    return false;
+                    return false;
-            }
+            }
-        }
+        }
-        return true;
+        return true;
-    }
+    }
-
+
-    void ClipCapsGUI ()
+    void ClipCapsGUI ()
-    {
+    {
-        EditorGUILayout.BeginVertical (GUI.skin.box);
+        EditorGUILayout.BeginVertical (GUI.skin.box);
-
+
-        if (showHelpBoxes)
+        if (showHelpBoxes)
-        {
+        {
-            EditorGUILayout.HelpBox(m_ClipCapsContent.tooltip, MessageType.Info);
+            EditorGUILayout.HelpBox(m_ClipCapsContent.tooltip, MessageType.Info);
-            EditorGUILayout.Space();
+            EditorGUILayout.Space();
-        }
+        }
-
+
-        EditorGUILayout.LabelField (m_ClipCapsContent);
+        EditorGUILayout.LabelField (m_ClipCapsContent);
-
+
-        bool isLooping = (clipCaps & ClipCaps.Looping) == ClipCaps.Looping;
+        bool isLooping = (clipCaps & ClipCaps.Looping) == ClipCaps.Looping;
-        bool isExtrapolation = (clipCaps & ClipCaps.Extrapolation) == ClipCaps.Extrapolation;
+        bool isExtrapolation = (clipCaps & ClipCaps.Extrapolation) == ClipCaps.Extrapolation;
-        bool isClipIn = (clipCaps & ClipCaps.ClipIn) == ClipCaps.ClipIn;
+        bool isClipIn = (clipCaps & ClipCaps.ClipIn) == ClipCaps.ClipIn;
-        bool isSpeedMultiplier = (clipCaps & ClipCaps.SpeedMultiplier) == ClipCaps.SpeedMultiplier;
+        bool isSpeedMultiplier = (clipCaps & ClipCaps.SpeedMultiplier) == ClipCaps.SpeedMultiplier;
-        bool isBlending = (clipCaps & ClipCaps.Blending) == ClipCaps.Blending;
+        bool isBlending = (clipCaps & ClipCaps.Blending) == ClipCaps.Blending;
-
+
-        bool isNone = !isLooping && !isExtrapolation && !isClipIn && !isSpeedMultiplier && !isBlending;
+        bool isNone = !isLooping && !isExtrapolation && !isClipIn && !isSpeedMultiplier && !isBlending;
-        bool isAll = isLooping && isExtrapolation && isClipIn && isSpeedMultiplier && isBlending;
+        bool isAll = isLooping && isExtrapolation && isClipIn && isSpeedMultiplier && isBlending;
-
+
-        EditorGUI.BeginChangeCheck ();
+        EditorGUI.BeginChangeCheck ();
-        isNone = EditorGUILayout.ToggleLeft (m_CCNoneContent, isNone);
+        isNone = EditorGUILayout.ToggleLeft (m_CCNoneContent, isNone);
-        if (EditorGUI.EndChangeCheck ())
+        if (EditorGUI.EndChangeCheck ())
-        {
+        {
-            if (isNone)
+            if (isNone)
-            {
+            {
-                isLooping = false;
+                isLooping = false;
-                isExtrapolation = false;
+                isExtrapolation = false;
-                isClipIn = false;
+                isClipIn = false;
-                isSpeedMultiplier = false;
+                isSpeedMultiplier = false;
-                isBlending = false;
+                isBlending = false;
-                isAll = false;
+                isAll = false;
-            }
+            }
-        }
+        }
-
+
-        EditorGUI.BeginChangeCheck ();
+        EditorGUI.BeginChangeCheck ();
-        isLooping = EditorGUILayout.ToggleLeft (m_CCLoopingContent, isLooping);
+        isLooping = EditorGUILayout.ToggleLeft (m_CCLoopingContent, isLooping);
-        isExtrapolation = EditorGUILayout.ToggleLeft (m_CCExtrapolationContent, isExtrapolation);
+        isExtrapolation = EditorGUILayout.ToggleLeft (m_CCExtrapolationContent, isExtrapolation);
-        isClipIn = EditorGUILayout.ToggleLeft (m_CCClipInContent, isClipIn);
+        isClipIn = EditorGUILayout.ToggleLeft (m_CCClipInContent, isClipIn);
-        isSpeedMultiplier = EditorGUILayout.ToggleLeft (m_CCSpeedMultiplierContent, isSpeedMultiplier);
+        isSpeedMultiplier = EditorGUILayout.ToggleLeft (m_CCSpeedMultiplierContent, isSpeedMultiplier);
-        isBlending = EditorGUILayout.ToggleLeft (m_CCBlendingContent, isBlending);
+        isBlending = EditorGUILayout.ToggleLeft (m_CCBlendingContent, isBlending);
-        if (EditorGUI.EndChangeCheck ())
+        if (EditorGUI.EndChangeCheck ())
-        {
+        {
-            isNone = !isLooping && !isExtrapolation && !isClipIn && !isSpeedMultiplier && !isBlending;
+            isNone = !isLooping && !isExtrapolation && !isClipIn && !isSpeedMultiplier && !isBlending;
-            isAll = isLooping && isExtrapolation && isClipIn && isSpeedMultiplier && isBlending;
+            isAll = isLooping && isExtrapolation && isClipIn && isSpeedMultiplier && isBlending;
-        }
+        }
-
+
-        EditorGUI.BeginChangeCheck ();
+        EditorGUI.BeginChangeCheck ();
-        isAll = EditorGUILayout.ToggleLeft (m_CCAllContent, isAll);
+        isAll = EditorGUILayout.ToggleLeft (m_CCAllContent, isAll);
-        if (EditorGUI.EndChangeCheck ())
+        if (EditorGUI.EndChangeCheck ())
-        {
+        {
-            if (isAll)
+            if (isAll)
-            {
+            {
-                isNone = false;
+                isNone = false;
-                isLooping = true;
+                isLooping = true;
-                isExtrapolation = true;
+                isExtrapolation = true;
-                isClipIn = true;
+                isClipIn = true;
-                isSpeedMultiplier = true;
+                isSpeedMultiplier = true;
-                isBlending = true;
+                isBlending = true;
-            }
+            }
-        }
+        }
-
+
-        EditorGUILayout.EndVertical();
+        EditorGUILayout.EndVertical();
-
+
-        clipCaps = ClipCaps.None;
+        clipCaps = ClipCaps.None;
-
+
-        if (isNone)
+        if (isNone)
-            return;
+            return;
-
+
-        if (isAll)
+        if (isAll)
-        {
+        {
-            clipCaps = ClipCaps.All;
+            clipCaps = ClipCaps.All;
-            return;
+            return;
-        }
+        }
-
+
-        if (isLooping)
+        if (isLooping)
-            clipCaps |= ClipCaps.Looping;
+            clipCaps |= ClipCaps.Looping;
-
+
-        if (isExtrapolation)
+        if (isExtrapolation)
-            clipCaps |= ClipCaps.Extrapolation;
+            clipCaps |= ClipCaps.Extrapolation;
-
+
-        if (isClipIn)
+        if (isClipIn)
-            clipCaps |= ClipCaps.ClipIn;
+            clipCaps |= ClipCaps.ClipIn;
-
+
-        if (isSpeedMultiplier)
+        if (isSpeedMultiplier)
-            clipCaps |= ClipCaps.SpeedMultiplier;
+            clipCaps |= ClipCaps.SpeedMultiplier;
-
+
-        if (isBlending)
+        if (isBlending)
-            clipCaps |= ClipCaps.Blending;
+            clipCaps |= ClipCaps.Blending;
-    }
+    }
-
+
-    /*void ClipDefaultsGUI ()
+    /*void ClipDefaultsGUI ()
-    {
+    {
-        EditorGUILayout.BeginVertical (GUI.skin.box);
+        EditorGUILayout.BeginVertical (GUI.skin.box);
-
+
-        setClipDefaults = EditorGUILayout.Toggle (m_SetClipDefaultsContent, setClipDefaults);
+        setClipDefaults = EditorGUILayout.Toggle (m_SetClipDefaultsContent, setClipDefaults);
-
+
-        if (!setClipDefaults)
+        if (!setClipDefaults)
-        {
+        {
-            EditorGUILayout.EndVertical ();
+            EditorGUILayout.EndVertical ();
-            return;
+            return;
-        }
+        }
-
+
-        if (showHelpBoxes)
+        if (showHelpBoxes)
-        {
+        {
-            EditorGUILayout.HelpBox (m_ClipDefaultsContent.tooltip, MessageType.Info);
+            EditorGUILayout.HelpBox (m_ClipDefaultsContent.tooltip, MessageType.Info);
-        }
+        }
-
+
-        EditorGUILayout.LabelField (m_ClipDefaultsContent);
+        EditorGUILayout.LabelField (m_ClipDefaultsContent);
-
+
-        EditorGUILayout.Space ();
+        EditorGUILayout.Space ();
-
+
-        EditorGUILayout.LabelField (m_CDClipTimingContent);
+        EditorGUILayout.LabelField (m_CDClipTimingContent);
-        EditorGUI.indentLevel++;
+        EditorGUI.indentLevel++;
-        clipDefaultDurationSeconds = EditorGUILayout.FloatField(m_CDDurationContent, clipDefaultDurationSeconds);
+        clipDefaultDurationSeconds = EditorGUILayout.FloatField(m_CDDurationContent, clipDefaultDurationSeconds);
-        
+        
-        EditorGUILayout.Space ();
+        EditorGUILayout.Space ();
-        
+        
-        clipDefaultEaseInSeconds = EditorGUILayout.FloatField(m_CDEaseInContent, clipDefaultEaseInSeconds);
+        clipDefaultEaseInSeconds = EditorGUILayout.FloatField(m_CDEaseInContent, clipDefaultEaseInSeconds);
-        clipDefaultEaseOutSeconds = EditorGUILayout.FloatField (m_CDEaseOutContent, clipDefaultEaseOutSeconds);
+        clipDefaultEaseOutSeconds = EditorGUILayout.FloatField (m_CDEaseOutContent, clipDefaultEaseOutSeconds);
-
+
-        if (isStandardBlendPlayable)
+        if (isStandardBlendPlayable)
-        {
+        {
-            EditorGUILayout.EndVertical();
+            EditorGUILayout.EndVertical();
-            return;
+            return;
-        }
+        }
-
+
-        EditorGUILayout.Space();
+        EditorGUILayout.Space();
-        
+        
-        clipDefaultClipInSeconds = EditorGUILayout.FloatField(m_CDClipInContent, clipDefaultClipInSeconds);
+        clipDefaultClipInSeconds = EditorGUILayout.FloatField(m_CDClipInContent, clipDefaultClipInSeconds);
-        
+        
-        EditorGUILayout.Space();
+        EditorGUILayout.Space();
-        
+        
-        clipDefaultSpeedMultiplier = EditorGUILayout.FloatField(m_CDSpeedMultiplierContent, clipDefaultSpeedMultiplier);
+        clipDefaultSpeedMultiplier = EditorGUILayout.FloatField(m_CDSpeedMultiplierContent, clipDefaultSpeedMultiplier);
-        EditorGUI.indentLevel--;
+        EditorGUI.indentLevel--;
-        
+        
-        EditorGUILayout.EndVertical();
+        EditorGUILayout.EndVertical();
-    }*/
+    }*/
-
+
-    CreationError CreateScripts ()
+    CreationError CreateScripts ()
-    {
+    {
-        if (ScriptAlreadyExists(playableName + k_TimelineClipAssetSuffix))
+        if (ScriptAlreadyExists(playableName + k_TimelineClipAssetSuffix))
-            return CreationError.PlayableAssetAlreadyExists;
+            return CreationError.PlayableAssetAlreadyExists;
-
+
-        if (ScriptAlreadyExists(playableName + k_TimelineClipBehaviourSuffix))
+        if (ScriptAlreadyExists(playableName + k_TimelineClipBehaviourSuffix))
-            return CreationError.PlayableBehaviourAlreadyExists;
+            return CreationError.PlayableBehaviourAlreadyExists;
-
+
-        if (ScriptAlreadyExists(playableName + k_PlayableBehaviourMixerSuffix))
+        if (ScriptAlreadyExists(playableName + k_PlayableBehaviourMixerSuffix))
-            return CreationError.PlayableBehaviourMixerAlreadyExists;
+            return CreationError.PlayableBehaviourMixerAlreadyExists;
-
+
-        if (ScriptAlreadyExists(playableName + k_TrackAssetSuffix))
+        if (ScriptAlreadyExists(playableName + k_TrackAssetSuffix))
-            return CreationError.TrackAssetAlreadyExists;
+            return CreationError.TrackAssetAlreadyExists;
-
+
-        if (m_CreateDrawer && ScriptAlreadyExists(playableName + k_PropertyDrawerSuffix))
+        if (m_CreateDrawer && ScriptAlreadyExists(playableName + k_PropertyDrawerSuffix))
-            return CreationError.PlayableDrawerAlreadyExists;
+            return CreationError.PlayableDrawerAlreadyExists;
-
+
-        AssetDatabase.CreateFolder ("Assets", playableName);
+        AssetDatabase.CreateFolder ("Assets", playableName);
-
+
-        if (isStandardBlendPlayable)
+        if (isStandardBlendPlayable)
-        {
+        {
-            CreateScript (playableName + k_TimelineClipAssetSuffix, StandardBlendPlayableAsset());
+            CreateScript (playableName + k_TimelineClipAssetSuffix, StandardBlendPlayableAsset());
-            CreateScript (playableName + k_TimelineClipBehaviourSuffix, StandardBlendPlayableBehaviour ());
+            CreateScript (playableName + k_TimelineClipBehaviourSuffix, StandardBlendPlayableBehaviour ());
-            CreateScript (playableName + k_PlayableBehaviourMixerSuffix, StandardBlendPlayableBehaviourMixer ());
+            CreateScript (playableName + k_PlayableBehaviourMixerSuffix, StandardBlendPlayableBehaviourMixer ());
-            CreateScript (playableName + k_TrackAssetSuffix, StandardBlendTrackAssetScript ());
+            CreateScript (playableName + k_TrackAssetSuffix, StandardBlendTrackAssetScript ());
-
+
-            AssetDatabase.CreateFolder ("Assets/" + playableName, "Editor");
+            AssetDatabase.CreateFolder ("Assets/" + playableName, "Editor");
-
+
-            string path = Application.dataPath + "/" + playableName + "/Editor/" + playableName + k_PropertyDrawerSuffix + ".cs";
+            string path = Application.dataPath + "/" + playableName + "/Editor/" + playableName + k_PropertyDrawerSuffix + ".cs";
-            using (StreamWriter writer = File.CreateText (path))
+            using (StreamWriter writer = File.CreateText (path))
-            {
+            {
-                writer.Write (StandardBlendPlayableDrawer ());
+                writer.Write (StandardBlendPlayableDrawer ());
-            }
+            }
-        }
+        }
-        else
+        else
-        {
+        {
-            CreateScript(playableName + k_TimelineClipAssetSuffix, PlayableAsset());
+            CreateScript(playableName + k_TimelineClipAssetSuffix, PlayableAsset());
-            CreateScript(playableName + k_TimelineClipBehaviourSuffix, PlayableBehaviour());
+            CreateScript(playableName + k_TimelineClipBehaviourSuffix, PlayableBehaviour());
-            CreateScript(playableName + k_PlayableBehaviourMixerSuffix, PlayableBehaviourMixer());
+            CreateScript(playableName + k_PlayableBehaviourMixerSuffix, PlayableBehaviourMixer());
-            CreateScript(playableName + k_TrackAssetSuffix, TrackAssetScript());
+            CreateScript(playableName + k_TrackAssetSuffix, TrackAssetScript());
-
+
-            if (m_CreateDrawer)
+            if (m_CreateDrawer)
-            {
+            {
-                AssetDatabase.CreateFolder("Assets/" + playableName, "Editor");
+                AssetDatabase.CreateFolder("Assets/" + playableName, "Editor");
-
+
-                string path = Application.dataPath + "/" + playableName + "/Editor/" + playableName + k_PropertyDrawerSuffix + ".cs";
+                string path = Application.dataPath + "/" + playableName + "/Editor/" + playableName + k_PropertyDrawerSuffix + ".cs";
-                using (StreamWriter writer = File.CreateText(path))
+                using (StreamWriter writer = File.CreateText(path))
-                {
+                {
-                    writer.Write(PlayableDrawer());
+                    writer.Write(PlayableDrawer());
-                }
+                }
-            }
+            }
-        }
+        }
-
+
-        AssetDatabase.SaveAssets ();
+        AssetDatabase.SaveAssets ();
-        AssetDatabase.Refresh ();
+        AssetDatabase.Refresh ();
-
+
-        return CreationError.NoError;
+        return CreationError.NoError;
-    }
+    }
-
+
-    static bool ScriptAlreadyExists(string scriptName)
+    static bool ScriptAlreadyExists(string scriptName)
-    {
+    {
-        string[] guids = AssetDatabase.FindAssets(scriptName);
+        string[] guids = AssetDatabase.FindAssets(scriptName);
-
+
-        if (guids.Length == 0)
+        if (guids.Length == 0)
-            return false;
+            return false;
-
+
-        for (int i = 0; i < guids.Length; i++)
+        for (int i = 0; i < guids.Length; i++)
-        {
+        {
-            string path = AssetDatabase.GUIDToAssetPath(guids[i]);
+            string path = AssetDatabase.GUIDToAssetPath(guids[i]);
-            Type assetType = AssetDatabase.GetMainAssetTypeAtPath(path);
+            Type assetType = AssetDatabase.GetMainAssetTypeAtPath(path);
-            if (assetType == typeof(MonoScript))
+            if (assetType == typeof(MonoScript))
-                return true;
+                return true;
-        }
+        }
-
+
-        return false;
+        return false;
-    }
+    }
-
+
-    void CreateScript (string fileName, string content)
+    void CreateScript (string fileName, string content)
-    {
+    {
-        string path = Application.dataPath + "/" + playableName + "/" + fileName + ".cs";
+        string path = Application.dataPath + "/" + playableName + "/" + fileName + ".cs";
-        using (StreamWriter writer = File.CreateText (path))
+        using (StreamWriter writer = File.CreateText (path))
-            writer.Write (content);
+            writer.Write (content);
-    }
+    }
-
+
-    void ResetWindow ()
+    void ResetWindow ()
-    {
+    {
-        playableName = "";
+        playableName = "";
-        isStandardBlendPlayable = false;
+        isStandardBlendPlayable = false;
-        trackBinding = s_TrackBindingTypes[0];
+        trackBinding = s_TrackBindingTypes[0];
-        defaultValuesComponent = null;
+        defaultValuesComponent = null;
-        exposedReferences = new List<Variable>();
+        exposedReferences = new List<Variable>();
-        playableBehaviourVariables = new List<Variable>();
+        playableBehaviourVariables = new List<Variable>();
-        standardBlendPlayableProperties = new List<UsableProperty>();
+        standardBlendPlayableProperties = new List<UsableProperty>();
-        clipCaps = ClipCaps.None;
+        clipCaps = ClipCaps.None;
-        /*setClipDefaults = false;
+        /*setClipDefaults = false;
-        clipDefaultDurationSeconds = 5f;
+        clipDefaultDurationSeconds = 5f;
-        clipDefaultEaseInSeconds = 0f;
+        clipDefaultEaseInSeconds = 0f;
-        clipDefaultEaseOutSeconds = 0f;
+        clipDefaultEaseOutSeconds = 0f;
-        clipDefaultClipInSeconds = 0f;
+        clipDefaultClipInSeconds = 0f;
-        clipDefaultSpeedMultiplier = 1f;*/
+        clipDefaultSpeedMultiplier = 1f;*/
-        trackColor = new Color(0.855f, 0.8623f, 0.870f);
+        trackColor = new Color(0.855f, 0.8623f, 0.870f);
-
+
-        m_TrackBindingTypeIndex = 0;
+        m_TrackBindingTypeIndex = 0;
-        m_ComponentBindingTypeIndex = 0;
+        m_ComponentBindingTypeIndex = 0;
-        m_TrackBindingProperties = null;
+        m_TrackBindingProperties = null;
-        m_TrackBindingFields = null;
+        m_TrackBindingFields = null;
-        m_TrackBindingUsableProperties = null;
+        m_TrackBindingUsableProperties = null;
-        m_CreateDrawer = false;
+        m_CreateDrawer = false;
-    }
+    }
-
+
-    string TrackAssetScript ()
+    string TrackAssetScript ()
-    {
+    {
-        return 
+        return 
-            "using UnityEngine;\n" +
+            "using UnityEngine;\n" +
-            "using UnityEngine.Playables;\n" +
+            "using UnityEngine.Playables;\n" +
-            "using UnityEngine.Timeline;\n" +
+            "using UnityEngine.Timeline;\n" +
-            AdditionalNamespacesToString() + 
+            AdditionalNamespacesToString() + 
-            "\n" +
+            "\n" +
-            "[TrackColor(" + trackColor.r + "f, " + trackColor.g + "f, " + trackColor.b + "f)]\n" +
+            "[TrackColor(" + trackColor.r + "f, " + trackColor.g + "f, " + trackColor.b + "f)]\n" +
-            "[TrackClipType(typeof(" + playableName + k_TimelineClipAssetSuffix + "))]\n" +
+            "[TrackClipType(typeof(" + playableName + k_TimelineClipAssetSuffix + "))]\n" +
-            TrackBindingToString () +
+            TrackBindingToString () +
-            "public class " + playableName + k_TrackAssetSuffix + " : TrackAsset\n" +
+            "public class " + playableName + k_TrackAssetSuffix + " : TrackAsset\n" +
-            "{\n" +
+            "{\n" +
-            k_Tab + "public override Playable CreateTrackMixer(PlayableGraph graph, GameObject go, int inputCount)\n" +
+            k_Tab + "public override Playable CreateTrackMixer(PlayableGraph graph, GameObject go, int inputCount)\n" +
-            k_Tab + "{\n" +
+            k_Tab + "{\n" +
-            k_Tab + k_Tab + "return ScriptPlayable<" + playableName + k_PlayableBehaviourMixerSuffix + ">.Create (graph, inputCount);\n" +
+            k_Tab + k_Tab + "return ScriptPlayable<" + playableName + k_PlayableBehaviourMixerSuffix + ">.Create (graph, inputCount);\n" +
-            k_Tab + "}\n" +
+            k_Tab + "}\n" +
-            "}\n";
+            "}\n";
-    }
+    }
-
+
-    string PlayableAsset ()
+    string PlayableAsset ()
-    {
+    {
-        return 
+        return 
-            "using System;\n" +
+            "using System;\n" +
-            "using UnityEngine;\n" +
+            "using UnityEngine;\n" +
-            "using UnityEngine.Playables;\n" +
+            "using UnityEngine.Playables;\n" +
-            "using UnityEngine.Timeline;\n" +
+            "using UnityEngine.Timeline;\n" +
-            AdditionalNamespacesToString() +
+            AdditionalNamespacesToString() +
-            "\n" +
+            "\n" +
-            "[Serializable]\n" +
+            "[Serializable]\n" +
-            "public class " + playableName + k_TimelineClipAssetSuffix + " : PlayableAsset, ITimelineClipAsset\n" +
+            "public class " + playableName + k_TimelineClipAssetSuffix + " : PlayableAsset, ITimelineClipAsset\n" +
-            "{\n" +
+            "{\n" +
-            k_Tab + "public " + playableName + k_TimelineClipBehaviourSuffix + " template = new " + playableName + k_TimelineClipBehaviourSuffix + " ();\n" +
+            k_Tab + "public " + playableName + k_TimelineClipBehaviourSuffix + " template = new " + playableName + k_TimelineClipBehaviourSuffix + " ();\n" +
-            ExposedReferencesToString () +
+            ExposedReferencesToString () +
-            "\n" +
+            "\n" +
-            k_Tab + "public ClipCaps clipCaps\n" +
+            k_Tab + "public ClipCaps clipCaps\n" +
-            k_Tab + "{\n" +
+            k_Tab + "{\n" +
-            k_Tab + k_Tab + "get { return " + ClipCapsToString () + "; }\n" +
+            k_Tab + k_Tab + "get { return " + ClipCapsToString () + "; }\n" +
-            k_Tab + "}\n" +
+            k_Tab + "}\n" +
-            "\n" +
+            "\n" +
-            k_Tab + "public override Playable CreatePlayable (PlayableGraph graph, GameObject owner)\n" +
+            k_Tab + "public override Playable CreatePlayable (PlayableGraph graph, GameObject owner)\n" +
-            k_Tab + "{\n" +
+            k_Tab + "{\n" +
-            k_Tab + k_Tab + "var playable = ScriptPlayable<" + playableName + k_TimelineClipBehaviourSuffix + ">.Create (graph, template);\n" +
+            k_Tab + k_Tab + "var playable = ScriptPlayable<" + playableName + k_TimelineClipBehaviourSuffix + ">.Create (graph, template);\n" +
-            ExposedReferencesResolvingToString () +
+            ExposedReferencesResolvingToString () +
-            k_Tab + k_Tab + "return playable;\n" +
+            k_Tab + k_Tab + "return playable;\n" +
-            k_Tab + "}\n" +
+            k_Tab + "}\n" +
-            "}\n";
+            "}\n";
-    }
+    }
-
+
-    string PlayableBehaviour ()
+    string PlayableBehaviour ()
-    {
+    {
-        return 
+        return 
-            "using System;\n" +
+            "using System;\n" +
-            "using UnityEngine;\n" +
+            "using UnityEngine;\n" +
-            "using UnityEngine.Playables;\n" +
+            "using UnityEngine.Playables;\n" +
-            "using UnityEngine.Timeline;\n" +
+            "using UnityEngine.Timeline;\n" +
-            AdditionalNamespacesToString() +
+            AdditionalNamespacesToString() +
-            "\n" +
+            "\n" +
-            "[Serializable]\n" +
+            "[Serializable]\n" +
-            "public class " + playableName + k_TimelineClipBehaviourSuffix + " : PlayableBehaviour\n" +
+            "public class " + playableName + k_TimelineClipBehaviourSuffix + " : PlayableBehaviour\n" +
-            "{\n" +
+            "{\n" +
-            ExposedReferencesAsScriptVariablesToString () +
+            ExposedReferencesAsScriptVariablesToString () +
-            PlayableBehaviourVariablesToString () +
+            PlayableBehaviourVariablesToString () +
-            "\n" +
+            "\n" +
-            k_Tab + "public override void OnPlayableCreate (Playable playable)\n" +
+            k_Tab + "public override void OnPlayableCreate (Playable playable)\n" +
-            k_Tab + "{\n" +
+            k_Tab + "{\n" +
-            k_Tab + k_Tab + "\n" +
+            k_Tab + k_Tab + "\n" +
-            k_Tab + "}\n" +
+            k_Tab + "}\n" +
-            "}\n";
+            "}\n";
-    }
+    }
-
+
-    string PlayableBehaviourMixer ()
+    string PlayableBehaviourMixer ()
-    {
+    {
-        return 
+        return 
-            "using System;\n" +
+            "using System;\n" +
-            "using UnityEngine;\n" +
+            "using UnityEngine;\n" +
-            "using UnityEngine.Playables;\n" +
+            "using UnityEngine.Playables;\n" +
-            "using UnityEngine.Timeline;\n" +
+            "using UnityEngine.Timeline;\n" +
-            AdditionalNamespacesToString() +
+            AdditionalNamespacesToString() +
-            "\n" +
+            "\n" +
-            "public class " + playableName + k_PlayableBehaviourMixerSuffix + " : PlayableBehaviour\n" +
+            "public class " + playableName + k_PlayableBehaviourMixerSuffix + " : PlayableBehaviour\n" +
-            "{\n" +
+            "{\n" +
-            k_Tab + "// NOTE: This function is called at runtime and edit time.  Keep that in mind when setting the values of properties.\n" +
+            k_Tab + "// NOTE: This function is called at runtime and edit time.  Keep that in mind when setting the values of properties.\n" +
-            k_Tab + "public override void ProcessFrame(Playable playable, FrameData info, object playerData)\n" +
+            k_Tab + "public override void ProcessFrame(Playable playable, FrameData info, object playerData)\n" +
-            k_Tab + "{\n" +
+            k_Tab + "{\n" +
-            MixerTrackBindingLocalVariableToString () +
+            MixerTrackBindingLocalVariableToString () +
-            k_Tab + k_Tab + "int inputCount = playable.GetInputCount ();\n" +
+            k_Tab + k_Tab + "int inputCount = playable.GetInputCount ();\n" +
-            "\n" +
+            "\n" +
-            k_Tab + k_Tab + "for (int i = 0; i < inputCount; i++)\n" +
+            k_Tab + k_Tab + "for (int i = 0; i < inputCount; i++)\n" +
-            k_Tab + k_Tab + "{\n" +
+            k_Tab + k_Tab + "{\n" +
-            k_Tab + k_Tab + k_Tab + "float inputWeight = playable.GetInputWeight(i);\n" +
+            k_Tab + k_Tab + k_Tab + "float inputWeight = playable.GetInputWeight(i);\n" +
-            k_Tab + k_Tab + k_Tab + "ScriptPlayable<" + playableName + k_TimelineClipBehaviourSuffix + "> inputPlayable = (ScriptPlayable<" + playableName + k_TimelineClipBehaviourSuffix + ">)playable.GetInput(i);\n" +
+            k_Tab + k_Tab + k_Tab + "ScriptPlayable<" + playableName + k_TimelineClipBehaviourSuffix + "> inputPlayable = (ScriptPlayable<" + playableName + k_TimelineClipBehaviourSuffix + ">)playable.GetInput(i);\n" +
-            k_Tab + k_Tab + k_Tab + playableName + k_TimelineClipBehaviourSuffix + " input = inputPlayable.GetBehaviour ();\n" +
+            k_Tab + k_Tab + k_Tab + playableName + k_TimelineClipBehaviourSuffix + " input = inputPlayable.GetBehaviour ();\n" +
-            k_Tab + k_Tab + k_Tab + "\n" +
+            k_Tab + k_Tab + k_Tab + "\n" +
-            k_Tab + k_Tab + k_Tab + "// Use the above variables to process each frame of this playable.\n" +
+            k_Tab + k_Tab + k_Tab + "// Use the above variables to process each frame of this playable.\n" +
-            k_Tab + k_Tab + k_Tab + "\n" +
+            k_Tab + k_Tab + k_Tab + "\n" +
-            k_Tab + k_Tab + "}\n" +
+            k_Tab + k_Tab + "}\n" +
-            k_Tab + "}\n" +
+            k_Tab + "}\n" +
-            "}\n";
+            "}\n";
-    }
+    }
-
+
-    string PlayableDrawer ()
+    string PlayableDrawer ()
-    {
+    {
-        return 
+        return 
-            "using UnityEditor;\n" +
+            "using UnityEditor;\n" +
-            "using UnityEngine;\n" +
+            "using UnityEngine;\n" +
-            "\n" +
+            "\n" +
-            "[CustomPropertyDrawer(typeof(" + playableName + k_TimelineClipBehaviourSuffix + "))]\n" +
+            "[CustomPropertyDrawer(typeof(" + playableName + k_TimelineClipBehaviourSuffix + "))]\n" +
-            "public class " + playableName + k_PropertyDrawerSuffix + " : PropertyDrawer\n" +
+            "public class " + playableName + k_PropertyDrawerSuffix + " : PropertyDrawer\n" +
-            "{\n" +
+            "{\n" +
-            k_Tab + "public override float GetPropertyHeight (SerializedProperty property, GUIContent label)\n" +
+            k_Tab + "public override float GetPropertyHeight (SerializedProperty property, GUIContent label)\n" +
-            k_Tab + "{\n" +
+            k_Tab + "{\n" +
-            k_Tab + k_Tab + "int fieldCount = " + playableBehaviourVariables.Count +";\n" +
+            k_Tab + k_Tab + "int fieldCount = " + playableBehaviourVariables.Count +";\n" +
-            k_Tab + k_Tab + "return fieldCount * EditorGUIUtility.singleLineHeight;\n" +
+            k_Tab + k_Tab + "return fieldCount * EditorGUIUtility.singleLineHeight;\n" +
-            k_Tab + "}\n" +
+            k_Tab + "}\n" +
-            "\n" +
+            "\n" +
-            k_Tab + "public override void OnGUI (Rect position, SerializedProperty property, GUIContent label)\n" +
+            k_Tab + "public override void OnGUI (Rect position, SerializedProperty property, GUIContent label)\n" +
-            k_Tab + "{\n" +
+            k_Tab + "{\n" +
-            ScriptVariablesAsSerializedPropAssignmentToString () +
+            ScriptVariablesAsSerializedPropAssignmentToString () +
-            "\n" + 
+            "\n" + 
-            k_Tab + k_Tab + "Rect singleFieldRect = new Rect(position.x, position.y, position.width, EditorGUIUtility.singleLineHeight);\n" +
+            k_Tab + k_Tab + "Rect singleFieldRect = new Rect(position.x, position.y, position.width, EditorGUIUtility.singleLineHeight);\n" +
-            ScriptVariablesAsSerializedPropGUIToString () +
+            ScriptVariablesAsSerializedPropGUIToString () +
-            k_Tab + "}\n" +
+            k_Tab + "}\n" +
-            "}\n";
+            "}\n";
-    }
+    }
-
+
-    string TrackBindingToString ()
+    string TrackBindingToString ()
-    {
+    {
-        if (m_TrackBindingTypeIndex != 0)
+        if (m_TrackBindingTypeIndex != 0)
-            return "[TrackBindingType(typeof(" + trackBinding.name + "))]\n";
+            return "[TrackBindingType(typeof(" + trackBinding.name + "))]\n";
-        return "";
+        return "";
-    }
+    }
-
+
-    string AdditionalNamespacesToString ()
+    string AdditionalNamespacesToString ()
-    {
+    {
-        UsableType[] exposedReferenceTypes = Variable.GetUsableTypesFromVariableArray (exposedReferences.ToArray ());
+        UsableType[] exposedReferenceTypes = Variable.GetUsableTypesFromVariableArray (exposedReferences.ToArray ());
-        UsableType[] behaviourVariableTypes = Variable.GetUsableTypesFromVariableArray (playableBehaviourVariables.ToArray ());
+        UsableType[] behaviourVariableTypes = Variable.GetUsableTypesFromVariableArray (playableBehaviourVariables.ToArray ());
-        UsableType[] allUsedTypes = new UsableType[exposedReferenceTypes.Length + behaviourVariableTypes.Length + 1];
+        UsableType[] allUsedTypes = new UsableType[exposedReferenceTypes.Length + behaviourVariableTypes.Length + 1];
-        for (int i = 0; i < exposedReferenceTypes.Length; i++)
+        for (int i = 0; i < exposedReferenceTypes.Length; i++)
-        {
+        {
-            allUsedTypes[i] = exposedReferenceTypes[i];
+            allUsedTypes[i] = exposedReferenceTypes[i];
-        }
+        }
-        for (int i = 0; i < behaviourVariableTypes.Length; i++)
+        for (int i = 0; i < behaviourVariableTypes.Length; i++)
-        {
+        {
-            allUsedTypes[i + exposedReferenceTypes.Length] = behaviourVariableTypes[i];
+            allUsedTypes[i + exposedReferenceTypes.Length] = behaviourVariableTypes[i];
-        }
+        }
-        allUsedTypes[allUsedTypes.Length - 1] = trackBinding;
+        allUsedTypes[allUsedTypes.Length - 1] = trackBinding;
-
+
-        string[] distinctNamespaces = UsableType.GetDistinctAdditionalNamespaces (allUsedTypes).Where (x => !string.IsNullOrEmpty (x)).ToArray ();
+        string[] distinctNamespaces = UsableType.GetDistinctAdditionalNamespaces (allUsedTypes).Where (x => !string.IsNullOrEmpty (x)).ToArray ();
-        string returnVal = "";
+        string returnVal = "";
-        for (int i = 0; i < distinctNamespaces.Length; i++)
+        for (int i = 0; i < distinctNamespaces.Length; i++)
-        {
+        {
-            returnVal += "using " + distinctNamespaces[i] + ";\n";
+            returnVal += "using " + distinctNamespaces[i] + ";\n";
-        }
+        }
-        return returnVal;
+        return returnVal;
-    }
+    }
-
+
-    string ExposedReferencesToString ()
+    string ExposedReferencesToString ()
-    {
+    {
-        string expRefText = "";
+        string expRefText = "";
-        foreach (var expRef in exposedReferences)
+        foreach (var expRef in exposedReferences)
-            expRefText += k_Tab + "public ExposedReference<" + expRef.usableType.name + "> " + expRef.name + ";\n";
+            expRefText += k_Tab + "public ExposedReference<" + expRef.usableType.name + "> " + expRef.name + ";\n";
-        return expRefText;
+        return expRefText;
-    }
+    }
-
+
-    string ExposedReferencesResolvingToString ()
+    string ExposedReferencesResolvingToString ()
-    {
+    {
-        string returnVal = "";
+        string returnVal = "";
-        returnVal += k_Tab + k_Tab + playableName + k_TimelineClipBehaviourSuffix + " clone = playable.GetBehaviour ();\n";
+        returnVal += k_Tab + k_Tab + playableName + k_TimelineClipBehaviourSuffix + " clone = playable.GetBehaviour ();\n";
-        for (int i = 0; i < exposedReferences.Count; i++)
+        for (int i = 0; i < exposedReferences.Count; i++)
-        {
+        {
-            returnVal += k_Tab + k_Tab + "clone." + exposedReferences[i].name + " = " + exposedReferences[i].name + ".Resolve (graph.GetResolver ());\n";
+            returnVal += k_Tab + k_Tab + "clone." + exposedReferences[i].name + " = " + exposedReferences[i].name + ".Resolve (graph.GetResolver ());\n";
-        }
+        }
-        return returnVal;
+        return returnVal;
-    }
+    }
-
+
-    /*string OnCreateFunctionToString ()
+    /*string OnCreateFunctionToString ()
-    {
+    {
-        if (!setClipDefaults)
+        if (!setClipDefaults)
-            return "";
+            return "";
-
+
-        string returnVal = "\n";
+        string returnVal = "\n";
-            returnVal += k_Tab + "public override void OnCreate ()\n";
+            returnVal += k_Tab + "public override void OnCreate ()\n";
-            returnVal += k_Tab + "{\n";
+            returnVal += k_Tab + "{\n";
-            returnVal += k_Tab + k_Tab + "owner.duration = " + clipDefaultDurationSeconds + ";\n";
+            returnVal += k_Tab + k_Tab + "owner.duration = " + clipDefaultDurationSeconds + ";\n";
-            returnVal += k_Tab + k_Tab + "owner.easeInDuration = " + clipDefaultEaseInSeconds + ";\n";
+            returnVal += k_Tab + k_Tab + "owner.easeInDuration = " + clipDefaultEaseInSeconds + ";\n";
-            returnVal += k_Tab + k_Tab + "owner.easeOutDuration = " + clipDefaultEaseOutSeconds + ";\n";
+            returnVal += k_Tab + k_Tab + "owner.easeOutDuration = " + clipDefaultEaseOutSeconds + ";\n";
-            returnVal += k_Tab + k_Tab + "owner.clipIn = " + clipDefaultClipInSeconds + ";\n";
+            returnVal += k_Tab + k_Tab + "owner.clipIn = " + clipDefaultClipInSeconds + ";\n";
-            returnVal += k_Tab + k_Tab + "owner.timeScale = " + clipDefaultSpeedMultiplier + ";\n";
+            returnVal += k_Tab + k_Tab + "owner.timeScale = " + clipDefaultSpeedMultiplier + ";\n";
-            returnVal += k_Tab + "}\n";
+            returnVal += k_Tab + "}\n";
-        return returnVal;
+        return returnVal;
-    }*/
+    }*/
-
+
-    string ClipCapsToString ()
+    string ClipCapsToString ()
-    {
+    {
-        string message = clipCaps.ToString ();
+        string message = clipCaps.ToString ();
-        string[] splits = message.Split (' ');
+        string[] splits = message.Split (' ');
-
+
-        for (int i = 0; i < splits.Length; i++)
+        for (int i = 0; i < splits.Length; i++)
-        {
+        {
-            if (splits[i][splits[i].Length - 1] == ',')
+            if (splits[i][splits[i].Length - 1] == ',')
-                splits[i] = splits[i].Substring (0, splits[i].Length - 1);
+                splits[i] = splits[i].Substring (0, splits[i].Length - 1);
-        }
+        }
-
+
-        string returnVal = "";
+        string returnVal = "";
-
+
-        for (int i = 0; i < splits.Length; i++)
+        for (int i = 0; i < splits.Length; i++)
-        {
+        {
-            returnVal += "ClipCaps." + splits[i];
+            returnVal += "ClipCaps." + splits[i];
-
+
-            if (i < splits.Length - 1)
+            if (i < splits.Length - 1)
-                returnVal += " | ";
+                returnVal += " | ";
-        }
+        }
-
+
-        return returnVal;
+        return returnVal;
-    }
+    }
-
+
-    string ExposedReferencesAsScriptVariablesToString ()
+    string ExposedReferencesAsScriptVariablesToString ()
-    {
+    {
-        string returnVal = "";
+        string returnVal = "";
-        for (int i = 0; i < exposedReferences.Count; i++)
+        for (int i = 0; i < exposedReferences.Count; i++)
-        {
+        {
-            returnVal += k_Tab + "public " + exposedReferences[i].usableType.name + " " + exposedReferences[i].name + ";\n";
+            returnVal += k_Tab + "public " + exposedReferences[i].usableType.name + " " + exposedReferences[i].name + ";\n";
-        }
+        }
-        return returnVal;
+        return returnVal;
-    }
+    }
-
+
-    string PlayableBehaviourVariablesToString ()
+    string PlayableBehaviourVariablesToString ()
-    {
+    {
-        string returnVal = "";
+        string returnVal = "";
-        for (int i = 0; i < playableBehaviourVariables.Count; i++)
+        for (int i = 0; i < playableBehaviourVariables.Count; i++)
-        {
+        {
-            returnVal += k_Tab + "public " + playableBehaviourVariables[i].usableType.name + " " + playableBehaviourVariables[i].name + ";\n";
+            returnVal += k_Tab + "public " + playableBehaviourVariables[i].usableType.name + " " + playableBehaviourVariables[i].name + ";\n";
-        }
+        }
-        return returnVal;
+        return returnVal;
-    }
+    }
-
+
-    string MixerTrackBindingLocalVariableToString ()
+    string MixerTrackBindingLocalVariableToString ()
-    {
+    {
-        if (m_TrackBindingTypeIndex != 0)
+        if (m_TrackBindingTypeIndex != 0)
-            return
+            return
-                k_Tab + k_Tab + trackBinding.name + " trackBinding = playerData as " + trackBinding.name + ";\n\n" +
+                k_Tab + k_Tab + trackBinding.name + " trackBinding = playerData as " + trackBinding.name + ";\n\n" +
-                k_Tab + k_Tab + "if (!trackBinding)\n" +
+                k_Tab + k_Tab + "if (!trackBinding)\n" +
-                k_Tab + k_Tab + k_Tab + "return;\n" +
+                k_Tab + k_Tab + k_Tab + "return;\n" +
-                "\n";
+                "\n";
-        return "";
+        return "";
-    }
+    }
-
+
-    string ScriptVariablesAsSerializedPropAssignmentToString ()
+    string ScriptVariablesAsSerializedPropAssignmentToString ()
-    {
+    {
-        string returnVal = "";
+        string returnVal = "";
-        for (int i = 0; i < playableBehaviourVariables.Count; i++)
+        for (int i = 0; i < playableBehaviourVariables.Count; i++)
-        {
+        {
-            returnVal += k_Tab + k_Tab + "SerializedProperty " + playableBehaviourVariables[i].name + "Prop = property.FindPropertyRelative(\"" + playableBehaviourVariables[i].name + "\");\n";
+            returnVal += k_Tab + k_Tab + "SerializedProperty " + playableBehaviourVariables[i].name + "Prop = property.FindPropertyRelative(\"" + playableBehaviourVariables[i].name + "\");\n";
-        }
+        }
-        return returnVal;
+        return returnVal;
-    }
+    }
-
+
-    string ScriptVariablesAsSerializedPropGUIToString ()
+    string ScriptVariablesAsSerializedPropGUIToString ()
-    {
+    {
-        string returnVal = "";
+        string returnVal = "";
-        for (int i = 0; i < playableBehaviourVariables.Count; i++)
+        for (int i = 0; i < playableBehaviourVariables.Count; i++)
-        {
+        {
-            returnVal += k_Tab + k_Tab + "EditorGUI.PropertyField(singleFieldRect, " + playableBehaviourVariables[i].name + "Prop);\n";
+            returnVal += k_Tab + k_Tab + "EditorGUI.PropertyField(singleFieldRect, " + playableBehaviourVariables[i].name + "Prop);\n";
-
+
-            if (i < playableBehaviourVariables.Count - 1)
+            if (i < playableBehaviourVariables.Count - 1)
-            {
+            {
-                returnVal += "\n";
+                returnVal += "\n";
-                returnVal += k_Tab + k_Tab + "singleFieldRect.y += EditorGUIUtility.singleLineHeight;\n";
+                returnVal += k_Tab + k_Tab + "singleFieldRect.y += EditorGUIUtility.singleLineHeight;\n";
-            }
+            }
-        }
+        }
-        return returnVal;
+        return returnVal;
-    }
+    }
-
+
-    string StandardBlendPlayableAsset ()
+    string StandardBlendPlayableAsset ()
-    {
+    {
-        return
+        return
-            "using System;\n" +
+            "using System;\n" +
-            "using UnityEngine;\n" +
+            "using UnityEngine;\n" +
-            "using UnityEngine.Playables;\n" +
+            "using UnityEngine.Playables;\n" +
-            "using UnityEngine.Timeline;\n" +
+            "using UnityEngine.Timeline;\n" +
-            "\n" +
+            "\n" +
-            "[Serializable]\n" +
+            "[Serializable]\n" +
-            "public class " + playableName + k_TimelineClipAssetSuffix + " : PlayableAsset, ITimelineClipAsset\n" +
+            "public class " + playableName + k_TimelineClipAssetSuffix + " : PlayableAsset, ITimelineClipAsset\n" +
-            "{\n" +
+            "{\n" +
-            k_Tab + "public " + playableName + k_TimelineClipBehaviourSuffix + " template = new " + playableName + k_TimelineClipBehaviourSuffix + " ();\n" +
+            k_Tab + "public " + playableName + k_TimelineClipBehaviourSuffix + " template = new " + playableName + k_TimelineClipBehaviourSuffix + " ();\n" +
-            "\n" +
+            "\n" +
-            k_Tab + "public ClipCaps clipCaps\n" +
+            k_Tab + "public ClipCaps clipCaps\n" +
-            k_Tab + "{\n" +
+            k_Tab + "{\n" +
-            k_Tab + k_Tab + "get { return ClipCaps.Blending; }\n" +
+            k_Tab + k_Tab + "get { return ClipCaps.Blending; }\n" +
-            k_Tab + "}\n" +
+            k_Tab + "}\n" +
-            "\n" +
+            "\n" +
-            k_Tab + "public override Playable CreatePlayable (PlayableGraph graph, GameObject owner)\n" +
+            k_Tab + "public override Playable CreatePlayable (PlayableGraph graph, GameObject owner)\n" +
-            k_Tab + "{\n" +
+            k_Tab + "{\n" +
-            k_Tab + k_Tab + "var playable = ScriptPlayable<" + playableName + k_TimelineClipBehaviourSuffix + ">.Create (graph, template);\n" +
+            k_Tab + k_Tab + "var playable = ScriptPlayable<" + playableName + k_TimelineClipBehaviourSuffix + ">.Create (graph, template);\n" +
-            k_Tab + k_Tab + "return playable;\n" +
+            k_Tab + k_Tab + "return playable;\n" +
-            k_Tab + "}\n" +
+            k_Tab + "}\n" +
-            "}\n";
+            "}\n";
-    }
+    }
-
+
-    string StandardBlendPlayableBehaviour ()
+    string StandardBlendPlayableBehaviour ()
-    {
+    {
-        return
+        return
-            "using System;\n" +
+            "using System;\n" +
-            "using UnityEngine;\n" +
+            "using UnityEngine;\n" +
-            "using UnityEngine.Playables;\n" +
+            "using UnityEngine.Playables;\n" +
-            "using UnityEngine.Timeline;\n" +
+            "using UnityEngine.Timeline;\n" +
-            AdditionalNamespacesToString() +
+            AdditionalNamespacesToString() +
-            "\n" +
+            "\n" +
-            "[Serializable]\n" +
+            "[Serializable]\n" +
-            "public class " + playableName + k_TimelineClipBehaviourSuffix + " : PlayableBehaviour\n" +
+            "public class " + playableName + k_TimelineClipBehaviourSuffix + " : PlayableBehaviour\n" +
-            "{\n" +
+            "{\n" +
-            StandardBlendScriptPlayablePropertiesToString () +
+            StandardBlendScriptPlayablePropertiesToString () +
-            "}\n";
+            "}\n";
-    }
+    }
-
+
-    string StandardBlendPlayableBehaviourMixer ()
+    string StandardBlendPlayableBehaviourMixer ()
-    {
+    {
-        return
+        return
-            "using System;\n" +
+            "using System;\n" +
-            "using UnityEngine;\n" +
+            "using UnityEngine;\n" +
-            "using UnityEngine.Playables;\n" +
+            "using UnityEngine.Playables;\n" +
-            "using UnityEngine.Timeline;\n" +
+            "using UnityEngine.Timeline;\n" +
-            AdditionalNamespacesToString() +
+            AdditionalNamespacesToString() +
-            "\n" +
+            "\n" +
-            "public class " + playableName + k_PlayableBehaviourMixerSuffix + " : PlayableBehaviour\n" +
+            "public class " + playableName + k_PlayableBehaviourMixerSuffix + " : PlayableBehaviour\n" +
-            "{\n" +
+            "{\n" +
-            StandardBlendTrackBindingPropertiesDefaultsDeclarationToString () +
+            StandardBlendTrackBindingPropertiesDefaultsDeclarationToString () +
-            "\n" +
+            "\n" +
-            StandardBlendTrackBindingPropertiesBlendedDeclarationToString () +
+            StandardBlendTrackBindingPropertiesBlendedDeclarationToString () +
-            "\n" +
+            "\n" +
-            k_Tab + trackBinding.name + " m_TrackBinding;\n" +
+            k_Tab + trackBinding.name + " m_TrackBinding;\n" +
-            "\n" +
+            "\n" +
-            k_Tab + "public override void ProcessFrame(Playable playable, FrameData info, object playerData)\n" +
+            k_Tab + "public override void ProcessFrame(Playable playable, FrameData info, object playerData)\n" +
-            k_Tab + "{\n" +
+            k_Tab + "{\n" +
-            k_Tab + k_Tab + "m_TrackBinding = playerData as " + trackBinding.name + ";\n" +
+            k_Tab + k_Tab + "m_TrackBinding = playerData as " + trackBinding.name + ";\n" +
-            "\n" +
+            "\n" +
-            k_Tab + k_Tab + "if (m_TrackBinding == null)\n" +
+            k_Tab + k_Tab + "if (m_TrackBinding == null)\n" +
-            k_Tab + k_Tab + k_Tab + "return;\n" +
+            k_Tab + k_Tab + k_Tab + "return;\n" +
-            "\n" +
+            "\n" +
-            StandardBlendTrackBindingPropertiesDefaultsAssignmentToString () +
+            StandardBlendTrackBindingPropertiesDefaultsAssignmentToString () +
-            "\n" +
+            "\n" +
-            k_Tab + k_Tab + "int inputCount = playable.GetInputCount ();\n" +
+            k_Tab + k_Tab + "int inputCount = playable.GetInputCount ();\n" +
-            "\n" +
+            "\n" +
-            StandardBlendBlendedVariablesCreationToString () +
+            StandardBlendBlendedVariablesCreationToString () +
-            k_Tab + k_Tab + "float totalWeight = 0f;\n" +
+            k_Tab + k_Tab + "float totalWeight = 0f;\n" +
-            k_Tab + k_Tab + "float greatestWeight = 0f;\n" +
+            k_Tab + k_Tab + "float greatestWeight = 0f;\n" +
-            StandardBlendPlayableCurrentInputsDeclarationToString () +
+            StandardBlendPlayableCurrentInputsDeclarationToString () +
-            "\n" +
+            "\n" +
-            k_Tab + k_Tab + "for (int i = 0; i < inputCount; i++)\n" +
+            k_Tab + k_Tab + "for (int i = 0; i < inputCount; i++)\n" +
-            k_Tab + k_Tab + "{\n" +
+            k_Tab + k_Tab + "{\n" +
-            k_Tab + k_Tab + k_Tab + "float inputWeight = playable.GetInputWeight(i);\n" +
+            k_Tab + k_Tab + k_Tab + "float inputWeight = playable.GetInputWeight(i);\n" +
-            k_Tab + k_Tab + k_Tab + "ScriptPlayable<" + playableName + k_TimelineClipBehaviourSuffix + "> inputPlayable = (ScriptPlayable<" + playableName + k_TimelineClipBehaviourSuffix + ">)playable.GetInput(i);\n" +
+            k_Tab + k_Tab + k_Tab + "ScriptPlayable<" + playableName + k_TimelineClipBehaviourSuffix + "> inputPlayable = (ScriptPlayable<" + playableName + k_TimelineClipBehaviourSuffix + ">)playable.GetInput(i);\n" +
-            k_Tab + k_Tab + k_Tab + playableName + k_TimelineClipBehaviourSuffix + " input = inputPlayable.GetBehaviour ();\n" +
+            k_Tab + k_Tab + k_Tab + playableName + k_TimelineClipBehaviourSuffix + " input = inputPlayable.GetBehaviour ();\n" +
-            k_Tab + k_Tab + k_Tab + "\n" +
+            k_Tab + k_Tab + k_Tab + "\n" +
-            StandardBlendBlendedVariablesWeightedIncrementationToString () +
+            StandardBlendBlendedVariablesWeightedIncrementationToString () +
-            k_Tab + k_Tab + k_Tab + "totalWeight += inputWeight;\n" +
+            k_Tab + k_Tab + k_Tab + "totalWeight += inputWeight;\n" +
-            "\n" +
+            "\n" +
-            StandardBlendAssignableVariablesAssignedBasedOnGreatestWeightToString () +
+            StandardBlendAssignableVariablesAssignedBasedOnGreatestWeightToString () +
-            StandardBlendPlayableCurrentInputIterationToString () + 
+            StandardBlendPlayableCurrentInputIterationToString () + 
-            k_Tab + k_Tab + "}\n" +
+            k_Tab + k_Tab + "}\n" +
-            StandardBlendTrackBindingPropertiesBlendedAssignmentToString () +
+            StandardBlendTrackBindingPropertiesBlendedAssignmentToString () +
-            StandardBlendTrackBindingPropertiesAssignableAssignmentToString () +
+            StandardBlendTrackBindingPropertiesAssignableAssignmentToString () +
-            k_Tab + "}\n" +
+            k_Tab + "}\n" +
-            "}\n";
+            "}\n";
-    }
+    }
-
+
-    string StandardBlendTrackAssetScript ()
+    string StandardBlendTrackAssetScript ()
-    {
+    {
-        return
+        return
-            "using UnityEngine;\n" +
+            "using UnityEngine;\n" +
-            "using UnityEngine.Playables;\n" +
+            "using UnityEngine.Playables;\n" +
-            "using UnityEngine.Timeline;\n" +
+            "using UnityEngine.Timeline;\n" +
-            "using System.Collections.Generic;\n" +
+            "using System.Collections.Generic;\n" +
-            AdditionalNamespacesToString() +
+            AdditionalNamespacesToString() +
-            "\n" +
+            "\n" +
-            "[TrackColor(" + trackColor.r + "f, " + trackColor.g + "f, " + trackColor.b + "f)]\n" +
+            "[TrackColor(" + trackColor.r + "f, " + trackColor.g + "f, " + trackColor.b + "f)]\n" +
-            "[TrackClipType(typeof(" + playableName + k_TimelineClipAssetSuffix + "))]\n" +
+            "[TrackClipType(typeof(" + playableName + k_TimelineClipAssetSuffix + "))]\n" +
-            StandardBlendComponentBindingToString () +
+            StandardBlendComponentBindingToString () +
-            "public class " + playableName + k_TrackAssetSuffix + " : TrackAsset\n" +
+            "public class " + playableName + k_TrackAssetSuffix + " : TrackAsset\n" +
-            "{\n" +
+            "{\n" +
-            k_Tab + "public override Playable CreateTrackMixer(PlayableGraph graph, GameObject go, int inputCount)\n" +
+            k_Tab + "public override Playable CreateTrackMixer(PlayableGraph graph, GameObject go, int inputCount)\n" +
-            k_Tab + "{\n" +
+            k_Tab + "{\n" +
-            k_Tab + k_Tab + "return ScriptPlayable<" + playableName + k_PlayableBehaviourMixerSuffix + ">.Create (graph, inputCount);\n" +
+            k_Tab + k_Tab + "return ScriptPlayable<" + playableName + k_PlayableBehaviourMixerSuffix + ">.Create (graph, inputCount);\n" +
-            k_Tab + "}\n" +
+            k_Tab + "}\n" +
-            "\n" +
+            "\n" +
-            k_Tab + "// Please note this assumes only one component of type " + trackBinding.name + " on the same gameobject.\n" +
+            k_Tab + "// Please note this assumes only one component of type " + trackBinding.name + " on the same gameobject.\n" +
-            k_Tab + "public override void GatherProperties (PlayableDirector director, IPropertyCollector driver)\n" +
+            k_Tab + "public override void GatherProperties (PlayableDirector director, IPropertyCollector driver)\n" +
-            k_Tab + "{\n" +
+            k_Tab + "{\n" +
-            "#if UNITY_EDITOR\n" +
+            "#if UNITY_EDITOR\n" +
-            k_Tab + k_Tab + trackBinding.name + " trackBinding = director.GetGenericBinding(this) as " + trackBinding.name + ";\n" +
+            k_Tab + k_Tab + trackBinding.name + " trackBinding = director.GetGenericBinding(this) as " + trackBinding.name + ";\n" +
-            k_Tab + k_Tab + "if (trackBinding == null)\n" +
+            k_Tab + k_Tab + "if (trackBinding == null)\n" +
-            k_Tab + k_Tab + k_Tab + "return;\n" +
+            k_Tab + k_Tab + k_Tab + "return;\n" +
-            "\n" +
+            "\n" +
-            //k_Tab + k_Tab + "var serializedObject = new UnityEditor.SerializedObject (trackBinding);\n" +
+            //k_Tab + k_Tab + "var serializedObject = new UnityEditor.SerializedObject (trackBinding);\n" +
-            //k_Tab + k_Tab + "var iterator = serializedObject.GetIterator();\n" +
+            //k_Tab + k_Tab + "var iterator = serializedObject.GetIterator();\n" +
-            //k_Tab + k_Tab + "while (iterator.NextVisible(true))\n" +
+            //k_Tab + k_Tab + "while (iterator.NextVisible(true))\n" +
-            //k_Tab + k_Tab + "{\n" +
+            //k_Tab + k_Tab + "{\n" +
-            //k_Tab + k_Tab + k_Tab + "if (iterator.hasVisibleChildren)\n" +
+            //k_Tab + k_Tab + k_Tab + "if (iterator.hasVisibleChildren)\n" +
-            //k_Tab + k_Tab + k_Tab + k_Tab + "continue;\n" +
+            //k_Tab + k_Tab + k_Tab + k_Tab + "continue;\n" +
-            //"\n" +
+            //"\n" +
-            //k_Tab + k_Tab + k_Tab + "driver.AddFromName<" + trackBinding.name + ">(trackBinding.gameObject, iterator.propertyPath);\n" +
+            //k_Tab + k_Tab + k_Tab + "driver.AddFromName<" + trackBinding.name + ">(trackBinding.gameObject, iterator.propertyPath);\n" +
-            //k_Tab + k_Tab + "}\n" +
+            //k_Tab + k_Tab + "}\n" +
-            StandardBlendPropertiesAssignedToPropertyDriverToString () +
+            StandardBlendPropertiesAssignedToPropertyDriverToString () +
-            "#endif\n" +
+            "#endif\n" +
-            k_Tab + k_Tab + "base.GatherProperties (director, driver);\n" +
+            k_Tab + k_Tab + "base.GatherProperties (director, driver);\n" +
-            k_Tab + "}\n" +
+            k_Tab + "}\n" +
-            "}\n";
+            "}\n";
-    }
+    }
-    
+    
-    string StandardBlendPlayableDrawer ()
+    string StandardBlendPlayableDrawer ()
-    {
+    {
-        return
+        return
-            "using UnityEditor;\n" +
+            "using UnityEditor;\n" +
-            "using UnityEngine;\n" +
+            "using UnityEngine;\n" +
-            "using UnityEngine.Playables;\n" +
+            "using UnityEngine.Playables;\n" +
-            AdditionalNamespacesToString() +
+            AdditionalNamespacesToString() +
-            "\n" +
+            "\n" +
-            "[CustomPropertyDrawer(typeof(" + playableName + k_TimelineClipBehaviourSuffix + "))]\n" +
+            "[CustomPropertyDrawer(typeof(" + playableName + k_TimelineClipBehaviourSuffix + "))]\n" +
-            "public class " + playableName + k_PropertyDrawerSuffix + " : PropertyDrawer\n" +
+            "public class " + playableName + k_PropertyDrawerSuffix + " : PropertyDrawer\n" +
-            "{\n" +
+            "{\n" +
-            k_Tab + "public override float GetPropertyHeight (SerializedProperty property, GUIContent label)\n" +
+            k_Tab + "public override float GetPropertyHeight (SerializedProperty property, GUIContent label)\n" +
-            k_Tab + "{\n" +
+            k_Tab + "{\n" +
-            k_Tab + k_Tab + "int fieldCount = " + standardBlendPlayableProperties.Count + ";\n" +
+            k_Tab + k_Tab + "int fieldCount = " + standardBlendPlayableProperties.Count + ";\n" +
-            k_Tab + k_Tab + "return fieldCount * EditorGUIUtility.singleLineHeight;\n" +
+            k_Tab + k_Tab + "return fieldCount * EditorGUIUtility.singleLineHeight;\n" +
-            k_Tab + "}\n" +
+            k_Tab + "}\n" +
-            "\n" +
+            "\n" +
-            k_Tab + "public override void OnGUI (Rect position, SerializedProperty property, GUIContent label)\n" +
+            k_Tab + "public override void OnGUI (Rect position, SerializedProperty property, GUIContent label)\n" +
-            k_Tab + "{\n" +
+            k_Tab + "{\n" +
-            StandardBlendTrackBindingPropertiesAsSerializedPropsDeclarationToString () +
+            StandardBlendTrackBindingPropertiesAsSerializedPropsDeclarationToString () +
-            "\n" +
+            "\n" +
-            k_Tab + k_Tab + "Rect singleFieldRect = new Rect(position.x, position.y, position.width, EditorGUIUtility.singleLineHeight);\n" +
+            k_Tab + k_Tab + "Rect singleFieldRect = new Rect(position.x, position.y, position.width, EditorGUIUtility.singleLineHeight);\n" +
-            StandardBlendSerializedPropertyGUIToString () +
+            StandardBlendSerializedPropertyGUIToString () +
-            k_Tab + "}\n" +
+            k_Tab + "}\n" +
-            "}\n";
+            "}\n";
-    }
+    }
-    
+    
-    string StandardBlendScriptPlayablePropertiesToString ()
+    string StandardBlendScriptPlayablePropertiesToString ()
-    {
+    {
-        string returnVal = "";
+        string returnVal = "";
-        for (int i = 0; i < standardBlendPlayableProperties.Count; i++)
+        for (int i = 0; i < standardBlendPlayableProperties.Count; i++)
-        {
+        {
-            UsableProperty prop = standardBlendPlayableProperties[i];
+            UsableProperty prop = standardBlendPlayableProperties[i];
-            if(prop.defaultValue == "")
+            if(prop.defaultValue == "")
-                returnVal += k_Tab + "public " + prop.type + " " + prop.name + ";\n";
+                returnVal += k_Tab + "public " + prop.type + " " + prop.name + ";\n";
-            else
+            else
-            {
+            {
-                returnVal += k_Tab + "public " + prop.type + " " + prop.name + " = " + prop.defaultValue + ";\n";
+                returnVal += k_Tab + "public " + prop.type + " " + prop.name + " = " + prop.defaultValue + ";\n";
-            }
+            }
-        }
+        }
-        return returnVal;
+        return returnVal;
-    }
+    }
-
+
-    string StandardBlendTrackBindingPropertiesDefaultsDeclarationToString ()
+    string StandardBlendTrackBindingPropertiesDefaultsDeclarationToString ()
-    {
+    {
-        string returnVal = "";
+        string returnVal = "";
-        for (int i = 0; i < standardBlendPlayableProperties.Count; i++)
+        for (int i = 0; i < standardBlendPlayableProperties.Count; i++)
-        {
+        {
-            UsableProperty prop = standardBlendPlayableProperties[i];
+            UsableProperty prop = standardBlendPlayableProperties[i];
-            returnVal += k_Tab + prop.type + " " + prop.NameAsPrivateDefault + ";\n";
+            returnVal += k_Tab + prop.type + " " + prop.NameAsPrivateDefault + ";\n";
-        }
+        }
-        return returnVal;
+        return returnVal;
-    }
+    }
-
+
-    string StandardBlendTrackBindingPropertiesBlendedDeclarationToString ()
+    string StandardBlendTrackBindingPropertiesBlendedDeclarationToString ()
-    {
+    {
-        string returnVal = "";
+        string returnVal = "";
-        for (int i = 0; i < standardBlendPlayableProperties.Count; i++)
+        for (int i = 0; i < standardBlendPlayableProperties.Count; i++)
-        {
+        {
-            UsableProperty prop = standardBlendPlayableProperties[i];
+            UsableProperty prop = standardBlendPlayableProperties[i];
-            
+            
-            returnVal += k_Tab + prop.type + " " + prop.NameAsPrivateAssigned + ";\n";
+            returnVal += k_Tab + prop.type + " " + prop.NameAsPrivateAssigned + ";\n";
-        }
+        }
-        return returnVal;
+        return returnVal;
-    }
+    }
-
+
-    string StandardBlendTrackBindingPropertiesDefaultsAssignmentToString ()
+    string StandardBlendTrackBindingPropertiesDefaultsAssignmentToString ()
-    {
+    {
-        string returnVal = "";
+        string returnVal = "";
-        for (int i = 0; i < standardBlendPlayableProperties.Count; i++)
+        for (int i = 0; i < standardBlendPlayableProperties.Count; i++)
-        {
+        {
-            UsableProperty prop = standardBlendPlayableProperties[i];
+            UsableProperty prop = standardBlendPlayableProperties[i];
-
+
-            switch (prop.type)
+            switch (prop.type)
-            {
+            {
-                case "float":
+                case "float":
-                    returnVal += k_Tab + k_Tab + "if (!Mathf.Approximately(m_TrackBinding." + prop.name + ", " + prop.NameAsPrivateAssigned + "))\n";
+                    returnVal += k_Tab + k_Tab + "if (!Mathf.Approximately(m_TrackBinding." + prop.name + ", " + prop.NameAsPrivateAssigned + "))\n";
-                    returnVal += k_Tab + k_Tab + k_Tab + prop.NameAsPrivateDefault + " = m_TrackBinding." + prop.name + ";\n";
+                    returnVal += k_Tab + k_Tab + k_Tab + prop.NameAsPrivateDefault + " = m_TrackBinding." + prop.name + ";\n";
-                    break;
+                    break;
-                case "double":
+                case "double":
-                    returnVal += k_Tab + k_Tab + "if (!Mathf.Approximately((float)m_TrackBinding." + prop.name + ", (float)" + prop.NameAsPrivateAssigned + "))\n";
+                    returnVal += k_Tab + k_Tab + "if (!Mathf.Approximately((float)m_TrackBinding." + prop.name + ", (float)" + prop.NameAsPrivateAssigned + "))\n";
-                    returnVal += k_Tab + k_Tab + k_Tab + prop.NameAsPrivateDefault + " = m_TrackBinding." + prop.name + ";\n";
+                    returnVal += k_Tab + k_Tab + k_Tab + prop.NameAsPrivateDefault + " = m_TrackBinding." + prop.name + ";\n";
-                    break;
+                    break;
-                default:
+                default:
-                    returnVal += k_Tab + k_Tab + "if (m_TrackBinding." + prop.name + " != " + prop.NameAsPrivateAssigned + ")\n";
+                    returnVal += k_Tab + k_Tab + "if (m_TrackBinding." + prop.name + " != " + prop.NameAsPrivateAssigned + ")\n";
-                    returnVal += k_Tab + k_Tab + k_Tab + prop.NameAsPrivateDefault + " = m_TrackBinding." + prop.name + ";\n";
+                    returnVal += k_Tab + k_Tab + k_Tab + prop.NameAsPrivateDefault + " = m_TrackBinding." + prop.name + ";\n";
-                    break;
+                    break;
-            }
+            }
-        }
+        }
-        return returnVal;
+        return returnVal;
-    }
+    }
-
+
-    string StandardBlendBlendedVariablesCreationToString ()
+    string StandardBlendBlendedVariablesCreationToString ()
-    {
+    {
-        string returnVal = "";
+        string returnVal = "";
-        for (int i = 0; i < standardBlendPlayableProperties.Count; i++)
+        for (int i = 0; i < standardBlendPlayableProperties.Count; i++)
-        {
+        {
-            UsableProperty prop = standardBlendPlayableProperties[i];
+            UsableProperty prop = standardBlendPlayableProperties[i];
-            
+            
-            if(prop.usability != UsableProperty.Usability.Blendable)
+            if(prop.usability != UsableProperty.Usability.Blendable)
-                continue;
+                continue;
-            
+            
-            string type = prop.type == "int" ? "float" : prop.type;
+            string type = prop.type == "int" ? "float" : prop.type;
-            string zeroVal = prop.type == "int" ? "0f" : prop.ZeroValueAsString ();
+            string zeroVal = prop.type == "int" ? "0f" : prop.ZeroValueAsString ();
-            returnVal += k_Tab + k_Tab + type + " " + prop.NameAsLocalBlended + " = " + zeroVal + ";\n";
+            returnVal += k_Tab + k_Tab + type + " " + prop.NameAsLocalBlended + " = " + zeroVal + ";\n";
-        }
+        }
-        return returnVal;
+        return returnVal;
-    }
+    }
-
+
-    string StandardBlendPlayableCurrentInputsDeclarationToString ()
+    string StandardBlendPlayableCurrentInputsDeclarationToString ()
-    {
+    {
-        if (standardBlendPlayableProperties.Any (x => x.usability == UsableProperty.Usability.Assignable))
+        if (standardBlendPlayableProperties.Any (x => x.usability == UsableProperty.Usability.Assignable))
-        {
+        {
-            return k_Tab + k_Tab + "int currentInputs = 0;\n";
+            return k_Tab + k_Tab + "int currentInputs = 0;\n";
-        }
+        }
-        return "";
+        return "";
-    }
+    }
-
+
-    string StandardBlendBlendedVariablesWeightedIncrementationToString ()
+    string StandardBlendBlendedVariablesWeightedIncrementationToString ()
-    {
+    {
-        string returnVal = "";
+        string returnVal = "";
-        for (int i = 0; i < standardBlendPlayableProperties.Count; i++)
+        for (int i = 0; i < standardBlendPlayableProperties.Count; i++)
-        {
+        {
-            UsableProperty prop = standardBlendPlayableProperties[i];
+            UsableProperty prop = standardBlendPlayableProperties[i];
-            
+            
-            if (prop.usability == UsableProperty.Usability.Blendable)
+            if (prop.usability == UsableProperty.Usability.Blendable)
-                returnVal += k_Tab + k_Tab + k_Tab + prop.NameAsLocalBlended + " += input." + prop.name + " * inputWeight;\n";
+                returnVal += k_Tab + k_Tab + k_Tab + prop.NameAsLocalBlended + " += input." + prop.name + " * inputWeight;\n";
-            
+            
-        }
+        }
-        return returnVal;
+        return returnVal;
-    }
+    }
-
+
-    string StandardBlendAssignableVariablesAssignedBasedOnGreatestWeightToString ()
+    string StandardBlendAssignableVariablesAssignedBasedOnGreatestWeightToString ()
-    {
+    {
-        if (standardBlendPlayableProperties.Count == 0)
+        if (standardBlendPlayableProperties.Count == 0)
-            return "";
+            return "";
-
+
-        string returnVal = k_Tab + k_Tab + k_Tab + "if (inputWeight > greatestWeight)\n";
+        string returnVal = k_Tab + k_Tab + k_Tab + "if (inputWeight > greatestWeight)\n";
-        returnVal += k_Tab + k_Tab + k_Tab + "{\n";
+        returnVal += k_Tab + k_Tab + k_Tab + "{\n";
-        for (int i = 0; i < standardBlendPlayableProperties.Count; i++)
+        for (int i = 0; i < standardBlendPlayableProperties.Count; i++)
-        {
+        {
-            UsableProperty prop = standardBlendPlayableProperties[i];
+            UsableProperty prop = standardBlendPlayableProperties[i];
-            if (prop.usability == UsableProperty.Usability.Assignable)
+            if (prop.usability == UsableProperty.Usability.Assignable)
-            {
+            {
-                returnVal += k_Tab + k_Tab + k_Tab + k_Tab + prop.NameAsPrivateAssigned + " = input." + prop.name + ";\n";
+                returnVal += k_Tab + k_Tab + k_Tab + k_Tab + prop.NameAsPrivateAssigned + " = input." + prop.name + ";\n";
-                returnVal += k_Tab + k_Tab + k_Tab + k_Tab + "m_TrackBinding." + prop.name + " = " + prop.NameAsPrivateAssigned + ";\n";
+                returnVal += k_Tab + k_Tab + k_Tab + k_Tab + "m_TrackBinding." + prop.name + " = " + prop.NameAsPrivateAssigned + ";\n";
-            }
+            }
-        }
+        }
-        returnVal += k_Tab + k_Tab + k_Tab + k_Tab + "greatestWeight = inputWeight;\n";
+        returnVal += k_Tab + k_Tab + k_Tab + k_Tab + "greatestWeight = inputWeight;\n";
-        returnVal += k_Tab + k_Tab + k_Tab + "}\n";
+        returnVal += k_Tab + k_Tab + k_Tab + "}\n";
-        return returnVal;
+        return returnVal;
-    }
+    }
-
+
-    string StandardBlendPlayableCurrentInputIterationToString ()
+    string StandardBlendPlayableCurrentInputIterationToString ()
-    {
+    {
-        if (standardBlendPlayableProperties.Any (x => x.usability == UsableProperty.Usability.Assignable))
+        if (standardBlendPlayableProperties.Any (x => x.usability == UsableProperty.Usability.Assignable))
-        {
+        {
-            string returnVal = "\n";
+            string returnVal = "\n";
-            returnVal += k_Tab + k_Tab + k_Tab + "if (!Mathf.Approximately (inputWeight, 0f))\n";
+            returnVal += k_Tab + k_Tab + k_Tab + "if (!Mathf.Approximately (inputWeight, 0f))\n";
-            returnVal += k_Tab + k_Tab + k_Tab + k_Tab + "currentInputs++;\n";
+            returnVal += k_Tab + k_Tab + k_Tab + k_Tab + "currentInputs++;\n";
-            return returnVal;
+            return returnVal;
-        }
+        }
-        return "";
+        return "";
-    }
+    }
-
+
-    string StandardBlendTrackBindingPropertiesBlendedAssignmentToString ()
+    string StandardBlendTrackBindingPropertiesBlendedAssignmentToString ()
-    {
+    {
-        string returnVal = "";
+        string returnVal = "";
-        bool firstNewLine = false;
+        bool firstNewLine = false;
-        for (int i = 0; i < standardBlendPlayableProperties.Count; i++)
+        for (int i = 0; i < standardBlendPlayableProperties.Count; i++)
-        {
+        {
-            UsableProperty prop = standardBlendPlayableProperties[i];
+            UsableProperty prop = standardBlendPlayableProperties[i];
-            if (prop.usability != UsableProperty.Usability.Blendable)
+            if (prop.usability != UsableProperty.Usability.Blendable)
-                continue;
+                continue;
-
+
-            if (!firstNewLine)
+            if (!firstNewLine)
-            {
+            {
-                firstNewLine = true;
+                firstNewLine = true;
-                returnVal += "\n";
+                returnVal += "\n";
-            }
+            }
-            
+            
-            if (prop.type == "int")
+            if (prop.type == "int")
-                returnVal += k_Tab + k_Tab + prop.NameAsPrivateAssigned + " = Mathf.RoundToInt (" + prop.NameAsLocalBlended + " + " + prop.NameAsPrivateDefault + " * (1f - totalWeight));\n";
+                returnVal += k_Tab + k_Tab + prop.NameAsPrivateAssigned + " = Mathf.RoundToInt (" + prop.NameAsLocalBlended + " + " + prop.NameAsPrivateDefault + " * (1f - totalWeight));\n";
-            else
+            else
-                returnVal += k_Tab + k_Tab + prop.NameAsPrivateAssigned + " = " + prop.NameAsLocalBlended + " + " + prop.NameAsPrivateDefault + " * (1f - totalWeight);\n";
+                returnVal += k_Tab + k_Tab + prop.NameAsPrivateAssigned + " = " + prop.NameAsLocalBlended + " + " + prop.NameAsPrivateDefault + " * (1f - totalWeight);\n";
-
+
-            returnVal += k_Tab + k_Tab + "m_TrackBinding." + prop.name + " = " + prop.NameAsPrivateAssigned + ";\n";
+            returnVal += k_Tab + k_Tab + "m_TrackBinding." + prop.name + " = " + prop.NameAsPrivateAssigned + ";\n";
-        }
+        }
-        return returnVal;
+        return returnVal;
-    }
+    }
-
+
-    string StandardBlendTrackBindingPropertiesAssignableAssignmentToString ()
+    string StandardBlendTrackBindingPropertiesAssignableAssignmentToString ()
-    {
+    {
-        if (standardBlendPlayableProperties.Count == 0)
+        if (standardBlendPlayableProperties.Count == 0)
-            return "";
+            return "";
-
+
-        if (standardBlendPlayableProperties.Any (x => x.usability == UsableProperty.Usability.Assignable))
+        if (standardBlendPlayableProperties.Any (x => x.usability == UsableProperty.Usability.Assignable))
-        {
+        {
-            string returnVal = "\n" + k_Tab + k_Tab + "if (currentInputs != 1 && 1f - totalWeight > greatestWeight)\n";
+            string returnVal = "\n" + k_Tab + k_Tab + "if (currentInputs != 1 && 1f - totalWeight > greatestWeight)\n";
-            returnVal += k_Tab + k_Tab + "{\n";
+            returnVal += k_Tab + k_Tab + "{\n";
-            for (int i = 0; i < standardBlendPlayableProperties.Count; i++)
+            for (int i = 0; i < standardBlendPlayableProperties.Count; i++)
-            {
+            {
-                UsableProperty prop = standardBlendPlayableProperties[i];
+                UsableProperty prop = standardBlendPlayableProperties[i];
-                if (prop.usability != UsableProperty.Usability.Assignable)
+                if (prop.usability != UsableProperty.Usability.Assignable)
-                    continue;
+                    continue;
-
+
-                returnVal += k_Tab + k_Tab + k_Tab + "m_TrackBinding." + prop.name + " = " + prop.NameAsPrivateDefault + ";\n";
+                returnVal += k_Tab + k_Tab + k_Tab + "m_TrackBinding." + prop.name + " = " + prop.NameAsPrivateDefault + ";\n";
-            }
+            }
-            returnVal += k_Tab + k_Tab + "}\n";
+            returnVal += k_Tab + k_Tab + "}\n";
-            return returnVal;
+            return returnVal;
-        }
+        }
-
+
-        return "";
+        return "";
-    }
+    }
-
+
-    string StandardBlendComponentBindingToString ()
+    string StandardBlendComponentBindingToString ()
-    {
+    {
-        return "[TrackBindingType(typeof(" + trackBinding.name + "))]\n";
+        return "[TrackBindingType(typeof(" + trackBinding.name + "))]\n";
-    }
+    }
-
+
-    string StandardBlendPropertiesAssignedToPropertyDriverToString ()
+    string StandardBlendPropertiesAssignedToPropertyDriverToString ()
-    {
+    {
-        if (standardBlendPlayableProperties.Count == 0)
+        if (standardBlendPlayableProperties.Count == 0)
-            return "";
+            return "";
-
+
-        string returnVal = k_Tab + k_Tab + "// These field names are procedurally generated estimations based on the associated property names.\n";
+        string returnVal = k_Tab + k_Tab + "// These field names are procedurally generated estimations based on the associated property names.\n";
-        returnVal += k_Tab + k_Tab + "// If any of the names are incorrect you will get a DrivenPropertyManager error saying it has failed to register the name.\n";
+        returnVal += k_Tab + k_Tab + "// If any of the names are incorrect you will get a DrivenPropertyManager error saying it has failed to register the name.\n";
-        returnVal += k_Tab + k_Tab + "// In this case you will need to find the correct backing field name.\n";
+        returnVal += k_Tab + k_Tab + "// In this case you will need to find the correct backing field name.\n";
-        returnVal += k_Tab + k_Tab + "// The suggested way of finding the field name is to:\n";
+        returnVal += k_Tab + k_Tab + "// The suggested way of finding the field name is to:\n";
-        returnVal += k_Tab + k_Tab + "// 1. Make sure your scene is serialized to text.\n";
+        returnVal += k_Tab + k_Tab + "// 1. Make sure your scene is serialized to text.\n";
-        returnVal += k_Tab + k_Tab + "// 2. Search the text for the track binding component type.\n";
+        returnVal += k_Tab + k_Tab + "// 2. Search the text for the track binding component type.\n";
-        returnVal += k_Tab + k_Tab + "// 3. Look through the field names until you see one that looks correct.\n";
+        returnVal += k_Tab + k_Tab + "// 3. Look through the field names until you see one that looks correct.\n";
-
+
-        for (int i = 0; i < standardBlendPlayableProperties.Count; i++)
+        for (int i = 0; i < standardBlendPlayableProperties.Count; i++)
-        {
+        {
-            UsableProperty prop = standardBlendPlayableProperties[i];
+            UsableProperty prop = standardBlendPlayableProperties[i];
-
+
-            if (prop.usablePropertyType == UsableProperty.UsablePropertyType.Field)
+            if (prop.usablePropertyType == UsableProperty.UsablePropertyType.Field)
-            {
+            {
-                returnVal += k_Tab + k_Tab + "driver.AddFromName<" + trackBinding.name + ">(trackBinding.gameObject, \"" + prop.name + "\");\n";
+                returnVal += k_Tab + k_Tab + "driver.AddFromName<" + trackBinding.name + ">(trackBinding.gameObject, \"" + prop.name + "\");\n";
-            }
+            }
-            else
+            else
-            {
+            {
-                returnVal += k_Tab + k_Tab + "driver.AddFromName<" + trackBinding.name + ">(trackBinding.gameObject, \"" + prop.NameAsPrivate + "\");\n";
+                returnVal += k_Tab + k_Tab + "driver.AddFromName<" + trackBinding.name + ">(trackBinding.gameObject, \"" + prop.NameAsPrivate + "\");\n";
-            }
+            }
-        }
+        }
-
+
-        return returnVal;
+        return returnVal;
-    }
+    }
-
+
-    string StandardBlendTrackBindingPropertiesAsSerializedPropsDeclarationToString ()
+    string StandardBlendTrackBindingPropertiesAsSerializedPropsDeclarationToString ()
-    {
+    {
-        string returnVal = "";
+        string returnVal = "";
-        for (int i = 0; i < standardBlendPlayableProperties.Count; i++)
+        for (int i = 0; i < standardBlendPlayableProperties.Count; i++)
-        {
+        {
-            UsableProperty prop = standardBlendPlayableProperties[i];
+            UsableProperty prop = standardBlendPlayableProperties[i];
-            returnVal += k_Tab + k_Tab + "SerializedProperty " + prop.NameAsLocalSerializedProperty + " = property.FindPropertyRelative(\"" + prop.name + "\");\n";
+            returnVal += k_Tab + k_Tab + "SerializedProperty " + prop.NameAsLocalSerializedProperty + " = property.FindPropertyRelative(\"" + prop.name + "\");\n";
-        }
+        }
-        return returnVal;
+        return returnVal;
-    }
+    }
-
+
-    string StandardBlendSerializedPropertyGUIToString ()
+    string StandardBlendSerializedPropertyGUIToString ()
-    {
+    {
-        string returnVal = "";
+        string returnVal = "";
-        for (int i = 0; i < standardBlendPlayableProperties.Count; i++)
+        for (int i = 0; i < standardBlendPlayableProperties.Count; i++)
-        {
+        {
-            if (i != 0)
+            if (i != 0)
-            {
+            {
-                returnVal += "\n";
+                returnVal += "\n";
-                returnVal += k_Tab + k_Tab + "singleFieldRect.y += EditorGUIUtility.singleLineHeight;\n";
+                returnVal += k_Tab + k_Tab + "singleFieldRect.y += EditorGUIUtility.singleLineHeight;\n";
-            }
+            }
-
+
-            returnVal += k_Tab + k_Tab + "EditorGUI.PropertyField(singleFieldRect, " + standardBlendPlayableProperties[i].NameAsLocalSerializedProperty + ");\n";
+            returnVal += k_Tab + k_Tab + "EditorGUI.PropertyField(singleFieldRect, " + standardBlendPlayableProperties[i].NameAsLocalSerializedProperty + ");\n";
-        }
+        }
-        return returnVal;
+        return returnVal;
-    }
+    }
-}
+}

+ 12 - 12
Assets/DefaultPlayables/Editor/TimelinePlayableWizard.cs.meta

@@ -1,12 +1,12 @@
-fileFormatVersion: 2
+fileFormatVersion: 2
-guid: 01cfeabdfa5f36740b2b9c9658bbb29e
+guid: 01cfeabdfa5f36740b2b9c9658bbb29e
-timeCreated: 1490191896
+timeCreated: 1490191896
-licenseType: Store
+licenseType: Store
-MonoImporter:
+MonoImporter:
-  serializedVersion: 2
+  serializedVersion: 2
-  defaultReferences: []
+  defaultReferences: []
-  executionOrder: 0
+  executionOrder: 0
-  icon: {instanceID: 0}
+  icon: {instanceID: 0}
-  userData: 
+  userData: 
-  assetBundleName: 
+  assetBundleName: 
-  assetBundleVariant: 
+  assetBundleVariant: 

+ 33 - 33
Assets/DefaultPlayables/LightControl/Editor/LightControlDrawer.cs

@@ -1,33 +1,33 @@
-using UnityEditor;
+using UnityEditor;
-using UnityEngine;
+using UnityEngine;
-using UnityEngine.Playables;
+using UnityEngine.Playables;
-
+
-[CustomPropertyDrawer(typeof(LightControlBehaviour))]
+[CustomPropertyDrawer(typeof(LightControlBehaviour))]
-public class LightControlDrawer : PropertyDrawer
+public class LightControlDrawer : PropertyDrawer
-{
+{
-    public override float GetPropertyHeight (SerializedProperty property, GUIContent label)
+    public override float GetPropertyHeight (SerializedProperty property, GUIContent label)
-    {
+    {
-        int fieldCount = 4;
+        int fieldCount = 4;
-        return fieldCount * EditorGUIUtility.singleLineHeight;
+        return fieldCount * EditorGUIUtility.singleLineHeight;
-    }
+    }
-
+
-    public override void OnGUI (Rect position, SerializedProperty property, GUIContent label)
+    public override void OnGUI (Rect position, SerializedProperty property, GUIContent label)
-    {
+    {
-        SerializedProperty colorProp = property.FindPropertyRelative("color");
+        SerializedProperty colorProp = property.FindPropertyRelative("color");
-        SerializedProperty intensityProp = property.FindPropertyRelative("intensity");
+        SerializedProperty intensityProp = property.FindPropertyRelative("intensity");
-        SerializedProperty bounceIntensityProp = property.FindPropertyRelative("bounceIntensity");
+        SerializedProperty bounceIntensityProp = property.FindPropertyRelative("bounceIntensity");
-        SerializedProperty rangeProp = property.FindPropertyRelative("range");
+        SerializedProperty rangeProp = property.FindPropertyRelative("range");
-
+
-        Rect singleFieldRect = new Rect(position.x, position.y, position.width, EditorGUIUtility.singleLineHeight);
+        Rect singleFieldRect = new Rect(position.x, position.y, position.width, EditorGUIUtility.singleLineHeight);
-        EditorGUI.PropertyField(singleFieldRect, colorProp);
+        EditorGUI.PropertyField(singleFieldRect, colorProp);
-        
+        
-        singleFieldRect.y += EditorGUIUtility.singleLineHeight;
+        singleFieldRect.y += EditorGUIUtility.singleLineHeight;
-        EditorGUI.PropertyField(singleFieldRect, intensityProp);
+        EditorGUI.PropertyField(singleFieldRect, intensityProp);
-        
+        
-        singleFieldRect.y += EditorGUIUtility.singleLineHeight;
+        singleFieldRect.y += EditorGUIUtility.singleLineHeight;
-        EditorGUI.PropertyField(singleFieldRect, bounceIntensityProp);
+        EditorGUI.PropertyField(singleFieldRect, bounceIntensityProp);
-        
+        
-        singleFieldRect.y += EditorGUIUtility.singleLineHeight;
+        singleFieldRect.y += EditorGUIUtility.singleLineHeight;
-        EditorGUI.PropertyField(singleFieldRect, rangeProp);
+        EditorGUI.PropertyField(singleFieldRect, rangeProp);
-    }
+    }
-}
+}

+ 12 - 12
Assets/DefaultPlayables/LightControl/Editor/LightControlDrawer.cs.meta

@@ -1,12 +1,12 @@
-fileFormatVersion: 2
+fileFormatVersion: 2
-guid: a217f65052ddf094ba45e737b2428b1c
+guid: a217f65052ddf094ba45e737b2428b1c
-timeCreated: 1496915002
+timeCreated: 1496915002
-licenseType: Store
+licenseType: Store
-MonoImporter:
+MonoImporter:
-  serializedVersion: 2
+  serializedVersion: 2
-  defaultReferences: []
+  defaultReferences: []
-  executionOrder: 0
+  executionOrder: 0
-  icon: {instanceID: 0}
+  icon: {instanceID: 0}
-  userData: 
+  userData: 
-  assetBundleName: 
+  assetBundleName: 
-  assetBundleVariant: 
+  assetBundleVariant: 

+ 13 - 13
Assets/DefaultPlayables/LightControl/LightControlBehaviour.cs

@@ -1,13 +1,13 @@
-using System;
+using System;
-using UnityEngine;
+using UnityEngine;
-using UnityEngine.Playables;
+using UnityEngine.Playables;
-using UnityEngine.Timeline;
+using UnityEngine.Timeline;
-
+
-[Serializable]
+[Serializable]
-public class LightControlBehaviour : PlayableBehaviour
+public class LightControlBehaviour : PlayableBehaviour
-{
+{
-    public Color color = Color.white;
+    public Color color = Color.white;
-    public float intensity = 1f;
+    public float intensity = 1f;
-    public float bounceIntensity = 1f;
+    public float bounceIntensity = 1f;
-    public float range = 10f;
+    public float range = 10f;
-}
+}

+ 12 - 12
Assets/DefaultPlayables/LightControl/LightControlBehaviour.cs.meta

@@ -1,12 +1,12 @@
-fileFormatVersion: 2
+fileFormatVersion: 2
-guid: 7e7c747bf1731824682c539494feba37
+guid: 7e7c747bf1731824682c539494feba37
-timeCreated: 1496915002
+timeCreated: 1496915002
-licenseType: Store
+licenseType: Store
-MonoImporter:
+MonoImporter:
-  serializedVersion: 2
+  serializedVersion: 2
-  defaultReferences: []
+  defaultReferences: []
-  executionOrder: 0
+  executionOrder: 0
-  icon: {instanceID: 0}
+  icon: {instanceID: 0}
-  userData: 
+  userData: 
-  assetBundleName: 
+  assetBundleName: 
-  assetBundleVariant: 
+  assetBundleVariant: 

+ 20 - 20
Assets/DefaultPlayables/LightControl/LightControlClip.cs

@@ -1,20 +1,20 @@
-using System;
+using System;
-using UnityEngine;
+using UnityEngine;
-using UnityEngine.Playables;
+using UnityEngine.Playables;
-using UnityEngine.Timeline;
+using UnityEngine.Timeline;
-
+
-[Serializable]
+[Serializable]
-public class LightControlClip : PlayableAsset, ITimelineClipAsset
+public class LightControlClip : PlayableAsset, ITimelineClipAsset
-{
+{
-    public LightControlBehaviour template = new LightControlBehaviour ();
+    public LightControlBehaviour template = new LightControlBehaviour ();
-
+
-    public ClipCaps clipCaps
+    public ClipCaps clipCaps
-    {
+    {
-        get { return ClipCaps.Blending; }
+        get { return ClipCaps.Blending; }
-    }
+    }
-
+
-    public override Playable CreatePlayable (PlayableGraph graph, GameObject owner)
+    public override Playable CreatePlayable (PlayableGraph graph, GameObject owner)
-    {
+    {
-        var playable = ScriptPlayable<LightControlBehaviour>.Create (graph, template);
+        var playable = ScriptPlayable<LightControlBehaviour>.Create (graph, template);
-        return playable;    }
+        return playable;    }
-}
+}

+ 12 - 12
Assets/DefaultPlayables/LightControl/LightControlClip.cs.meta

@@ -1,12 +1,12 @@
-fileFormatVersion: 2
+fileFormatVersion: 2
-guid: 23b46759ef7b0fd4bb74d73bf4d2839b
+guid: 23b46759ef7b0fd4bb74d73bf4d2839b
-timeCreated: 1496915002
+timeCreated: 1496915002
-licenseType: Store
+licenseType: Store
-MonoImporter:
+MonoImporter:
-  serializedVersion: 2
+  serializedVersion: 2
-  defaultReferences: []
+  defaultReferences: []
-  executionOrder: 0
+  executionOrder: 0
-  icon: {instanceID: 0}
+  icon: {instanceID: 0}
-  userData: 
+  userData: 
-  assetBundleName: 
+  assetBundleName: 
-  assetBundleVariant: 
+  assetBundleVariant: 

+ 81 - 81
Assets/DefaultPlayables/LightControl/LightControlMixerBehaviour.cs

@@ -1,81 +1,81 @@
-using System;
+using System;
-using UnityEngine;
+using UnityEngine;
-using UnityEngine.Playables;
+using UnityEngine.Playables;
-using UnityEngine.Timeline;
+using UnityEngine.Timeline;
-
+
-public class LightControlMixerBehaviour : PlayableBehaviour
+public class LightControlMixerBehaviour : PlayableBehaviour
-{
+{
-    Color m_DefaultColor;
+    Color m_DefaultColor;
-    float m_DefaultIntensity;
+    float m_DefaultIntensity;
-    float m_DefaultBounceIntensity;
+    float m_DefaultBounceIntensity;
-    float m_DefaultRange;
+    float m_DefaultRange;
-
+
-    Light m_TrackBinding;
+    Light m_TrackBinding;
-    bool m_FirstFrameHappened;
+    bool m_FirstFrameHappened;
-
+
-    public override void ProcessFrame(Playable playable, FrameData info, object playerData)
+    public override void ProcessFrame(Playable playable, FrameData info, object playerData)
-    {
+    {
-        m_TrackBinding = playerData as Light;
+        m_TrackBinding = playerData as Light;
-
+
-        if (m_TrackBinding == null)
+        if (m_TrackBinding == null)
-            return;
+            return;
-
+
-        if (!m_FirstFrameHappened)
+        if (!m_FirstFrameHappened)
-        {
+        {
-            m_DefaultColor = m_TrackBinding.color;
+            m_DefaultColor = m_TrackBinding.color;
-            m_DefaultIntensity = m_TrackBinding.intensity;
+            m_DefaultIntensity = m_TrackBinding.intensity;
-            m_DefaultBounceIntensity = m_TrackBinding.bounceIntensity;
+            m_DefaultBounceIntensity = m_TrackBinding.bounceIntensity;
-            m_DefaultRange = m_TrackBinding.range;
+            m_DefaultRange = m_TrackBinding.range;
-            m_FirstFrameHappened = true;
+            m_FirstFrameHappened = true;
-        }
+        }
-
+
-        int inputCount = playable.GetInputCount ();
+        int inputCount = playable.GetInputCount ();
-
+
-        Color blendedColor = Color.clear;
+        Color blendedColor = Color.clear;
-        float blendedIntensity = 0f;
+        float blendedIntensity = 0f;
-        float blendedBounceIntensity = 0f;
+        float blendedBounceIntensity = 0f;
-        float blendedRange = 0f;
+        float blendedRange = 0f;
-        float totalWeight = 0f;
+        float totalWeight = 0f;
-        float greatestWeight = 0f;
+        float greatestWeight = 0f;
-        int currentInputs = 0;
+        int currentInputs = 0;
-
+
-        for (int i = 0; i < inputCount; i++)
+        for (int i = 0; i < inputCount; i++)
-        {
+        {
-            float inputWeight = playable.GetInputWeight(i);
+            float inputWeight = playable.GetInputWeight(i);
-            ScriptPlayable<LightControlBehaviour> inputPlayable = (ScriptPlayable<LightControlBehaviour>)playable.GetInput(i);
+            ScriptPlayable<LightControlBehaviour> inputPlayable = (ScriptPlayable<LightControlBehaviour>)playable.GetInput(i);
-            LightControlBehaviour input = inputPlayable.GetBehaviour ();
+            LightControlBehaviour input = inputPlayable.GetBehaviour ();
-            
+            
-            blendedColor += input.color * inputWeight;
+            blendedColor += input.color * inputWeight;
-            blendedIntensity += input.intensity * inputWeight;
+            blendedIntensity += input.intensity * inputWeight;
-            blendedBounceIntensity += input.bounceIntensity * inputWeight;
+            blendedBounceIntensity += input.bounceIntensity * inputWeight;
-            blendedRange += input.range * inputWeight;
+            blendedRange += input.range * inputWeight;
-            totalWeight += inputWeight;
+            totalWeight += inputWeight;
-
+
-            if (inputWeight > greatestWeight)
+            if (inputWeight > greatestWeight)
-            {
+            {
-                greatestWeight = inputWeight;
+                greatestWeight = inputWeight;
-            }
+            }
-
+
-            if (!Mathf.Approximately (inputWeight, 0f))
+            if (!Mathf.Approximately (inputWeight, 0f))
-                currentInputs++;
+                currentInputs++;
-        }
+        }
-
+
-        m_TrackBinding.color = blendedColor + m_DefaultColor * (1f - totalWeight);
+        m_TrackBinding.color = blendedColor + m_DefaultColor * (1f - totalWeight);
-        m_TrackBinding.intensity = blendedIntensity + m_DefaultIntensity * (1f - totalWeight);
+        m_TrackBinding.intensity = blendedIntensity + m_DefaultIntensity * (1f - totalWeight);
-        m_TrackBinding.bounceIntensity = blendedBounceIntensity + m_DefaultBounceIntensity * (1f - totalWeight);
+        m_TrackBinding.bounceIntensity = blendedBounceIntensity + m_DefaultBounceIntensity * (1f - totalWeight);
-        m_TrackBinding.range = blendedRange + m_DefaultRange * (1f - totalWeight);
+        m_TrackBinding.range = blendedRange + m_DefaultRange * (1f - totalWeight);
-    }
+    }
-
+
-    public override void OnPlayableDestroy (Playable playable)
+    public override void OnPlayableDestroy (Playable playable)
-    {
+    {
-        m_FirstFrameHappened = false;
+        m_FirstFrameHappened = false;
-
+
-        if(m_TrackBinding == null)
+        if(m_TrackBinding == null)
-            return;
+            return;
-
+
-        m_TrackBinding.color = m_DefaultColor;
+        m_TrackBinding.color = m_DefaultColor;
-        m_TrackBinding.intensity = m_DefaultIntensity;
+        m_TrackBinding.intensity = m_DefaultIntensity;
-        m_TrackBinding.bounceIntensity = m_DefaultBounceIntensity;
+        m_TrackBinding.bounceIntensity = m_DefaultBounceIntensity;
-        m_TrackBinding.range = m_DefaultRange;
+        m_TrackBinding.range = m_DefaultRange;
-    }
+    }
-}
+}

+ 12 - 12
Assets/DefaultPlayables/LightControl/LightControlMixerBehaviour.cs.meta

@@ -1,12 +1,12 @@
-fileFormatVersion: 2
+fileFormatVersion: 2
-guid: b6ddd7db188548f49bf8d55102e62b63
+guid: b6ddd7db188548f49bf8d55102e62b63
-timeCreated: 1496915002
+timeCreated: 1496915002
-licenseType: Store
+licenseType: Store
-MonoImporter:
+MonoImporter:
-  serializedVersion: 2
+  serializedVersion: 2
-  defaultReferences: []
+  defaultReferences: []
-  executionOrder: 0
+  executionOrder: 0
-  icon: {instanceID: 0}
+  icon: {instanceID: 0}
-  userData: 
+  userData: 
-  assetBundleName: 
+  assetBundleName: 
-  assetBundleVariant: 
+  assetBundleVariant: 

+ 29 - 29
Assets/DefaultPlayables/LightControl/LightControlTrack.cs

@@ -1,29 +1,29 @@
-using UnityEngine;
+using UnityEngine;
-using UnityEngine.Playables;
+using UnityEngine.Playables;
-using UnityEngine.Timeline;
+using UnityEngine.Timeline;
-using System.Collections.Generic;
+using System.Collections.Generic;
-
+
-[TrackColor(0.9454092f, 0.9779412f, 0.3883002f)]
+[TrackColor(0.9454092f, 0.9779412f, 0.3883002f)]
-[TrackClipType(typeof(LightControlClip))]
+[TrackClipType(typeof(LightControlClip))]
-[TrackBindingType(typeof(Light))]
+[TrackBindingType(typeof(Light))]
-public class LightControlTrack : TrackAsset
+public class LightControlTrack : TrackAsset
-{
+{
-    public override Playable CreateTrackMixer(PlayableGraph graph, GameObject go, int inputCount)
+    public override Playable CreateTrackMixer(PlayableGraph graph, GameObject go, int inputCount)
-    {
+    {
-        return ScriptPlayable<LightControlMixerBehaviour>.Create (graph, inputCount);
+        return ScriptPlayable<LightControlMixerBehaviour>.Create (graph, inputCount);
-    }
+    }
-
+
-    public override void GatherProperties(PlayableDirector director, IPropertyCollector driver)
+    public override void GatherProperties(PlayableDirector director, IPropertyCollector driver)
-    {
+    {
-#if UNITY_EDITOR
+#if UNITY_EDITOR
-       Light trackBinding = director.GetGenericBinding(this) as Light;
+       Light trackBinding = director.GetGenericBinding(this) as Light;
-       if (trackBinding == null)
+       if (trackBinding == null)
-           return;
+           return;
-       driver.AddFromName<Light>(trackBinding.gameObject, "m_Color");
+       driver.AddFromName<Light>(trackBinding.gameObject, "m_Color");
-       driver.AddFromName<Light>(trackBinding.gameObject, "m_Intensity");
+       driver.AddFromName<Light>(trackBinding.gameObject, "m_Intensity");
-       driver.AddFromName<Light>(trackBinding.gameObject, "m_Range");
+       driver.AddFromName<Light>(trackBinding.gameObject, "m_Range");
-       driver.AddFromName<Light>(trackBinding.gameObject, "m_BounceIntensity");
+       driver.AddFromName<Light>(trackBinding.gameObject, "m_BounceIntensity");
-#endif
+#endif
-        base.GatherProperties(director, driver);
+        base.GatherProperties(director, driver);
-    }
+    }
-}
+}

+ 12 - 12
Assets/DefaultPlayables/LightControl/LightControlTrack.cs.meta

@@ -1,12 +1,12 @@
-fileFormatVersion: 2
+fileFormatVersion: 2
-guid: e97b7684a1a63ed42afa5e89e962140f
+guid: e97b7684a1a63ed42afa5e89e962140f
-timeCreated: 1496915002
+timeCreated: 1496915002
-licenseType: Store
+licenseType: Store
-MonoImporter:
+MonoImporter:
-  serializedVersion: 2
+  serializedVersion: 2
-  defaultReferences: []
+  defaultReferences: []
-  executionOrder: 0
+  executionOrder: 0
-  icon: {instanceID: 0}
+  icon: {instanceID: 0}
-  userData: 
+  userData: 
-  assetBundleName: 
+  assetBundleName: 
-  assetBundleVariant: 
+  assetBundleVariant: 

+ 16 - 16
Assets/DefaultPlayables/NavMeshAgentControl/NavMeshAgentControlBehaviour.cs

@@ -1,16 +1,16 @@
-using System;
+using System;
-using UnityEngine;
+using UnityEngine;
-using UnityEngine.Playables;
+using UnityEngine.Playables;
-using UnityEngine.Timeline;
+using UnityEngine.Timeline;
-
+
-[Serializable]
+[Serializable]
-public class NavMeshAgentControlBehaviour : PlayableBehaviour
+public class NavMeshAgentControlBehaviour : PlayableBehaviour
-{
+{
-    public Transform destination;
+    public Transform destination;
-    public bool destinationSet;
+    public bool destinationSet;
-
+
-    public override void OnPlayableCreate (Playable playable)
+    public override void OnPlayableCreate (Playable playable)
-    {
+    {
-        destinationSet = false;
+        destinationSet = false;
-    }
+    }
-}
+}

+ 12 - 12
Assets/DefaultPlayables/NavMeshAgentControl/NavMeshAgentControlBehaviour.cs.meta

@@ -1,12 +1,12 @@
-fileFormatVersion: 2
+fileFormatVersion: 2
-guid: 05bbdc6a3b254694e8d1e2d9d55cd256
+guid: 05bbdc6a3b254694e8d1e2d9d55cd256
-timeCreated: 1492603101
+timeCreated: 1492603101
-licenseType: Store
+licenseType: Store
-MonoImporter:
+MonoImporter:
-  serializedVersion: 2
+  serializedVersion: 2
-  defaultReferences: []
+  defaultReferences: []
-  executionOrder: 0
+  executionOrder: 0
-  icon: {instanceID: 0}
+  icon: {instanceID: 0}
-  userData: 
+  userData: 
-  assetBundleName: 
+  assetBundleName: 
-  assetBundleVariant: 
+  assetBundleVariant: 

+ 25 - 25
Assets/DefaultPlayables/NavMeshAgentControl/NavMeshAgentControlClip.cs

@@ -1,25 +1,25 @@
-using System;
+using System;
-using UnityEngine;
+using UnityEngine;
-using UnityEngine.Playables;
+using UnityEngine.Playables;
-using UnityEngine.Timeline;
+using UnityEngine.Timeline;
-
+
-[Serializable]
+[Serializable]
-public class NavMeshAgentControlClip : PlayableAsset, ITimelineClipAsset
+public class NavMeshAgentControlClip : PlayableAsset, ITimelineClipAsset
-{
+{
-    public ExposedReference<Transform> destination;
+    public ExposedReference<Transform> destination;
-    [HideInInspector]
+    [HideInInspector]
-    public NavMeshAgentControlBehaviour template = new NavMeshAgentControlBehaviour ();
+    public NavMeshAgentControlBehaviour template = new NavMeshAgentControlBehaviour ();
-
+
-    public ClipCaps clipCaps
+    public ClipCaps clipCaps
-    {
+    {
-        get { return ClipCaps.None; }
+        get { return ClipCaps.None; }
-    }
+    }
-
+
-    public override Playable CreatePlayable (PlayableGraph graph, GameObject owner)
+    public override Playable CreatePlayable (PlayableGraph graph, GameObject owner)
-    {
+    {
-        var playable = ScriptPlayable<NavMeshAgentControlBehaviour>.Create (graph, template);
+        var playable = ScriptPlayable<NavMeshAgentControlBehaviour>.Create (graph, template);
-        NavMeshAgentControlBehaviour clone = playable.GetBehaviour ();
+        NavMeshAgentControlBehaviour clone = playable.GetBehaviour ();
-        clone.destination = destination.Resolve (graph.GetResolver ());
+        clone.destination = destination.Resolve (graph.GetResolver ());
-        return playable;
+        return playable;
-    }
+    }
-}
+}

+ 12 - 12
Assets/DefaultPlayables/NavMeshAgentControl/NavMeshAgentControlClip.cs.meta

@@ -1,12 +1,12 @@
-fileFormatVersion: 2
+fileFormatVersion: 2
-guid: cfedc374dca69334db907af09ba5c404
+guid: cfedc374dca69334db907af09ba5c404
-timeCreated: 1492603101
+timeCreated: 1492603101
-licenseType: Store
+licenseType: Store
-MonoImporter:
+MonoImporter:
-  serializedVersion: 2
+  serializedVersion: 2
-  defaultReferences: []
+  defaultReferences: []
-  executionOrder: 0
+  executionOrder: 0
-  icon: {instanceID: 0}
+  icon: {instanceID: 0}
-  userData: 
+  userData: 
-  assetBundleName: 
+  assetBundleName: 
-  assetBundleVariant: 
+  assetBundleVariant: 

+ 34 - 34
Assets/DefaultPlayables/NavMeshAgentControl/NavMeshAgentControlMixerBehaviour.cs

@@ -1,34 +1,34 @@
-using System;
+using System;
-using UnityEngine;
+using UnityEngine;
-using UnityEngine.Playables;
+using UnityEngine.Playables;
-using UnityEngine.Timeline;
+using UnityEngine.Timeline;
-using UnityEngine.AI;
+using UnityEngine.AI;
-
+
-public class NavMeshAgentControlMixerBehaviour : PlayableBehaviour
+public class NavMeshAgentControlMixerBehaviour : PlayableBehaviour
-{
+{
-    public override void ProcessFrame(Playable playable, FrameData info, object playerData)
+    public override void ProcessFrame(Playable playable, FrameData info, object playerData)
-    {
+    {
-        NavMeshAgent trackBinding = playerData as NavMeshAgent;
+        NavMeshAgent trackBinding = playerData as NavMeshAgent;
-
+
-        if (!trackBinding)
+        if (!trackBinding)
-            return;
+            return;
-
+
-        int inputCount = playable.GetInputCount();
+        int inputCount = playable.GetInputCount();
-
+
-        for (int i = 0; i < inputCount; i++)
+        for (int i = 0; i < inputCount; i++)
-        {
+        {
-            float inputWeight = playable.GetInputWeight(i);
+            float inputWeight = playable.GetInputWeight(i);
-            ScriptPlayable<NavMeshAgentControlBehaviour> inputPlayable = (ScriptPlayable<NavMeshAgentControlBehaviour>)playable.GetInput(i);
+            ScriptPlayable<NavMeshAgentControlBehaviour> inputPlayable = (ScriptPlayable<NavMeshAgentControlBehaviour>)playable.GetInput(i);
-            NavMeshAgentControlBehaviour input = inputPlayable.GetBehaviour();
+            NavMeshAgentControlBehaviour input = inputPlayable.GetBehaviour();
-
+
-            if (inputWeight > 0.5f && !input.destinationSet && input.destination)
+            if (inputWeight > 0.5f && !input.destinationSet && input.destination)
-            {
+            {
-                if (!trackBinding.isOnNavMesh)
+                if (!trackBinding.isOnNavMesh)
-                    continue;
+                    continue;
-
+
-                trackBinding.SetDestination (input.destination.position);
+                trackBinding.SetDestination (input.destination.position);
-                input.destinationSet = true;
+                input.destinationSet = true;
-            }
+            }
-        }
+        }
-    }
+    }
-}
+}

+ 12 - 12
Assets/DefaultPlayables/NavMeshAgentControl/NavMeshAgentControlMixerBehaviour.cs.meta

@@ -1,12 +1,12 @@
-fileFormatVersion: 2
+fileFormatVersion: 2
-guid: a3805dde487857b41b2fff7d26f06f1e
+guid: a3805dde487857b41b2fff7d26f06f1e
-timeCreated: 1492603101
+timeCreated: 1492603101
-licenseType: Store
+licenseType: Store
-MonoImporter:
+MonoImporter:
-  serializedVersion: 2
+  serializedVersion: 2
-  defaultReferences: []
+  defaultReferences: []
-  executionOrder: 0
+  executionOrder: 0
-  icon: {instanceID: 0}
+  icon: {instanceID: 0}
-  userData: 
+  userData: 
-  assetBundleName: 
+  assetBundleName: 
-  assetBundleVariant: 
+  assetBundleVariant: 

+ 15 - 15
Assets/DefaultPlayables/NavMeshAgentControl/NavMeshAgentControlTrack.cs

@@ -1,15 +1,15 @@
-using UnityEngine;
+using UnityEngine;
-using UnityEngine.Playables;
+using UnityEngine.Playables;
-using UnityEngine.Timeline;
+using UnityEngine.Timeline;
-using UnityEngine.AI;
+using UnityEngine.AI;
-
+
-[TrackColor(0.855f, 0.8623f, 0.87f)]
+[TrackColor(0.855f, 0.8623f, 0.87f)]
-[TrackClipType(typeof(NavMeshAgentControlClip))]
+[TrackClipType(typeof(NavMeshAgentControlClip))]
-[TrackBindingType(typeof(NavMeshAgent))]
+[TrackBindingType(typeof(NavMeshAgent))]
-public class NavMeshAgentControlTrack : TrackAsset
+public class NavMeshAgentControlTrack : TrackAsset
-{
+{
-    public override Playable CreateTrackMixer(PlayableGraph graph, GameObject go, int inputCount)
+    public override Playable CreateTrackMixer(PlayableGraph graph, GameObject go, int inputCount)
-    {
+    {
-        return ScriptPlayable<NavMeshAgentControlMixerBehaviour>.Create (graph, inputCount);
+        return ScriptPlayable<NavMeshAgentControlMixerBehaviour>.Create (graph, inputCount);
-    }
+    }
-}
+}

+ 12 - 12
Assets/DefaultPlayables/NavMeshAgentControl/NavMeshAgentControlTrack.cs.meta

@@ -1,12 +1,12 @@
-fileFormatVersion: 2
+fileFormatVersion: 2
-guid: d201ca921ed322e418c25df03740a308
+guid: d201ca921ed322e418c25df03740a308
-timeCreated: 1492603101
+timeCreated: 1492603101
-licenseType: Store
+licenseType: Store
-MonoImporter:
+MonoImporter:
-  serializedVersion: 2
+  serializedVersion: 2
-  defaultReferences: []
+  defaultReferences: []
-  executionOrder: 0
+  executionOrder: 0
-  icon: {instanceID: 0}
+  icon: {instanceID: 0}
-  userData: 
+  userData: 
-  assetBundleName: 
+  assetBundleName: 
-  assetBundleVariant: 
+  assetBundleVariant: 

+ 22 - 22
Assets/DefaultPlayables/ScreenFader/Editor/ScreenFaderDrawer.cs

@@ -1,22 +1,22 @@
-using UnityEditor;
+using UnityEditor;
-using UnityEngine;
+using UnityEngine;
-using UnityEngine.Playables;
+using UnityEngine.Playables;
-using UnityEngine.UI;
+using UnityEngine.UI;
-
+
-[CustomPropertyDrawer(typeof(ScreenFaderBehaviour))]
+[CustomPropertyDrawer(typeof(ScreenFaderBehaviour))]
-public class ScreenFaderDrawer : PropertyDrawer
+public class ScreenFaderDrawer : PropertyDrawer
-{
+{
-    public override float GetPropertyHeight (SerializedProperty property, GUIContent label)
+    public override float GetPropertyHeight (SerializedProperty property, GUIContent label)
-    {
+    {
-        int fieldCount = 1;
+        int fieldCount = 1;
-        return fieldCount * EditorGUIUtility.singleLineHeight;
+        return fieldCount * EditorGUIUtility.singleLineHeight;
-    }
+    }
-
+
-    public override void OnGUI (Rect position, SerializedProperty property, GUIContent label)
+    public override void OnGUI (Rect position, SerializedProperty property, GUIContent label)
-    {
+    {
-        SerializedProperty colorProp = property.FindPropertyRelative("color");
+        SerializedProperty colorProp = property.FindPropertyRelative("color");
-
+
-        Rect singleFieldRect = new Rect(position.x, position.y, position.width, EditorGUIUtility.singleLineHeight);
+        Rect singleFieldRect = new Rect(position.x, position.y, position.width, EditorGUIUtility.singleLineHeight);
-        EditorGUI.PropertyField(singleFieldRect, colorProp);
+        EditorGUI.PropertyField(singleFieldRect, colorProp);
-    }
+    }
-}
+}

+ 12 - 12
Assets/DefaultPlayables/ScreenFader/Editor/ScreenFaderDrawer.cs.meta

@@ -1,12 +1,12 @@
-fileFormatVersion: 2
+fileFormatVersion: 2
-guid: 7075b31fb4bae504f8480419ce90246f
+guid: 7075b31fb4bae504f8480419ce90246f
-timeCreated: 1496916563
+timeCreated: 1496916563
-licenseType: Store
+licenseType: Store
-MonoImporter:
+MonoImporter:
-  serializedVersion: 2
+  serializedVersion: 2
-  defaultReferences: []
+  defaultReferences: []
-  executionOrder: 0
+  executionOrder: 0
-  icon: {instanceID: 0}
+  icon: {instanceID: 0}
-  userData: 
+  userData: 
-  assetBundleName: 
+  assetBundleName: 
-  assetBundleVariant: 
+  assetBundleVariant: 

+ 11 - 11
Assets/DefaultPlayables/ScreenFader/ScreenFaderBehaviour.cs

@@ -1,11 +1,11 @@
-using System;
+using System;
-using UnityEngine;
+using UnityEngine;
-using UnityEngine.Playables;
+using UnityEngine.Playables;
-using UnityEngine.Timeline;
+using UnityEngine.Timeline;
-using UnityEngine.UI;
+using UnityEngine.UI;
-
+
-[Serializable]
+[Serializable]
-public class ScreenFaderBehaviour : PlayableBehaviour
+public class ScreenFaderBehaviour : PlayableBehaviour
-{
+{
-    public Color color = Color.black;
+    public Color color = Color.black;
-}
+}

+ 12 - 12
Assets/DefaultPlayables/ScreenFader/ScreenFaderBehaviour.cs.meta

@@ -1,12 +1,12 @@
-fileFormatVersion: 2
+fileFormatVersion: 2
-guid: 4cf88cabc4dadeb4fafeefdbc61869ca
+guid: 4cf88cabc4dadeb4fafeefdbc61869ca
-timeCreated: 1496916563
+timeCreated: 1496916563
-licenseType: Store
+licenseType: Store
-MonoImporter:
+MonoImporter:
-  serializedVersion: 2
+  serializedVersion: 2
-  defaultReferences: []
+  defaultReferences: []
-  executionOrder: 0
+  executionOrder: 0
-  icon: {instanceID: 0}
+  icon: {instanceID: 0}
-  userData: 
+  userData: 
-  assetBundleName: 
+  assetBundleName: 
-  assetBundleVariant: 
+  assetBundleVariant: 

+ 20 - 20
Assets/DefaultPlayables/ScreenFader/ScreenFaderClip.cs

@@ -1,20 +1,20 @@
-using System;
+using System;
-using UnityEngine;
+using UnityEngine;
-using UnityEngine.Playables;
+using UnityEngine.Playables;
-using UnityEngine.Timeline;
+using UnityEngine.Timeline;
-
+
-[Serializable]
+[Serializable]
-public class ScreenFaderClip : PlayableAsset, ITimelineClipAsset
+public class ScreenFaderClip : PlayableAsset, ITimelineClipAsset
-{
+{
-    public ScreenFaderBehaviour template = new ScreenFaderBehaviour ();
+    public ScreenFaderBehaviour template = new ScreenFaderBehaviour ();
-
+
-    public ClipCaps clipCaps
+    public ClipCaps clipCaps
-    {
+    {
-        get { return ClipCaps.Blending; }
+        get { return ClipCaps.Blending; }
-    }
+    }
-
+
-    public override Playable CreatePlayable (PlayableGraph graph, GameObject owner)
+    public override Playable CreatePlayable (PlayableGraph graph, GameObject owner)
-    {
+    {
-        var playable = ScriptPlayable<ScreenFaderBehaviour>.Create (graph, template);
+        var playable = ScriptPlayable<ScreenFaderBehaviour>.Create (graph, template);
-        return playable;    }
+        return playable;    }
-}
+}

+ 12 - 12
Assets/DefaultPlayables/ScreenFader/ScreenFaderClip.cs.meta

@@ -1,12 +1,12 @@
-fileFormatVersion: 2
+fileFormatVersion: 2
-guid: 0445258a5c40b364ab21547784905327
+guid: 0445258a5c40b364ab21547784905327
-timeCreated: 1496916563
+timeCreated: 1496916563
-licenseType: Store
+licenseType: Store
-MonoImporter:
+MonoImporter:
-  serializedVersion: 2
+  serializedVersion: 2
-  defaultReferences: []
+  defaultReferences: []
-  executionOrder: 0
+  executionOrder: 0
-  icon: {instanceID: 0}
+  icon: {instanceID: 0}
-  userData: 
+  userData: 
-  assetBundleName: 
+  assetBundleName: 
-  assetBundleVariant: 
+  assetBundleVariant: 

+ 64 - 64
Assets/DefaultPlayables/ScreenFader/ScreenFaderMixerBehaviour.cs

@@ -1,64 +1,64 @@
-using System;
+using System;
-using UnityEngine;
+using UnityEngine;
-using UnityEngine.Playables;
+using UnityEngine.Playables;
-using UnityEngine.Timeline;
+using UnityEngine.Timeline;
-using UnityEngine.UI;
+using UnityEngine.UI;
-
+
-public class ScreenFaderMixerBehaviour : PlayableBehaviour
+public class ScreenFaderMixerBehaviour : PlayableBehaviour
-{
+{
-    Color m_DefaultColor;
+    Color m_DefaultColor;
-
+
-    Image m_TrackBinding;
+    Image m_TrackBinding;
-    bool m_FirstFrameHappened;
+    bool m_FirstFrameHappened;
-
+
-    public override void ProcessFrame(Playable playable, FrameData info, object playerData)
+    public override void ProcessFrame(Playable playable, FrameData info, object playerData)
-    {
+    {
-        m_TrackBinding = playerData as Image;
+        m_TrackBinding = playerData as Image;
-
+
-        if (m_TrackBinding == null)
+        if (m_TrackBinding == null)
-            return;
+            return;
-
+
-        if (!m_FirstFrameHappened)
+        if (!m_FirstFrameHappened)
-        {
+        {
-            m_DefaultColor = m_TrackBinding.color;
+            m_DefaultColor = m_TrackBinding.color;
-            m_FirstFrameHappened = true;
+            m_FirstFrameHappened = true;
-        }
+        }
-
+
-        int inputCount = playable.GetInputCount ();
+        int inputCount = playable.GetInputCount ();
-
+
-        Color blendedColor = Color.clear;
+        Color blendedColor = Color.clear;
-        float totalWeight = 0f;
+        float totalWeight = 0f;
-        float greatestWeight = 0f;
+        float greatestWeight = 0f;
-        int currentInputs = 0;
+        int currentInputs = 0;
-
+
-        for (int i = 0; i < inputCount; i++)
+        for (int i = 0; i < inputCount; i++)
-        {
+        {
-            float inputWeight = playable.GetInputWeight(i);
+            float inputWeight = playable.GetInputWeight(i);
-            ScriptPlayable<ScreenFaderBehaviour> inputPlayable = (ScriptPlayable<ScreenFaderBehaviour>)playable.GetInput(i);
+            ScriptPlayable<ScreenFaderBehaviour> inputPlayable = (ScriptPlayable<ScreenFaderBehaviour>)playable.GetInput(i);
-            ScreenFaderBehaviour input = inputPlayable.GetBehaviour ();
+            ScreenFaderBehaviour input = inputPlayable.GetBehaviour ();
-            
+            
-            blendedColor += input.color * inputWeight;
+            blendedColor += input.color * inputWeight;
-            totalWeight += inputWeight;
+            totalWeight += inputWeight;
-
+
-            if (inputWeight > greatestWeight)
+            if (inputWeight > greatestWeight)
-            {
+            {
-                greatestWeight = inputWeight;
+                greatestWeight = inputWeight;
-            }
+            }
-
+
-            if (!Mathf.Approximately (inputWeight, 0f))
+            if (!Mathf.Approximately (inputWeight, 0f))
-                currentInputs++;
+                currentInputs++;
-        }
+        }
-
+
-        m_TrackBinding.color = blendedColor + m_DefaultColor * (1f - totalWeight);
+        m_TrackBinding.color = blendedColor + m_DefaultColor * (1f - totalWeight);
-    }
+    }
-
+
-    public override void OnPlayableDestroy (Playable playable)
+    public override void OnPlayableDestroy (Playable playable)
-    {
+    {
-        m_FirstFrameHappened = false;
+        m_FirstFrameHappened = false;
-
+
-        if (m_TrackBinding == null)
+        if (m_TrackBinding == null)
-            return;
+            return;
-
+
-        m_TrackBinding.color = m_DefaultColor;
+        m_TrackBinding.color = m_DefaultColor;
-    }
+    }
-}
+}

+ 12 - 12
Assets/DefaultPlayables/ScreenFader/ScreenFaderMixerBehaviour.cs.meta

@@ -1,12 +1,12 @@
-fileFormatVersion: 2
+fileFormatVersion: 2
-guid: 88173aff48b4ccb429d83dca32d03a86
+guid: 88173aff48b4ccb429d83dca32d03a86
-timeCreated: 1496916563
+timeCreated: 1496916563
-licenseType: Store
+licenseType: Store
-MonoImporter:
+MonoImporter:
-  serializedVersion: 2
+  serializedVersion: 2
-  defaultReferences: []
+  defaultReferences: []
-  executionOrder: 0
+  executionOrder: 0
-  icon: {instanceID: 0}
+  icon: {instanceID: 0}
-  userData: 
+  userData: 
-  assetBundleName: 
+  assetBundleName: 
-  assetBundleVariant: 
+  assetBundleVariant: 

+ 36 - 36
Assets/DefaultPlayables/ScreenFader/ScreenFaderTrack.cs

@@ -1,36 +1,36 @@
-using UnityEngine;
+using UnityEngine;
-using UnityEngine.Playables;
+using UnityEngine.Playables;
-using UnityEngine.Timeline;
+using UnityEngine.Timeline;
-using System.Collections.Generic;
+using System.Collections.Generic;
-using UnityEngine.UI;
+using UnityEngine.UI;
-
+
-[TrackColor(0.875f, 0.5944853f, 0.1737132f)]
+[TrackColor(0.875f, 0.5944853f, 0.1737132f)]
-[TrackClipType(typeof(ScreenFaderClip))]
+[TrackClipType(typeof(ScreenFaderClip))]
-[TrackBindingType(typeof(Image))]
+[TrackBindingType(typeof(Image))]
-public class ScreenFaderTrack : TrackAsset
+public class ScreenFaderTrack : TrackAsset
-{
+{
-    public override Playable CreateTrackMixer(PlayableGraph graph, GameObject go, int inputCount)
+    public override Playable CreateTrackMixer(PlayableGraph graph, GameObject go, int inputCount)
-    {
+    {
-        return ScriptPlayable<ScreenFaderMixerBehaviour>.Create (graph, inputCount);
+        return ScriptPlayable<ScreenFaderMixerBehaviour>.Create (graph, inputCount);
-    }
+    }
-
+
-    public override void GatherProperties (PlayableDirector director, IPropertyCollector driver)
+    public override void GatherProperties (PlayableDirector director, IPropertyCollector driver)
-    {
+    {
-#if UNITY_EDITOR
+#if UNITY_EDITOR
-        Image trackBinding = director.GetGenericBinding(this) as Image;
+        Image trackBinding = director.GetGenericBinding(this) as Image;
-        if (trackBinding == null)
+        if (trackBinding == null)
-            return;
+            return;
-
+
-        var serializedObject = new UnityEditor.SerializedObject (trackBinding);
+        var serializedObject = new UnityEditor.SerializedObject (trackBinding);
-        var iterator = serializedObject.GetIterator();
+        var iterator = serializedObject.GetIterator();
-        while (iterator.NextVisible(true))
+        while (iterator.NextVisible(true))
-        {
+        {
-            if (iterator.hasVisibleChildren)
+            if (iterator.hasVisibleChildren)
-                continue;
+                continue;
-
+
-            driver.AddFromName<Image>(trackBinding.gameObject, iterator.propertyPath);
+            driver.AddFromName<Image>(trackBinding.gameObject, iterator.propertyPath);
-        }
+        }
-#endif
+#endif
-        base.GatherProperties (director, driver);
+        base.GatherProperties (director, driver);
-    }
+    }
-}
+}

+ 12 - 12
Assets/DefaultPlayables/ScreenFader/ScreenFaderTrack.cs.meta

@@ -1,12 +1,12 @@
-fileFormatVersion: 2
+fileFormatVersion: 2
-guid: 6a8190b9dc143d64ab3322e49af85f7b
+guid: 6a8190b9dc143d64ab3322e49af85f7b
-timeCreated: 1496916563
+timeCreated: 1496916563
-licenseType: Store
+licenseType: Store
-MonoImporter:
+MonoImporter:
-  serializedVersion: 2
+  serializedVersion: 2
-  defaultReferences: []
+  defaultReferences: []
-  executionOrder: 0
+  executionOrder: 0
-  icon: {instanceID: 0}
+  icon: {instanceID: 0}
-  userData: 
+  userData: 
-  assetBundleName: 
+  assetBundleName: 
-  assetBundleVariant: 
+  assetBundleVariant: 

+ 30 - 30
Assets/DefaultPlayables/TextSwitcher/Editor/TextSwitcherDrawer.cs

@@ -1,30 +1,30 @@
-using UnityEditor;
+using UnityEditor;
-using UnityEngine;
+using UnityEngine;
-using UnityEngine.Playables;
+using UnityEngine.Playables;
-using UnityEngine.UI;
+using UnityEngine.UI;
-
+
-[CustomPropertyDrawer(typeof(TextSwitcherBehaviour))]
+[CustomPropertyDrawer(typeof(TextSwitcherBehaviour))]
-public class TextSwitcherDrawer : PropertyDrawer
+public class TextSwitcherDrawer : PropertyDrawer
-{
+{
-    public override float GetPropertyHeight (SerializedProperty property, GUIContent label)
+    public override float GetPropertyHeight (SerializedProperty property, GUIContent label)
-    {
+    {
-        int fieldCount = 3;
+        int fieldCount = 3;
-        return fieldCount * EditorGUIUtility.singleLineHeight;
+        return fieldCount * EditorGUIUtility.singleLineHeight;
-    }
+    }
-
+
-    public override void OnGUI (Rect position, SerializedProperty property, GUIContent label)
+    public override void OnGUI (Rect position, SerializedProperty property, GUIContent label)
-    {
+    {
-        SerializedProperty colorProp = property.FindPropertyRelative("color");
+        SerializedProperty colorProp = property.FindPropertyRelative("color");
-        SerializedProperty fontSizeProp = property.FindPropertyRelative("fontSize");
+        SerializedProperty fontSizeProp = property.FindPropertyRelative("fontSize");
-        SerializedProperty textProp = property.FindPropertyRelative("text");
+        SerializedProperty textProp = property.FindPropertyRelative("text");
-
+
-        Rect singleFieldRect = new Rect(position.x, position.y, position.width, EditorGUIUtility.singleLineHeight);
+        Rect singleFieldRect = new Rect(position.x, position.y, position.width, EditorGUIUtility.singleLineHeight);
-        EditorGUI.PropertyField(singleFieldRect, colorProp);
+        EditorGUI.PropertyField(singleFieldRect, colorProp);
-
+
-        singleFieldRect.y += EditorGUIUtility.singleLineHeight;
+        singleFieldRect.y += EditorGUIUtility.singleLineHeight;
-        EditorGUI.PropertyField(singleFieldRect, fontSizeProp);
+        EditorGUI.PropertyField(singleFieldRect, fontSizeProp);
-
+
-        singleFieldRect.y += EditorGUIUtility.singleLineHeight;
+        singleFieldRect.y += EditorGUIUtility.singleLineHeight;
-        EditorGUI.PropertyField(singleFieldRect, textProp);
+        EditorGUI.PropertyField(singleFieldRect, textProp);
-    }
+    }
-}
+}

+ 12 - 12
Assets/DefaultPlayables/TextSwitcher/Editor/TextSwitcherDrawer.cs.meta

@@ -1,12 +1,12 @@
-fileFormatVersion: 2
+fileFormatVersion: 2
-guid: d10fec9d6fdea024293153308aa74ef7
+guid: d10fec9d6fdea024293153308aa74ef7
-timeCreated: 1496915579
+timeCreated: 1496915579
-licenseType: Store
+licenseType: Store
-MonoImporter:
+MonoImporter:
-  serializedVersion: 2
+  serializedVersion: 2
-  defaultReferences: []
+  defaultReferences: []
-  executionOrder: 0
+  executionOrder: 0
-  icon: {instanceID: 0}
+  icon: {instanceID: 0}
-  userData: 
+  userData: 
-  assetBundleName: 
+  assetBundleName: 
-  assetBundleVariant: 
+  assetBundleVariant: 

+ 13 - 13
Assets/DefaultPlayables/TextSwitcher/TextSwitcherBehaviour.cs

@@ -1,13 +1,13 @@
-using System;
+using System;
-using UnityEngine;
+using UnityEngine;
-using UnityEngine.Playables;
+using UnityEngine.Playables;
-using UnityEngine.Timeline;
+using UnityEngine.Timeline;
-using UnityEngine.UI;
+using UnityEngine.UI;
-
+
-[Serializable]
+[Serializable]
-public class TextSwitcherBehaviour : PlayableBehaviour
+public class TextSwitcherBehaviour : PlayableBehaviour
-{
+{
-    public Color color = Color.white;
+    public Color color = Color.white;
-    public int fontSize = 14;
+    public int fontSize = 14;
-    public string text;
+    public string text;
-}
+}

+ 12 - 12
Assets/DefaultPlayables/TextSwitcher/TextSwitcherBehaviour.cs.meta

@@ -1,12 +1,12 @@
-fileFormatVersion: 2
+fileFormatVersion: 2
-guid: 6480896635305a7418e42ec32d3c64d3
+guid: 6480896635305a7418e42ec32d3c64d3
-timeCreated: 1496915579
+timeCreated: 1496915579
-licenseType: Store
+licenseType: Store
-MonoImporter:
+MonoImporter:
-  serializedVersion: 2
+  serializedVersion: 2
-  defaultReferences: []
+  defaultReferences: []
-  executionOrder: 0
+  executionOrder: 0
-  icon: {instanceID: 0}
+  icon: {instanceID: 0}
-  userData: 
+  userData: 
-  assetBundleName: 
+  assetBundleName: 
-  assetBundleVariant: 
+  assetBundleVariant: 

+ 20 - 20
Assets/DefaultPlayables/TextSwitcher/TextSwitcherClip.cs

@@ -1,20 +1,20 @@
-using System;
+using System;
-using UnityEngine;
+using UnityEngine;
-using UnityEngine.Playables;
+using UnityEngine.Playables;
-using UnityEngine.Timeline;
+using UnityEngine.Timeline;
-
+
-[Serializable]
+[Serializable]
-public class TextSwitcherClip : PlayableAsset, ITimelineClipAsset
+public class TextSwitcherClip : PlayableAsset, ITimelineClipAsset
-{
+{
-    public TextSwitcherBehaviour template = new TextSwitcherBehaviour ();
+    public TextSwitcherBehaviour template = new TextSwitcherBehaviour ();
-
+
-    public ClipCaps clipCaps
+    public ClipCaps clipCaps
-    {
+    {
-        get { return ClipCaps.Blending; }
+        get { return ClipCaps.Blending; }
-    }
+    }
-
+
-    public override Playable CreatePlayable (PlayableGraph graph, GameObject owner)
+    public override Playable CreatePlayable (PlayableGraph graph, GameObject owner)
-    {
+    {
-        var playable = ScriptPlayable<TextSwitcherBehaviour>.Create (graph, template);
+        var playable = ScriptPlayable<TextSwitcherBehaviour>.Create (graph, template);
-        return playable;    }
+        return playable;    }
-}
+}

+ 12 - 12
Assets/DefaultPlayables/TextSwitcher/TextSwitcherClip.cs.meta

@@ -1,12 +1,12 @@
-fileFormatVersion: 2
+fileFormatVersion: 2
-guid: d4d683f551d33a84db12bb6fa65573f9
+guid: d4d683f551d33a84db12bb6fa65573f9
-timeCreated: 1496915579
+timeCreated: 1496915579
-licenseType: Store
+licenseType: Store
-MonoImporter:
+MonoImporter:
-  serializedVersion: 2
+  serializedVersion: 2
-  defaultReferences: []
+  defaultReferences: []
-  executionOrder: 0
+  executionOrder: 0
-  icon: {instanceID: 0}
+  icon: {instanceID: 0}
-  userData: 
+  userData: 
-  assetBundleName: 
+  assetBundleName: 
-  assetBundleVariant: 
+  assetBundleVariant: 

+ 78 - 78
Assets/DefaultPlayables/TextSwitcher/TextSwitcherMixerBehaviour.cs

@@ -1,78 +1,78 @@
-using System;
+using System;
-using UnityEngine;
+using UnityEngine;
-using UnityEngine.Playables;
+using UnityEngine.Playables;
-using UnityEngine.Timeline;
+using UnityEngine.Timeline;
-using UnityEngine.UI;
+using UnityEngine.UI;
-
+
-public class TextSwitcherMixerBehaviour : PlayableBehaviour
+public class TextSwitcherMixerBehaviour : PlayableBehaviour
-{
+{
-    Color m_DefaultColor;
+    Color m_DefaultColor;
-    int m_DefaultFontSize;
+    int m_DefaultFontSize;
-    string m_DefaultText;
+    string m_DefaultText;
-
+
-    Text m_TrackBinding;
+    Text m_TrackBinding;
-    bool m_FirstFrameHappened;
+    bool m_FirstFrameHappened;
-
+
-    public override void ProcessFrame(Playable playable, FrameData info, object playerData)
+    public override void ProcessFrame(Playable playable, FrameData info, object playerData)
-    {
+    {
-        m_TrackBinding = playerData as Text;
+        m_TrackBinding = playerData as Text;
-
+
-        if (m_TrackBinding == null)
+        if (m_TrackBinding == null)
-            return;
+            return;
-
+
-        if (!m_FirstFrameHappened)
+        if (!m_FirstFrameHappened)
-        {
+        {
-            m_DefaultColor = m_TrackBinding.color;
+            m_DefaultColor = m_TrackBinding.color;
-            m_DefaultFontSize = m_TrackBinding.fontSize;
+            m_DefaultFontSize = m_TrackBinding.fontSize;
-            m_DefaultText = m_TrackBinding.text;
+            m_DefaultText = m_TrackBinding.text;
-            m_FirstFrameHappened = true;
+            m_FirstFrameHappened = true;
-        }
+        }
-
+
-        int inputCount = playable.GetInputCount ();
+        int inputCount = playable.GetInputCount ();
-
+
-        Color blendedColor = Color.clear;
+        Color blendedColor = Color.clear;
-        float blendedFontSize = 0f;
+        float blendedFontSize = 0f;
-        float totalWeight = 0f;
+        float totalWeight = 0f;
-        float greatestWeight = 0f;
+        float greatestWeight = 0f;
-        int currentInputs = 0;
+        int currentInputs = 0;
-
+
-        for (int i = 0; i < inputCount; i++)
+        for (int i = 0; i < inputCount; i++)
-        {
+        {
-            float inputWeight = playable.GetInputWeight(i);
+            float inputWeight = playable.GetInputWeight(i);
-            ScriptPlayable<TextSwitcherBehaviour> inputPlayable = (ScriptPlayable<TextSwitcherBehaviour>)playable.GetInput(i);
+            ScriptPlayable<TextSwitcherBehaviour> inputPlayable = (ScriptPlayable<TextSwitcherBehaviour>)playable.GetInput(i);
-            TextSwitcherBehaviour input = inputPlayable.GetBehaviour ();
+            TextSwitcherBehaviour input = inputPlayable.GetBehaviour ();
-            
+            
-            blendedColor += input.color * inputWeight;
+            blendedColor += input.color * inputWeight;
-            blendedFontSize += input.fontSize * inputWeight;
+            blendedFontSize += input.fontSize * inputWeight;
-            totalWeight += inputWeight;
+            totalWeight += inputWeight;
-
+
-            if (inputWeight > greatestWeight)
+            if (inputWeight > greatestWeight)
-            {
+            {
-                m_TrackBinding.text = input.text;
+                m_TrackBinding.text = input.text;
-                greatestWeight = inputWeight;
+                greatestWeight = inputWeight;
-            }
+            }
-
+
-            if (!Mathf.Approximately (inputWeight, 0f))
+            if (!Mathf.Approximately (inputWeight, 0f))
-                currentInputs++;
+                currentInputs++;
-        }
+        }
-
+
-        m_TrackBinding.color = blendedColor + m_DefaultColor * (1f - totalWeight);
+        m_TrackBinding.color = blendedColor + m_DefaultColor * (1f - totalWeight);
-        m_TrackBinding.fontSize = Mathf.RoundToInt (blendedFontSize + m_DefaultFontSize * (1f - totalWeight));
+        m_TrackBinding.fontSize = Mathf.RoundToInt (blendedFontSize + m_DefaultFontSize * (1f - totalWeight));
-        if (currentInputs != 1 && 1f - totalWeight > greatestWeight)
+        if (currentInputs != 1 && 1f - totalWeight > greatestWeight)
-        {
+        {
-            m_TrackBinding.text = m_DefaultText;
+            m_TrackBinding.text = m_DefaultText;
-        }
+        }
-    }
+    }
-
+
-    public override void OnPlayableDestroy (Playable playable)
+    public override void OnPlayableDestroy (Playable playable)
-    {
+    {
-        m_FirstFrameHappened = false;
+        m_FirstFrameHappened = false;
-
+
-        if (m_TrackBinding == null)
+        if (m_TrackBinding == null)
-            return;
+            return;
-
+
-        m_TrackBinding.color = m_DefaultColor;
+        m_TrackBinding.color = m_DefaultColor;
-        m_TrackBinding.fontSize = m_DefaultFontSize;
+        m_TrackBinding.fontSize = m_DefaultFontSize;
-        m_TrackBinding.text = m_DefaultText;
+        m_TrackBinding.text = m_DefaultText;
-    }
+    }
-}
+}

+ 12 - 12
Assets/DefaultPlayables/TextSwitcher/TextSwitcherMixerBehaviour.cs.meta

@@ -1,12 +1,12 @@
-fileFormatVersion: 2
+fileFormatVersion: 2
-guid: 8a4266a3acde3c24e995780329819997
+guid: 8a4266a3acde3c24e995780329819997
-timeCreated: 1496915579
+timeCreated: 1496915579
-licenseType: Store
+licenseType: Store
-MonoImporter:
+MonoImporter:
-  serializedVersion: 2
+  serializedVersion: 2
-  defaultReferences: []
+  defaultReferences: []
-  executionOrder: 0
+  executionOrder: 0
-  icon: {instanceID: 0}
+  icon: {instanceID: 0}
-  userData: 
+  userData: 
-  assetBundleName: 
+  assetBundleName: 
-  assetBundleVariant: 
+  assetBundleVariant: 

+ 36 - 36
Assets/DefaultPlayables/TextSwitcher/TextSwitcherTrack.cs

@@ -1,36 +1,36 @@
-using UnityEngine;
+using UnityEngine;
-using UnityEngine.Playables;
+using UnityEngine.Playables;
-using UnityEngine.Timeline;
+using UnityEngine.Timeline;
-using System.Collections.Generic;
+using System.Collections.Generic;
-using UnityEngine.UI;
+using UnityEngine.UI;
-
+
-[TrackColor(0.1394896f, 0.4411765f, 0.3413077f)]
+[TrackColor(0.1394896f, 0.4411765f, 0.3413077f)]
-[TrackClipType(typeof(TextSwitcherClip))]
+[TrackClipType(typeof(TextSwitcherClip))]
-[TrackBindingType(typeof(Text))]
+[TrackBindingType(typeof(Text))]
-public class TextSwitcherTrack : TrackAsset
+public class TextSwitcherTrack : TrackAsset
-{
+{
-    public override Playable CreateTrackMixer(PlayableGraph graph, GameObject go, int inputCount)
+    public override Playable CreateTrackMixer(PlayableGraph graph, GameObject go, int inputCount)
-    {
+    {
-        return ScriptPlayable<TextSwitcherMixerBehaviour>.Create (graph, inputCount);
+        return ScriptPlayable<TextSwitcherMixerBehaviour>.Create (graph, inputCount);
-    }
+    }
-
+
-    public override void GatherProperties (PlayableDirector director, IPropertyCollector driver)
+    public override void GatherProperties (PlayableDirector director, IPropertyCollector driver)
-    {
+    {
-#if UNITY_EDITOR
+#if UNITY_EDITOR
-        Text trackBinding = director.GetGenericBinding(this) as Text;
+        Text trackBinding = director.GetGenericBinding(this) as Text;
-        if (trackBinding == null)
+        if (trackBinding == null)
-            return;
+            return;
-
+
-        var serializedObject = new UnityEditor.SerializedObject (trackBinding);
+        var serializedObject = new UnityEditor.SerializedObject (trackBinding);
-        var iterator = serializedObject.GetIterator();
+        var iterator = serializedObject.GetIterator();
-        while (iterator.NextVisible(true))
+        while (iterator.NextVisible(true))
-        {
+        {
-            if (iterator.hasVisibleChildren)
+            if (iterator.hasVisibleChildren)
-                continue;
+                continue;
-
+
-            driver.AddFromName<Text>(trackBinding.gameObject, iterator.propertyPath);
+            driver.AddFromName<Text>(trackBinding.gameObject, iterator.propertyPath);
-        }
+        }
-#endif
+#endif
-        base.GatherProperties (director, driver);
+        base.GatherProperties (director, driver);
-    }
+    }
-}
+}

+ 12 - 12
Assets/DefaultPlayables/TextSwitcher/TextSwitcherTrack.cs.meta

@@ -1,12 +1,12 @@
-fileFormatVersion: 2
+fileFormatVersion: 2
-guid: 73211584ea373f3409e0a7a83d711aef
+guid: 73211584ea373f3409e0a7a83d711aef
-timeCreated: 1496915579
+timeCreated: 1496915579
-licenseType: Store
+licenseType: Store
-MonoImporter:
+MonoImporter:
-  serializedVersion: 2
+  serializedVersion: 2
-  defaultReferences: []
+  defaultReferences: []
-  executionOrder: 0
+  executionOrder: 0
-  icon: {instanceID: 0}
+  icon: {instanceID: 0}
-  userData: 
+  userData: 
-  assetBundleName: 
+  assetBundleName: 
-  assetBundleVariant: 
+  assetBundleVariant: 

+ 20 - 20
Assets/DefaultPlayables/TimeDilation/Editor/TimeDilationDrawer.cs

@@ -1,20 +1,20 @@
-using UnityEditor;
+using UnityEditor;
-using UnityEngine;
+using UnityEngine;
-
+
-[CustomPropertyDrawer(typeof(TimeDilationBehaviour))]
+[CustomPropertyDrawer(typeof(TimeDilationBehaviour))]
-public class TimeDilationDrawer : PropertyDrawer
+public class TimeDilationDrawer : PropertyDrawer
-{
+{
-    public override float GetPropertyHeight (SerializedProperty property, GUIContent label)
+    public override float GetPropertyHeight (SerializedProperty property, GUIContent label)
-    {
+    {
-        int fieldCount = 1;
+        int fieldCount = 1;
-        return fieldCount * EditorGUIUtility.singleLineHeight;
+        return fieldCount * EditorGUIUtility.singleLineHeight;
-    }
+    }
-
+
-    public override void OnGUI (Rect position, SerializedProperty property, GUIContent label)
+    public override void OnGUI (Rect position, SerializedProperty property, GUIContent label)
-    {
+    {
-        SerializedProperty timeScaleProp = property.FindPropertyRelative("timeScale");
+        SerializedProperty timeScaleProp = property.FindPropertyRelative("timeScale");
-
+
-        Rect singleFieldRect = new Rect(position.x, position.y, position.width, EditorGUIUtility.singleLineHeight);
+        Rect singleFieldRect = new Rect(position.x, position.y, position.width, EditorGUIUtility.singleLineHeight);
-        EditorGUI.PropertyField(singleFieldRect, timeScaleProp);
+        EditorGUI.PropertyField(singleFieldRect, timeScaleProp);
-    }
+    }
-}
+}

+ 12 - 12
Assets/DefaultPlayables/TimeDilation/Editor/TimeDilationDrawer.cs.meta

@@ -1,12 +1,12 @@
-fileFormatVersion: 2
+fileFormatVersion: 2
-guid: 96853521ef6ea974d96cf7ef72f7c6a7
+guid: 96853521ef6ea974d96cf7ef72f7c6a7
-timeCreated: 1491318587
+timeCreated: 1491318587
-licenseType: Store
+licenseType: Store
-MonoImporter:
+MonoImporter:
-  serializedVersion: 2
+  serializedVersion: 2
-  defaultReferences: []
+  defaultReferences: []
-  executionOrder: 0
+  executionOrder: 0
-  icon: {instanceID: 0}
+  icon: {instanceID: 0}
-  userData: 
+  userData: 
-  assetBundleName: 
+  assetBundleName: 
-  assetBundleVariant: 
+  assetBundleVariant: 

+ 10 - 10
Assets/DefaultPlayables/TimeDilation/TimeDilationBehaviour.cs

@@ -1,10 +1,10 @@
-using System;
+using System;
-using UnityEngine;
+using UnityEngine;
-using UnityEngine.Playables;
+using UnityEngine.Playables;
-using UnityEngine.Timeline;
+using UnityEngine.Timeline;
-
+
-[Serializable]
+[Serializable]
-public class TimeDilationBehaviour : PlayableBehaviour
+public class TimeDilationBehaviour : PlayableBehaviour
-{
+{
-    public float timeScale = 1f;
+    public float timeScale = 1f;
-}
+}

+ 12 - 12
Assets/DefaultPlayables/TimeDilation/TimeDilationBehaviour.cs.meta

@@ -1,12 +1,12 @@
-fileFormatVersion: 2
+fileFormatVersion: 2
-guid: a0b944926d9e8514d892737116110502
+guid: a0b944926d9e8514d892737116110502
-timeCreated: 1491318587
+timeCreated: 1491318587
-licenseType: Store
+licenseType: Store
-MonoImporter:
+MonoImporter:
-  serializedVersion: 2
+  serializedVersion: 2
-  defaultReferences: []
+  defaultReferences: []
-  executionOrder: 0
+  executionOrder: 0
-  icon: {instanceID: 0}
+  icon: {instanceID: 0}
-  userData: 
+  userData: 
-  assetBundleName: 
+  assetBundleName: 
-  assetBundleVariant: 
+  assetBundleVariant: 

+ 21 - 21
Assets/DefaultPlayables/TimeDilation/TimeDilationClip.cs

@@ -1,21 +1,21 @@
-using System;
+using System;
-using UnityEngine;
+using UnityEngine;
-using UnityEngine.Playables;
+using UnityEngine.Playables;
-using UnityEngine.Timeline;
+using UnityEngine.Timeline;
-
+
-[Serializable]
+[Serializable]
-public class TimeDilationClip : PlayableAsset, ITimelineClipAsset
+public class TimeDilationClip : PlayableAsset, ITimelineClipAsset
-{
+{
-    public TimeDilationBehaviour template = new TimeDilationBehaviour ();
+    public TimeDilationBehaviour template = new TimeDilationBehaviour ();
-
+
-    public ClipCaps clipCaps
+    public ClipCaps clipCaps
-    {
+    {
-        get { return ClipCaps.Extrapolation | ClipCaps.Blending; }
+        get { return ClipCaps.Extrapolation | ClipCaps.Blending; }
-    }
+    }
-
+
-    public override Playable CreatePlayable (PlayableGraph graph, GameObject owner)
+    public override Playable CreatePlayable (PlayableGraph graph, GameObject owner)
-    {
+    {
-        var playable = ScriptPlayable<TimeDilationBehaviour>.Create (graph, template);
+        var playable = ScriptPlayable<TimeDilationBehaviour>.Create (graph, template);
-        return playable;
+        return playable;
-    }
+    }
-}
+}

+ 12 - 12
Assets/DefaultPlayables/TimeDilation/TimeDilationClip.cs.meta

@@ -1,12 +1,12 @@
-fileFormatVersion: 2
+fileFormatVersion: 2
-guid: eed9a3f59ff436340b05ff8248f0d998
+guid: eed9a3f59ff436340b05ff8248f0d998
-timeCreated: 1491318587
+timeCreated: 1491318587
-licenseType: Store
+licenseType: Store
-MonoImporter:
+MonoImporter:
-  serializedVersion: 2
+  serializedVersion: 2
-  defaultReferences: []
+  defaultReferences: []
-  executionOrder: 0
+  executionOrder: 0
-  icon: {instanceID: 0}
+  icon: {instanceID: 0}
-  userData: 
+  userData: 
-  assetBundleName: 
+  assetBundleName: 
-  assetBundleVariant: 
+  assetBundleVariant: 

+ 41 - 41
Assets/DefaultPlayables/TimeDilation/TimeDilationMixerBehaviour.cs

@@ -1,41 +1,41 @@
-using System;
+using System;
-using UnityEngine;
+using UnityEngine;
-using UnityEngine.Playables;
+using UnityEngine.Playables;
-using UnityEngine.Timeline;
+using UnityEngine.Timeline;
-
+
-public class TimeDilationMixerBehaviour : PlayableBehaviour
+public class TimeDilationMixerBehaviour : PlayableBehaviour
-{
+{
-    float m_OldTimeScale = 1f;
+    float m_OldTimeScale = 1f;
-
+
-    public override void OnPlayableCreate (Playable playable)
+    public override void OnPlayableCreate (Playable playable)
-    {
+    {
-        m_OldTimeScale = Time.timeScale;
+        m_OldTimeScale = Time.timeScale;
-    }
+    }
-
+
-    public override void ProcessFrame(Playable playable, FrameData info, object playerData)
+    public override void ProcessFrame(Playable playable, FrameData info, object playerData)
-    {
+    {
-        int inputCount = playable.GetInputCount ();
+        int inputCount = playable.GetInputCount ();
-
+
-        float mixedTimeScale = 0f;
+        float mixedTimeScale = 0f;
-        float totalWeight = 0f;
+        float totalWeight = 0f;
-
+
-        for (int i = 0; i < inputCount; i++)
+        for (int i = 0; i < inputCount; i++)
-        {
+        {
-            float inputWeight = playable.GetInputWeight(i);
+            float inputWeight = playable.GetInputWeight(i);
-
+
-            totalWeight += inputWeight;
+            totalWeight += inputWeight;
-
+
-            ScriptPlayable<TimeDilationBehaviour> playableInput = (ScriptPlayable<TimeDilationBehaviour>)playable.GetInput (i);
+            ScriptPlayable<TimeDilationBehaviour> playableInput = (ScriptPlayable<TimeDilationBehaviour>)playable.GetInput (i);
-            TimeDilationBehaviour input = playableInput.GetBehaviour ();
+            TimeDilationBehaviour input = playableInput.GetBehaviour ();
-
+
-            mixedTimeScale += inputWeight * input.timeScale;
+            mixedTimeScale += inputWeight * input.timeScale;
-        }
+        }
-
+
-        Time.timeScale = mixedTimeScale + m_OldTimeScale * (1f - totalWeight);
+        Time.timeScale = mixedTimeScale + m_OldTimeScale * (1f - totalWeight);
-    }
+    }
-
+
-    public override void OnPlayableDestroy (Playable playable)
+    public override void OnPlayableDestroy (Playable playable)
-    {
+    {
-        Time.timeScale = m_OldTimeScale;
+        Time.timeScale = m_OldTimeScale;
-    }
+    }
-}
+}

+ 12 - 12
Assets/DefaultPlayables/TimeDilation/TimeDilationMixerBehaviour.cs.meta

@@ -1,12 +1,12 @@
-fileFormatVersion: 2
+fileFormatVersion: 2
-guid: 64af3ceaf545d3341b852718827f2b64
+guid: 64af3ceaf545d3341b852718827f2b64
-timeCreated: 1491318587
+timeCreated: 1491318587
-licenseType: Store
+licenseType: Store
-MonoImporter:
+MonoImporter:
-  serializedVersion: 2
+  serializedVersion: 2
-  defaultReferences: []
+  defaultReferences: []
-  executionOrder: 0
+  executionOrder: 0
-  icon: {instanceID: 0}
+  icon: {instanceID: 0}
-  userData: 
+  userData: 
-  assetBundleName: 
+  assetBundleName: 
-  assetBundleVariant: 
+  assetBundleVariant: 

+ 13 - 13
Assets/DefaultPlayables/TimeDilation/TimeDilationTrack.cs

@@ -1,13 +1,13 @@
-using UnityEngine;
+using UnityEngine;
-using UnityEngine.Playables;
+using UnityEngine.Playables;
-using UnityEngine.Timeline;
+using UnityEngine.Timeline;
-
+
-[TrackColor(0.855f, 0.8623f, 0.87f)]
+[TrackColor(0.855f, 0.8623f, 0.87f)]
-[TrackClipType(typeof(TimeDilationClip))]
+[TrackClipType(typeof(TimeDilationClip))]
-public class TimeDilationTrack : TrackAsset
+public class TimeDilationTrack : TrackAsset
-{
+{
-    public override Playable CreateTrackMixer(PlayableGraph graph, GameObject go, int inputCount)
+    public override Playable CreateTrackMixer(PlayableGraph graph, GameObject go, int inputCount)
-    {
+    {
-        return ScriptPlayable<TimeDilationMixerBehaviour>.Create (graph, inputCount);
+        return ScriptPlayable<TimeDilationMixerBehaviour>.Create (graph, inputCount);
-    }
+    }
-}
+}

+ 12 - 12
Assets/DefaultPlayables/TimeDilation/TimeDilationTrack.cs.meta

@@ -1,12 +1,12 @@
-fileFormatVersion: 2
+fileFormatVersion: 2
-guid: 0282fd402247fd34eb165b280236e58a
+guid: 0282fd402247fd34eb165b280236e58a
-timeCreated: 1491318587
+timeCreated: 1491318587
-licenseType: Store
+licenseType: Store
-MonoImporter:
+MonoImporter:
-  serializedVersion: 2
+  serializedVersion: 2
-  defaultReferences: []
+  defaultReferences: []
-  executionOrder: 0
+  executionOrder: 0
-  icon: {instanceID: 0}
+  icon: {instanceID: 0}
-  userData: 
+  userData: 
-  assetBundleName: 
+  assetBundleName: 
-  assetBundleVariant: 
+  assetBundleVariant: 

+ 44 - 44
Assets/DefaultPlayables/TransformTween/Editor/TransformTweenDrawer.cs

@@ -1,44 +1,44 @@
-using UnityEngine;
+using UnityEngine;
-using UnityEditor;
+using UnityEditor;
-
+
-[CustomPropertyDrawer(typeof(TransformTweenBehaviour))]
+[CustomPropertyDrawer(typeof(TransformTweenBehaviour))]
-public class TransformTweenDrawer : PropertyDrawer
+public class TransformTweenDrawer : PropertyDrawer
-{
+{
-    GUIContent m_TweenPositionContent = new GUIContent("Tween Position", "This should be true if the transformToMove to change position.  This causes recalulations each frame which are more CPU intensive.");
+    GUIContent m_TweenPositionContent = new GUIContent("Tween Position", "This should be true if the transformToMove to change position.  This causes recalulations each frame which are more CPU intensive.");
-    GUIContent m_TweenRotationContent = new GUIContent("Tween Rotation", "This should be true if the transformToMove to change rotation.");
+    GUIContent m_TweenRotationContent = new GUIContent("Tween Rotation", "This should be true if the transformToMove to change rotation.");
-    GUIContent m_TweenTypeContent = new GUIContent("Tween Type", "Linear - the transform moves the same amount each frame (assuming static start and end locations).\n"
+    GUIContent m_TweenTypeContent = new GUIContent("Tween Type", "Linear - the transform moves the same amount each frame (assuming static start and end locations).\n"
-        + "Deceleration - the transform moves slower the closer to the end location it is.\n"
+        + "Deceleration - the transform moves slower the closer to the end location it is.\n"
-        + "Harmonic - the transform moves faster in the middle of its tween.\n"
+        + "Harmonic - the transform moves faster in the middle of its tween.\n"
-        + "Custom - uses the customStartingSpeed and customEndingSpeed to create a curve for the desired tween.");
+        + "Custom - uses the customStartingSpeed and customEndingSpeed to create a curve for the desired tween.");
-    GUIContent m_CustomCurveContent = new GUIContent("Custom Curve", "This should be a normalised curve (between 0,0 and 1,1) that represents how the tweening object accelerates at different points along the clip.");
+    GUIContent m_CustomCurveContent = new GUIContent("Custom Curve", "This should be a normalised curve (between 0,0 and 1,1) that represents how the tweening object accelerates at different points along the clip.");
-
+
-    public override float GetPropertyHeight (SerializedProperty property, GUIContent label)
+    public override float GetPropertyHeight (SerializedProperty property, GUIContent label)
-    {
+    {
-        int fieldCount = property.FindPropertyRelative ("tweenType").enumValueIndex == (int)TransformTweenBehaviour.TweenType.Custom ? 5 : 3;
+        int fieldCount = property.FindPropertyRelative ("tweenType").enumValueIndex == (int)TransformTweenBehaviour.TweenType.Custom ? 5 : 3;
-        return fieldCount * (EditorGUIUtility.singleLineHeight);
+        return fieldCount * (EditorGUIUtility.singleLineHeight);
-    }
+    }
-
+
-    public override void OnGUI (Rect position, SerializedProperty property, GUIContent label)
+    public override void OnGUI (Rect position, SerializedProperty property, GUIContent label)
-    {
+    {
-        SerializedProperty tweenPositionProp = property.FindPropertyRelative ("tweenPosition");
+        SerializedProperty tweenPositionProp = property.FindPropertyRelative ("tweenPosition");
-        SerializedProperty tweenRotationProp = property.FindPropertyRelative("tweenRotation");
+        SerializedProperty tweenRotationProp = property.FindPropertyRelative("tweenRotation");
-        SerializedProperty tweenTypeProp = property.FindPropertyRelative ("tweenType");
+        SerializedProperty tweenTypeProp = property.FindPropertyRelative ("tweenType");
-        
+        
-        Rect singleFieldRect = new Rect(position.x, position.y, position.width, EditorGUIUtility.singleLineHeight);
+        Rect singleFieldRect = new Rect(position.x, position.y, position.width, EditorGUIUtility.singleLineHeight);
-        EditorGUI.PropertyField (singleFieldRect, tweenPositionProp, m_TweenPositionContent);
+        EditorGUI.PropertyField (singleFieldRect, tweenPositionProp, m_TweenPositionContent);
-        
+        
-        singleFieldRect.y += EditorGUIUtility.singleLineHeight;
+        singleFieldRect.y += EditorGUIUtility.singleLineHeight;
-        EditorGUI.PropertyField (singleFieldRect, tweenRotationProp, m_TweenRotationContent);
+        EditorGUI.PropertyField (singleFieldRect, tweenRotationProp, m_TweenRotationContent);
-
+
-        singleFieldRect.y += EditorGUIUtility.singleLineHeight;
+        singleFieldRect.y += EditorGUIUtility.singleLineHeight;
-        EditorGUI.PropertyField(singleFieldRect, tweenTypeProp, m_TweenTypeContent);
+        EditorGUI.PropertyField(singleFieldRect, tweenTypeProp, m_TweenTypeContent);
-
+
-        if (tweenTypeProp.enumValueIndex == (int)TransformTweenBehaviour.TweenType.Custom)
+        if (tweenTypeProp.enumValueIndex == (int)TransformTweenBehaviour.TweenType.Custom)
-        {
+        {
-            SerializedProperty customCurveProp = property.FindPropertyRelative ("customCurve");
+            SerializedProperty customCurveProp = property.FindPropertyRelative ("customCurve");
-            
+            
-            singleFieldRect.y += EditorGUIUtility.singleLineHeight;
+            singleFieldRect.y += EditorGUIUtility.singleLineHeight;
-            EditorGUI.PropertyField (singleFieldRect, customCurveProp, m_CustomCurveContent);
+            EditorGUI.PropertyField (singleFieldRect, customCurveProp, m_CustomCurveContent);
-        }
+        }
-    }
+    }
-}
+}

+ 12 - 12
Assets/DefaultPlayables/TransformTween/Editor/TransformTweenDrawer.cs.meta

@@ -1,12 +1,12 @@
-fileFormatVersion: 2
+fileFormatVersion: 2
-guid: d4c9e800b8d9b3344850b4b658de699d
+guid: d4c9e800b8d9b3344850b4b658de699d
-timeCreated: 1491229652
+timeCreated: 1491229652
-licenseType: Store
+licenseType: Store
-MonoImporter:
+MonoImporter:
-  serializedVersion: 2
+  serializedVersion: 2
-  defaultReferences: []
+  defaultReferences: []
-  executionOrder: 0
+  executionOrder: 0
-  icon: {instanceID: 0}
+  icon: {instanceID: 0}
-  userData: 
+  userData: 
-  assetBundleName: 
+  assetBundleName: 
-  assetBundleVariant: 
+  assetBundleVariant: 

+ 80 - 80
Assets/DefaultPlayables/TransformTween/TransformTweenBehaviour.cs

@@ -1,81 +1,81 @@
-using System;
+using System;
-using JetBrains.Annotations;
+using JetBrains.Annotations;
-using UnityEngine;
+using UnityEngine;
-using UnityEngine.Playables;
+using UnityEngine.Playables;
-using UnityEngine.Timeline;
+using UnityEngine.Timeline;
-
+
-[Serializable]
+[Serializable]
-public class TransformTweenBehaviour : PlayableBehaviour
+public class TransformTweenBehaviour : PlayableBehaviour
-{
+{
-    public enum TweenType
+    public enum TweenType
-    {
+    {
-        Linear,
+        Linear,
-        Deceleration,
+        Deceleration,
-        Harmonic,
+        Harmonic,
-        Custom,
+        Custom,
-    }
+    }
-
+
-    public Transform startLocation;
+    public Transform startLocation;
-    public Transform endLocation;
+    public Transform endLocation;
-    public bool tweenPosition = true;
+    public bool tweenPosition = true;
-    public bool tweenRotation = true;
+    public bool tweenRotation = true;
-    public TweenType tweenType;
+    public TweenType tweenType;
-    public AnimationCurve customCurve = AnimationCurve.Linear(0f, 0f, 1f, 1f);
+    public AnimationCurve customCurve = AnimationCurve.Linear(0f, 0f, 1f, 1f);
-    
+    
-    public Vector3 startingPosition;
+    public Vector3 startingPosition;
-    public Quaternion startingRotation = Quaternion.identity;
+    public Quaternion startingRotation = Quaternion.identity;
-
+
-    AnimationCurve m_LinearCurve = AnimationCurve.Linear(0f, 0f, 1f, 1f);
+    AnimationCurve m_LinearCurve = AnimationCurve.Linear(0f, 0f, 1f, 1f);
-    AnimationCurve m_DecelerationCurve = new AnimationCurve
+    AnimationCurve m_DecelerationCurve = new AnimationCurve
-    (
+    (
-        new Keyframe(0f, 0f, -k_RightAngleInRads, k_RightAngleInRads),
+        new Keyframe(0f, 0f, -k_RightAngleInRads, k_RightAngleInRads),
-        new Keyframe(1f, 1f, 0f, 0f)
+        new Keyframe(1f, 1f, 0f, 0f)
-    );
+    );
-    AnimationCurve m_HarmonicCurve = AnimationCurve.EaseInOut(0f, 0f, 1f, 1f);
+    AnimationCurve m_HarmonicCurve = AnimationCurve.EaseInOut(0f, 0f, 1f, 1f);
-
+
-    const float k_RightAngleInRads = Mathf.PI * 0.5f;
+    const float k_RightAngleInRads = Mathf.PI * 0.5f;
-
+
-    public override void PrepareFrame (Playable playable, FrameData info)
+    public override void PrepareFrame (Playable playable, FrameData info)
-    {
+    {
-        if (startLocation)
+        if (startLocation)
-        {
+        {
-            startingPosition = startLocation.position;
+            startingPosition = startLocation.position;
-            startingRotation = startLocation.rotation;
+            startingRotation = startLocation.rotation;
-        }
+        }
-    }
+    }
-
+
-    public float EvaluateCurrentCurve (float time)
+    public float EvaluateCurrentCurve (float time)
-    {
+    {
-        if (tweenType == TweenType.Custom && !IsCustomCurveNormalised ())
+        if (tweenType == TweenType.Custom && !IsCustomCurveNormalised ())
-        {
+        {
-            Debug.LogError("Custom Curve is not normalised.  Curve must start at 0,0 and end at 1,1.");
+            Debug.LogError("Custom Curve is not normalised.  Curve must start at 0,0 and end at 1,1.");
-            return 0f;
+            return 0f;
-        }
+        }
-        
+        
-        switch (tweenType)
+        switch (tweenType)
-        {
+        {
-            case TweenType.Linear:
+            case TweenType.Linear:
-                return m_LinearCurve.Evaluate (time);
+                return m_LinearCurve.Evaluate (time);
-            case TweenType.Deceleration:
+            case TweenType.Deceleration:
-                return m_DecelerationCurve.Evaluate (time);
+                return m_DecelerationCurve.Evaluate (time);
-            case TweenType.Harmonic:
+            case TweenType.Harmonic:
-                return m_HarmonicCurve.Evaluate (time);
+                return m_HarmonicCurve.Evaluate (time);
-            default:
+            default:
-                return customCurve.Evaluate (time);
+                return customCurve.Evaluate (time);
-        }
+        }
-    }
+    }
-
+
-    bool IsCustomCurveNormalised ()
+    bool IsCustomCurveNormalised ()
-    {
+    {
-        if (!Mathf.Approximately (customCurve[0].time, 0f))
+        if (!Mathf.Approximately (customCurve[0].time, 0f))
-            return false;
+            return false;
-        
+        
-        if (!Mathf.Approximately (customCurve[0].value, 0f))
+        if (!Mathf.Approximately (customCurve[0].value, 0f))
-            return false;
+            return false;
-        
+        
-        if (!Mathf.Approximately (customCurve[customCurve.length - 1].time, 1f))
+        if (!Mathf.Approximately (customCurve[customCurve.length - 1].time, 1f))
-            return false;
+            return false;
-        
+        
-        return Mathf.Approximately (customCurve[customCurve.length - 1].value, 1f);
+        return Mathf.Approximately (customCurve[customCurve.length - 1].value, 1f);
-    }
+    }
 }
 }

+ 12 - 12
Assets/DefaultPlayables/TransformTween/TransformTweenBehaviour.cs.meta

@@ -1,12 +1,12 @@
-fileFormatVersion: 2
+fileFormatVersion: 2
-guid: 0594bfd3cbfda4d4bab34de00fb2faed
+guid: 0594bfd3cbfda4d4bab34de00fb2faed
-timeCreated: 1493024223
+timeCreated: 1493024223
-licenseType: Store
+licenseType: Store
-MonoImporter:
+MonoImporter:
-  serializedVersion: 2
+  serializedVersion: 2
-  defaultReferences: []
+  defaultReferences: []
-  executionOrder: 0
+  executionOrder: 0
-  icon: {instanceID: 0}
+  icon: {instanceID: 0}
-  userData: 
+  userData: 
-  assetBundleName: 
+  assetBundleName: 
-  assetBundleVariant: 
+  assetBundleVariant: 

+ 25 - 25
Assets/DefaultPlayables/TransformTween/TransformTweenClip.cs

@@ -1,26 +1,26 @@
-using System;
+using System;
-using UnityEngine;
+using UnityEngine;
-using UnityEngine.Playables;
+using UnityEngine.Playables;
-using UnityEngine.Timeline;
+using UnityEngine.Timeline;
-
+
-[Serializable]
+[Serializable]
-public class TransformTweenClip : PlayableAsset, ITimelineClipAsset
+public class TransformTweenClip : PlayableAsset, ITimelineClipAsset
-{
+{
-    public TransformTweenBehaviour template = new TransformTweenBehaviour ();
+    public TransformTweenBehaviour template = new TransformTweenBehaviour ();
-    public ExposedReference<Transform> startLocation;
+    public ExposedReference<Transform> startLocation;
-    public ExposedReference<Transform> endLocation;
+    public ExposedReference<Transform> endLocation;
-    
+    
-    public ClipCaps clipCaps
+    public ClipCaps clipCaps
-    {
+    {
-        get { return ClipCaps.Blending; }
+        get { return ClipCaps.Blending; }
-    }
+    }
-
+
-    public override Playable CreatePlayable (PlayableGraph graph, GameObject owner)
+    public override Playable CreatePlayable (PlayableGraph graph, GameObject owner)
-    {
+    {
-        var playable = ScriptPlayable<TransformTweenBehaviour>.Create (graph, template);
+        var playable = ScriptPlayable<TransformTweenBehaviour>.Create (graph, template);
-        TransformTweenBehaviour clone = playable.GetBehaviour ();
+        TransformTweenBehaviour clone = playable.GetBehaviour ();
-        clone.startLocation = startLocation.Resolve (graph.GetResolver ());
+        clone.startLocation = startLocation.Resolve (graph.GetResolver ());
-        clone.endLocation = endLocation.Resolve (graph.GetResolver ());
+        clone.endLocation = endLocation.Resolve (graph.GetResolver ());
-        return playable;
+        return playable;
-    }
+    }
 }
 }

+ 12 - 12
Assets/DefaultPlayables/TransformTween/TransformTweenClip.cs.meta

@@ -1,12 +1,12 @@
-fileFormatVersion: 2
+fileFormatVersion: 2
-guid: f28fb04ff66f85e40af453230799042c
+guid: f28fb04ff66f85e40af453230799042c
-timeCreated: 1489416659
+timeCreated: 1489416659
-licenseType: Store
+licenseType: Store
-MonoImporter:
+MonoImporter:
-  serializedVersion: 2
+  serializedVersion: 2
-  defaultReferences: []
+  defaultReferences: []
-  executionOrder: 0
+  executionOrder: 0
-  icon: {instanceID: 0}
+  icon: {instanceID: 0}
-  userData: 
+  userData: 
-  assetBundleName: 
+  assetBundleName: 
-  assetBundleVariant: 
+  assetBundleVariant: 

+ 118 - 118
Assets/DefaultPlayables/TransformTween/TransformTweenMixerBehaviour.cs

@@ -1,119 +1,119 @@
-using System;
+using System;
-using UnityEngine;
+using UnityEngine;
-using UnityEngine.Playables;
+using UnityEngine.Playables;
-
+
-public class TransformTweenMixerBehaviour : PlayableBehaviour
+public class TransformTweenMixerBehaviour : PlayableBehaviour
-{
+{
-    bool m_FirstFrameHappened;
+    bool m_FirstFrameHappened;
-
+
-    public override void ProcessFrame(Playable playable, FrameData info, object playerData)
+    public override void ProcessFrame(Playable playable, FrameData info, object playerData)
-    {
+    {
-        Transform trackBinding = playerData as Transform;
+        Transform trackBinding = playerData as Transform;
-
+
-        if(trackBinding == null)
+        if(trackBinding == null)
-            return;
+            return;
-
+
-        Vector3 defaultPosition = trackBinding.position;
+        Vector3 defaultPosition = trackBinding.position;
-        Quaternion defaultRotation = trackBinding.rotation;
+        Quaternion defaultRotation = trackBinding.rotation;
-
+
-        int inputCount = playable.GetInputCount ();
+        int inputCount = playable.GetInputCount ();
-
+
-        float positionTotalWeight = 0f;
+        float positionTotalWeight = 0f;
-        float rotationTotalWeight = 0f;
+        float rotationTotalWeight = 0f;
-
+
-        Vector3 blendedPosition = Vector3.zero;
+        Vector3 blendedPosition = Vector3.zero;
-        Quaternion blendedRotation = new Quaternion(0f, 0f, 0f, 0f);
+        Quaternion blendedRotation = new Quaternion(0f, 0f, 0f, 0f);
-
+
-        for (int i = 0; i < inputCount; i++)
+        for (int i = 0; i < inputCount; i++)
-        {
+        {
-            ScriptPlayable<TransformTweenBehaviour> playableInput = (ScriptPlayable<TransformTweenBehaviour>)playable.GetInput (i);
+            ScriptPlayable<TransformTweenBehaviour> playableInput = (ScriptPlayable<TransformTweenBehaviour>)playable.GetInput (i);
-            TransformTweenBehaviour input = playableInput.GetBehaviour ();
+            TransformTweenBehaviour input = playableInput.GetBehaviour ();
-
+
-            if(input.endLocation == null)
+            if(input.endLocation == null)
-                continue;
+                continue;
-
+
-            float inputWeight = playable.GetInputWeight(i);
+            float inputWeight = playable.GetInputWeight(i);
-
+
-            if (!m_FirstFrameHappened && !input.startLocation)
+            if (!m_FirstFrameHappened && !input.startLocation)
-            {
+            {
-                input.startingPosition = defaultPosition;
+                input.startingPosition = defaultPosition;
-                input.startingRotation = defaultRotation;
+                input.startingRotation = defaultRotation;
-            }
+            }
-
+
-            float normalisedTime = (float)(playableInput.GetTime() / playableInput.GetDuration ());
+            float normalisedTime = (float)(playableInput.GetTime() / playableInput.GetDuration ());
-            float tweenProgress = input.EvaluateCurrentCurve(normalisedTime);
+            float tweenProgress = input.EvaluateCurrentCurve(normalisedTime);
-
+
-            if (input.tweenPosition)
+            if (input.tweenPosition)
-            {
+            {
-                positionTotalWeight += inputWeight;
+                positionTotalWeight += inputWeight;
-
+
-                blendedPosition += Vector3.Lerp(input.startingPosition, input.endLocation.position, tweenProgress) * inputWeight;
+                blendedPosition += Vector3.Lerp(input.startingPosition, input.endLocation.position, tweenProgress) * inputWeight;
-            }
+            }
-
+
-            if (input.tweenRotation)
+            if (input.tweenRotation)
-            {
+            {
-                rotationTotalWeight += inputWeight;
+                rotationTotalWeight += inputWeight;
-
+
-                Quaternion desiredRotation = Quaternion.Lerp(input.startingRotation, input.endLocation.rotation, tweenProgress);
+                Quaternion desiredRotation = Quaternion.Lerp(input.startingRotation, input.endLocation.rotation, tweenProgress);
-                desiredRotation = NormalizeQuaternion(desiredRotation);
+                desiredRotation = NormalizeQuaternion(desiredRotation);
-
+
-                if (Quaternion.Dot (blendedRotation, desiredRotation) < 0f)
+                if (Quaternion.Dot (blendedRotation, desiredRotation) < 0f)
-                {
+                {
-                    desiredRotation = ScaleQuaternion (desiredRotation, -1f);
+                    desiredRotation = ScaleQuaternion (desiredRotation, -1f);
-                }
+                }
-
+
-                desiredRotation = ScaleQuaternion(desiredRotation, inputWeight);
+                desiredRotation = ScaleQuaternion(desiredRotation, inputWeight);
-
+
-                blendedRotation = AddQuaternions (blendedRotation, desiredRotation);
+                blendedRotation = AddQuaternions (blendedRotation, desiredRotation);
-            }
+            }
-        }
+        }
-
+
-        blendedPosition += defaultPosition * (1f - positionTotalWeight);
+        blendedPosition += defaultPosition * (1f - positionTotalWeight);
-        Quaternion weightedDefaultRotation = ScaleQuaternion (defaultRotation, 1f - rotationTotalWeight);
+        Quaternion weightedDefaultRotation = ScaleQuaternion (defaultRotation, 1f - rotationTotalWeight);
-        blendedRotation = AddQuaternions (blendedRotation, weightedDefaultRotation);
+        blendedRotation = AddQuaternions (blendedRotation, weightedDefaultRotation);
-
+
-        trackBinding.position = blendedPosition;
+        trackBinding.position = blendedPosition;
-        trackBinding.rotation = blendedRotation;
+        trackBinding.rotation = blendedRotation;
-        
+        
-        m_FirstFrameHappened = true;
+        m_FirstFrameHappened = true;
-    }
+    }
-
+
-    public override void OnPlayableDestroy (Playable playable)
+    public override void OnPlayableDestroy (Playable playable)
-    {
+    {
-        m_FirstFrameHappened = false;
+        m_FirstFrameHappened = false;
-    }
+    }
-
+
-    static Quaternion AddQuaternions (Quaternion first, Quaternion second)
+    static Quaternion AddQuaternions (Quaternion first, Quaternion second)
-    {
+    {
-        first.w += second.w;
+        first.w += second.w;
-        first.x += second.x;
+        first.x += second.x;
-        first.y += second.y;
+        first.y += second.y;
-        first.z += second.z;
+        first.z += second.z;
-        return first;
+        return first;
-    }
+    }
-
+
-    static Quaternion ScaleQuaternion (Quaternion rotation, float multiplier)
+    static Quaternion ScaleQuaternion (Quaternion rotation, float multiplier)
-    {
+    {
-        rotation.w *= multiplier;
+        rotation.w *= multiplier;
-        rotation.x *= multiplier;
+        rotation.x *= multiplier;
-        rotation.y *= multiplier;
+        rotation.y *= multiplier;
-        rotation.z *= multiplier;
+        rotation.z *= multiplier;
-        return rotation;
+        return rotation;
-    }
+    }
-
+
-    static float QuaternionMagnitude (Quaternion rotation)
+    static float QuaternionMagnitude (Quaternion rotation)
-    {
+    {
-        return Mathf.Sqrt ((Quaternion.Dot (rotation, rotation)));
+        return Mathf.Sqrt ((Quaternion.Dot (rotation, rotation)));
-    }
+    }
-
+
-    static Quaternion NormalizeQuaternion (Quaternion rotation)
+    static Quaternion NormalizeQuaternion (Quaternion rotation)
-    {
+    {
-        float magnitude = QuaternionMagnitude (rotation);
+        float magnitude = QuaternionMagnitude (rotation);
-
+
-        if (magnitude > 0f)
+        if (magnitude > 0f)
-            return ScaleQuaternion (rotation, 1f / magnitude);
+            return ScaleQuaternion (rotation, 1f / magnitude);
-
+
-        Debug.LogWarning ("Cannot normalize a quaternion with zero magnitude.");
+        Debug.LogWarning ("Cannot normalize a quaternion with zero magnitude.");
-        return Quaternion.identity;
+        return Quaternion.identity;
-    }
+    }
 }
 }

+ 12 - 12
Assets/DefaultPlayables/TransformTween/TransformTweenMixerBehaviour.cs.meta

@@ -1,12 +1,12 @@
-fileFormatVersion: 2
+fileFormatVersion: 2
-guid: e904ec43bfb67e843b3b830e3d2adc1d
+guid: e904ec43bfb67e843b3b830e3d2adc1d
-timeCreated: 1493024236
+timeCreated: 1493024236
-licenseType: Store
+licenseType: Store
-MonoImporter:
+MonoImporter:
-  serializedVersion: 2
+  serializedVersion: 2
-  defaultReferences: []
+  defaultReferences: []
-  executionOrder: 0
+  executionOrder: 0
-  icon: {instanceID: 0}
+  icon: {instanceID: 0}
-  userData: 
+  userData: 
-  assetBundleName: 
+  assetBundleName: 
-  assetBundleVariant: 
+  assetBundleVariant: 

+ 32 - 32
Assets/DefaultPlayables/TransformTween/TransformTweenTrack.cs

@@ -1,32 +1,32 @@
-using UnityEngine;
+using UnityEngine;
-using UnityEngine.Playables;
+using UnityEngine.Playables;
-using UnityEngine.Timeline;
+using UnityEngine.Timeline;
-
+
-[TrackColor(0.855f,0.8623f,0.870f)]
+[TrackColor(0.855f,0.8623f,0.870f)]
-[TrackClipType(typeof(TransformTweenClip))]
+[TrackClipType(typeof(TransformTweenClip))]
-[TrackBindingType(typeof(Transform))]
+[TrackBindingType(typeof(Transform))]
-public class TransformTweenTrack : TrackAsset
+public class TransformTweenTrack : TrackAsset
-{
+{
-	public override Playable CreateTrackMixer(PlayableGraph graph, GameObject go, int inputCount)
+	public override Playable CreateTrackMixer(PlayableGraph graph, GameObject go, int inputCount)
-	{
+	{
-	    return ScriptPlayable<TransformTweenMixerBehaviour>.Create (graph, inputCount);
+	    return ScriptPlayable<TransformTweenMixerBehaviour>.Create (graph, inputCount);
-	}
+	}
-
+
-    public override void GatherProperties(PlayableDirector director, IPropertyCollector driver)
+    public override void GatherProperties(PlayableDirector director, IPropertyCollector driver)
-    {
+    {
-#if UNITY_EDITOR
+#if UNITY_EDITOR
-        var comp = director.GetGenericBinding(this) as Transform;
+        var comp = director.GetGenericBinding(this) as Transform;
-        if (comp == null)
+        if (comp == null)
-            return;
+            return;
-        var so = new UnityEditor.SerializedObject(comp);
+        var so = new UnityEditor.SerializedObject(comp);
-        var iter = so.GetIterator();
+        var iter = so.GetIterator();
-        while (iter.NextVisible(true))
+        while (iter.NextVisible(true))
-        {
+        {
-            if (iter.hasVisibleChildren)
+            if (iter.hasVisibleChildren)
-                continue;
+                continue;
-            driver.AddFromName<Transform>(comp.gameObject, iter.propertyPath);
+            driver.AddFromName<Transform>(comp.gameObject, iter.propertyPath);
-        }
+        }
-#endif
+#endif
-        base.GatherProperties(director, driver);
+        base.GatherProperties(director, driver);
-    }
+    }
-}
+}

+ 12 - 12
Assets/DefaultPlayables/TransformTween/TransformTweenTrack.cs.meta

@@ -1,12 +1,12 @@
-fileFormatVersion: 2
+fileFormatVersion: 2
-guid: f2e6ab84ba07902498da4807885565cb
+guid: f2e6ab84ba07902498da4807885565cb
-timeCreated: 1489416673
+timeCreated: 1489416673
-licenseType: Store
+licenseType: Store
-MonoImporter:
+MonoImporter:
-  serializedVersion: 2
+  serializedVersion: 2
-  defaultReferences: []
+  defaultReferences: []
-  executionOrder: 0
+  executionOrder: 0
-  icon: {instanceID: 0}
+  icon: {instanceID: 0}
-  userData: 
+  userData: 
-  assetBundleName: 
+  assetBundleName: 
-  assetBundleVariant: 
+  assetBundleVariant: 

+ 176 - 176
Assets/DefaultPlayables/Video/VideoPlayableBehaviour.cs

@@ -1,176 +1,176 @@
-using UnityEngine;
+using UnityEngine;
-using UnityEngine.Playables;
+using UnityEngine.Playables;
-using UnityEngine.Video;
+using UnityEngine.Video;
-
+
-namespace UnityEngine.Timeline
+namespace UnityEngine.Timeline
-{
+{
-	public class VideoPlayableBehaviour : PlayableBehaviour
+	public class VideoPlayableBehaviour : PlayableBehaviour
-    {
+    {
-        public VideoPlayer videoPlayer;
+        public VideoPlayer videoPlayer;
-		public VideoClip videoClip;
+		public VideoClip videoClip;
-        public bool mute = false;
+        public bool mute = false;
-        public bool loop = true;
+        public bool loop = true;
-        public double preloadTime = 0.3;
+        public double preloadTime = 0.3;
-        public double clipInTime = 0.0;
+        public double clipInTime = 0.0;
-
+
-        private bool playedOnce = false;
+        private bool playedOnce = false;
-        private bool preparing = false;
+        private bool preparing = false;
-
+
-        public void PrepareVideo()
+        public void PrepareVideo()
-        {
+        {
-            if (videoPlayer == null || videoClip == null)
+            if (videoPlayer == null || videoClip == null)
-                return;
+                return;
-
+
-            videoPlayer.targetCameraAlpha = 0.0f;
+            videoPlayer.targetCameraAlpha = 0.0f;
-
+
-            if (videoPlayer.clip != videoClip)
+            if (videoPlayer.clip != videoClip)
-                StopVideo();
+                StopVideo();
-
+
-            if (videoPlayer.isPrepared || preparing)
+            if (videoPlayer.isPrepared || preparing)
-                return;
+                return;
-
+
-            videoPlayer.source = VideoSource.VideoClip;
+            videoPlayer.source = VideoSource.VideoClip;
-            videoPlayer.clip = videoClip;
+            videoPlayer.clip = videoClip;
-            videoPlayer.playOnAwake = false;
+            videoPlayer.playOnAwake = false;
-            videoPlayer.waitForFirstFrame = true;
+            videoPlayer.waitForFirstFrame = true;
-		    videoPlayer.isLooping = loop;
+		    videoPlayer.isLooping = loop;
-
+
-            for (ushort i = 0; i < videoClip.audioTrackCount; ++i)
+            for (ushort i = 0; i < videoClip.audioTrackCount; ++i)
-            {
+            {
-                if (videoPlayer.audioOutputMode == VideoAudioOutputMode.Direct)
+                if (videoPlayer.audioOutputMode == VideoAudioOutputMode.Direct)
-                    videoPlayer.SetDirectAudioMute(i, mute || !Application.isPlaying);
+                    videoPlayer.SetDirectAudioMute(i, mute || !Application.isPlaying);
-                else if (videoPlayer.audioOutputMode == VideoAudioOutputMode.AudioSource)
+                else if (videoPlayer.audioOutputMode == VideoAudioOutputMode.AudioSource)
-                {
+                {
-                    AudioSource audioSource = videoPlayer.GetTargetAudioSource(i);
+                    AudioSource audioSource = videoPlayer.GetTargetAudioSource(i);
-                    if (audioSource != null)
+                    if (audioSource != null)
-                        audioSource.mute = mute || !Application.isPlaying;
+                        audioSource.mute = mute || !Application.isPlaying;
-                }
+                }
-            }
+            }
-
+
-            videoPlayer.loopPointReached += LoopPointReached;
+            videoPlayer.loopPointReached += LoopPointReached;
-            videoPlayer.time = clipInTime;
+            videoPlayer.time = clipInTime;
-            videoPlayer.Prepare();
+            videoPlayer.Prepare();
-            preparing = true;
+            preparing = true;
-        }
+        }
-
+
-        void LoopPointReached(VideoPlayer vp)
+        void LoopPointReached(VideoPlayer vp)
-        {
+        {
-            playedOnce = !loop;
+            playedOnce = !loop;
-        }
+        }
-
+
-        public override void PrepareFrame(Playable playable, FrameData info)
+        public override void PrepareFrame(Playable playable, FrameData info)
-		{
+		{
-			if (videoPlayer == null || videoClip == null)
+			if (videoPlayer == null || videoClip == null)
-				return;
+				return;
-
+
-            videoPlayer.timeReference = Application.isPlaying ? VideoTimeReference.ExternalTime :
+            videoPlayer.timeReference = Application.isPlaying ? VideoTimeReference.ExternalTime :
-                                                                VideoTimeReference.Freerun;
+                                                                VideoTimeReference.Freerun;
-																
+																
-		    if (videoPlayer.isPlaying && Application.isPlaying)
+		    if (videoPlayer.isPlaying && Application.isPlaying)
-			    videoPlayer.externalReferenceTime = playable.GetTime();
+			    videoPlayer.externalReferenceTime = playable.GetTime();
-            else if (!Application.isPlaying)
+            else if (!Application.isPlaying)
-                SyncVideoToPlayable(playable);
+                SyncVideoToPlayable(playable);
-        }
+        }
-
+
-        public override void OnBehaviourPlay(Playable playable, FrameData info)
+        public override void OnBehaviourPlay(Playable playable, FrameData info)
-        {
+        {
-            if (videoPlayer == null)
+            if (videoPlayer == null)
-                return;
+                return;
-
+
-            if (!playedOnce)
+            if (!playedOnce)
-            {
+            {
-                PlayVideo();
+                PlayVideo();
-                SyncVideoToPlayable(playable);
+                SyncVideoToPlayable(playable);
-            }
+            }
-        }
+        }
-
+
-        public override void OnBehaviourPause(Playable playable, FrameData info)
+        public override void OnBehaviourPause(Playable playable, FrameData info)
-        {
+        {
-            if (videoPlayer == null)
+            if (videoPlayer == null)
-                return;
+                return;
-
+
-            if (Application.isPlaying)
+            if (Application.isPlaying)
-                PauseVideo();
+                PauseVideo();
-            else
+            else
-                StopVideo();
+                StopVideo();
-        }
+        }
-
+
-		public override void ProcessFrame(Playable playable, FrameData info, object playerData)
+		public override void ProcessFrame(Playable playable, FrameData info, object playerData)
-		{
+		{
-			if (videoPlayer == null || videoPlayer.clip == null)
+			if (videoPlayer == null || videoPlayer.clip == null)
-				return;
+				return;
-
+
-            videoPlayer.targetCameraAlpha = info.weight;
+            videoPlayer.targetCameraAlpha = info.weight;
-
+
-		    if (Application.isPlaying)
+		    if (Application.isPlaying)
-		    {
+		    {
-		        for (ushort i = 0; i < videoPlayer.clip.audioTrackCount; ++i)
+		        for (ushort i = 0; i < videoPlayer.clip.audioTrackCount; ++i)
-		        {
+		        {
-		            if (videoPlayer.audioOutputMode == VideoAudioOutputMode.Direct)
+		            if (videoPlayer.audioOutputMode == VideoAudioOutputMode.Direct)
-		                videoPlayer.SetDirectAudioVolume(i, info.weight);
+		                videoPlayer.SetDirectAudioVolume(i, info.weight);
-		            else if (videoPlayer.audioOutputMode == VideoAudioOutputMode.AudioSource)
+		            else if (videoPlayer.audioOutputMode == VideoAudioOutputMode.AudioSource)
-		            {
+		            {
-		                AudioSource audioSource = videoPlayer.GetTargetAudioSource(i);
+		                AudioSource audioSource = videoPlayer.GetTargetAudioSource(i);
-		                if (audioSource != null)
+		                if (audioSource != null)
-		                    audioSource.volume = info.weight;
+		                    audioSource.volume = info.weight;
-		            }
+		            }
-		        }
+		        }
-		    }
+		    }
-		}
+		}
-
+
-		public override void OnGraphStart(Playable playable)
+		public override void OnGraphStart(Playable playable)
-		{
+		{
-		    playedOnce = false;
+		    playedOnce = false;
-		}
+		}
-
+
-		public override void OnGraphStop(Playable playable)
+		public override void OnGraphStop(Playable playable)
-		{
+		{
-		    if (!Application.isPlaying)
+		    if (!Application.isPlaying)
-		        StopVideo();
+		        StopVideo();
-		}
+		}
-
+
-        public override void OnPlayableDestroy(Playable playable)
+        public override void OnPlayableDestroy(Playable playable)
-        {
+        {
-            StopVideo();
+            StopVideo();
-        }
+        }
-
+
-        public void PlayVideo()
+        public void PlayVideo()
-        {
+        {
-            if (videoPlayer == null)
+            if (videoPlayer == null)
-                return;
+                return;
-
+
-            videoPlayer.Play();
+            videoPlayer.Play();
-            preparing = false;
+            preparing = false;
-
+
-            if (!Application.isPlaying)
+            if (!Application.isPlaying)
-                PauseVideo();
+                PauseVideo();
-        }
+        }
-
+
-        public void PauseVideo()
+        public void PauseVideo()
-        {
+        {
-            if (videoPlayer == null)
+            if (videoPlayer == null)
-                return;
+                return;
-
+
-            videoPlayer.Pause();
+            videoPlayer.Pause();
-            preparing = false;
+            preparing = false;
-        }
+        }
-
+
-        public void StopVideo()
+        public void StopVideo()
-        {
+        {
-            if (videoPlayer == null)
+            if (videoPlayer == null)
-                return;
+                return;
-
+
-            playedOnce = false;
+            playedOnce = false;
-            videoPlayer.Stop();
+            videoPlayer.Stop();
-            preparing = false;
+            preparing = false;
-        }
+        }
-
+
-        private void SyncVideoToPlayable(Playable playable)
+        private void SyncVideoToPlayable(Playable playable)
-        {
+        {
-            if (videoPlayer == null || videoPlayer.clip == null)
+            if (videoPlayer == null || videoPlayer.clip == null)
-                return;
+                return;
-
+
-            videoPlayer.time = (clipInTime + (playable.GetTime() * videoPlayer.playbackSpeed)) % videoPlayer.clip.length;
+            videoPlayer.time = (clipInTime + (playable.GetTime() * videoPlayer.playbackSpeed)) % videoPlayer.clip.length;
-        }
+        }
-    }
+    }
-}
+}

+ 12 - 12
Assets/DefaultPlayables/Video/VideoPlayableBehaviour.cs.meta

@@ -1,12 +1,12 @@
-fileFormatVersion: 2
+fileFormatVersion: 2
-guid: f9cbe3d1fa4843444a5eb76370a4dd15
+guid: f9cbe3d1fa4843444a5eb76370a4dd15
-timeCreated: 1497258618
+timeCreated: 1497258618
-licenseType: Store
+licenseType: Store
-MonoImporter:
+MonoImporter:
-  serializedVersion: 2
+  serializedVersion: 2
-  defaultReferences: []
+  defaultReferences: []
-  executionOrder: 0
+  executionOrder: 0
-  icon: {instanceID: 0}
+  icon: {instanceID: 0}
-  userData: 
+  userData: 
-  assetBundleName: 
+  assetBundleName: 
-  assetBundleVariant: 
+  assetBundleVariant: 

+ 52 - 52
Assets/DefaultPlayables/Video/VideoSchedulerPlayableBehaviour.cs

@@ -1,52 +1,52 @@
-using System;
+using System;
-using System.Collections.Generic;
+using System.Collections.Generic;
-using UnityEngine;
+using UnityEngine;
-using UnityEngine.Playables;
+using UnityEngine.Playables;
-
+
-namespace UnityEngine.Timeline
+namespace UnityEngine.Timeline
-{
+{
-    public sealed class VideoSchedulerPlayableBehaviour : PlayableBehaviour
+    public sealed class VideoSchedulerPlayableBehaviour : PlayableBehaviour
-    {
+    {
-		private IEnumerable<TimelineClip> m_Clips;
+		private IEnumerable<TimelineClip> m_Clips;
-        private PlayableDirector m_Director;
+        private PlayableDirector m_Director;
-
+
-        internal PlayableDirector director
+        internal PlayableDirector director
-        {
+        {
-            get { return m_Director; }
+            get { return m_Director; }
-            set { m_Director = value; }
+            set { m_Director = value; }
-        }
+        }
-
+
-        internal IEnumerable<TimelineClip> clips
+        internal IEnumerable<TimelineClip> clips
-        {
+        {
-            get { return m_Clips; }
+            get { return m_Clips; }
-            set { m_Clips = value; }
+            set { m_Clips = value; }
-        }
+        }
-
+
-        public override void ProcessFrame(Playable playable, FrameData info, object playerData)
+        public override void ProcessFrame(Playable playable, FrameData info, object playerData)
-        {
+        {
-            if (m_Clips == null)
+            if (m_Clips == null)
-                return;
+                return;
-
+
-            int inputPort = 0;
+            int inputPort = 0;
-            foreach (TimelineClip clip in m_Clips)
+            foreach (TimelineClip clip in m_Clips)
-            {
+            {
-				ScriptPlayable<VideoPlayableBehaviour> scriptPlayable =
+				ScriptPlayable<VideoPlayableBehaviour> scriptPlayable =
-					(ScriptPlayable<VideoPlayableBehaviour>)playable.GetInput(inputPort);
+					(ScriptPlayable<VideoPlayableBehaviour>)playable.GetInput(inputPort);
-
+
-				VideoPlayableBehaviour videoPlayableBehaviour = scriptPlayable.GetBehaviour();
+				VideoPlayableBehaviour videoPlayableBehaviour = scriptPlayable.GetBehaviour();
-
+
-				if (videoPlayableBehaviour != null)
+				if (videoPlayableBehaviour != null)
-				{
+				{
-					double preloadTime = Math.Max(0.0, videoPlayableBehaviour.preloadTime);
+					double preloadTime = Math.Max(0.0, videoPlayableBehaviour.preloadTime);
-					if (m_Director.time >= clip.start + clip.duration ||
+					if (m_Director.time >= clip.start + clip.duration ||
-						m_Director.time <= clip.start - preloadTime)
+						m_Director.time <= clip.start - preloadTime)
-						videoPlayableBehaviour.StopVideo();
+						videoPlayableBehaviour.StopVideo();
-					else if (m_Director.time > clip.start - preloadTime)
+					else if (m_Director.time > clip.start - preloadTime)
-						videoPlayableBehaviour.PrepareVideo();
+						videoPlayableBehaviour.PrepareVideo();
-				}
+				}
-					
+					
-                ++inputPort;
+                ++inputPort;
-            }
+            }
-        }
+        }
-	}
+	}
-}
+}

+ 12 - 12
Assets/DefaultPlayables/Video/VideoSchedulerPlayableBehaviour.cs.meta

@@ -1,12 +1,12 @@
-fileFormatVersion: 2
+fileFormatVersion: 2
-guid: 6dfd332197b07004c90e572e7b383e47
+guid: 6dfd332197b07004c90e572e7b383e47
-timeCreated: 1497258618
+timeCreated: 1497258618
-licenseType: Store
+licenseType: Store
-MonoImporter:
+MonoImporter:
-  serializedVersion: 2
+  serializedVersion: 2
-  defaultReferences: []
+  defaultReferences: []
-  executionOrder: 0
+  executionOrder: 0
-  icon: {instanceID: 0}
+  icon: {instanceID: 0}
-  userData: 
+  userData: 
-  assetBundleName: 
+  assetBundleName: 
-  assetBundleVariant: 
+  assetBundleVariant: 

+ 45 - 45
Assets/DefaultPlayables/Video/VideoScriptPlayableAsset.cs

@@ -1,45 +1,45 @@
-using System;
+using System;
-using UnityEngine;
+using UnityEngine;
-using UnityEngine.Playables;
+using UnityEngine.Playables;
-using UnityEngine.Video;
+using UnityEngine.Video;
-
+
-namespace UnityEngine.Timeline
+namespace UnityEngine.Timeline
-{
+{
-	[Serializable]
+	[Serializable]
-    public class VideoScriptPlayableAsset : PlayableAsset
+    public class VideoScriptPlayableAsset : PlayableAsset
-	{
+	{
-        public ExposedReference<VideoPlayer> videoPlayer;
+        public ExposedReference<VideoPlayer> videoPlayer;
-
+
-        [SerializeField, NotKeyable]
+        [SerializeField, NotKeyable]
-		public VideoClip videoClip;
+		public VideoClip videoClip;
-
+
-        [SerializeField, NotKeyable]
+        [SerializeField, NotKeyable]
-        public bool mute = false;
+        public bool mute = false;
-
+
-        [SerializeField, NotKeyable]
+        [SerializeField, NotKeyable]
-        public bool loop = true;
+        public bool loop = true;
-
+
-        [SerializeField, NotKeyable]
+        [SerializeField, NotKeyable]
-        public double preloadTime = 0.3;
+        public double preloadTime = 0.3;
-
+
-        [SerializeField, NotKeyable]
+        [SerializeField, NotKeyable]
-        public double clipInTime = 0.0;
+        public double clipInTime = 0.0;
-
+
-        public override Playable CreatePlayable(PlayableGraph graph, GameObject go)
+        public override Playable CreatePlayable(PlayableGraph graph, GameObject go)
-		{
+		{
-            ScriptPlayable<VideoPlayableBehaviour> playable =
+            ScriptPlayable<VideoPlayableBehaviour> playable =
-                ScriptPlayable<VideoPlayableBehaviour>.Create(graph);
+                ScriptPlayable<VideoPlayableBehaviour>.Create(graph);
-
+
-            VideoPlayableBehaviour playableBehaviour = playable.GetBehaviour();
+            VideoPlayableBehaviour playableBehaviour = playable.GetBehaviour();
-
+
-            playableBehaviour.videoPlayer = videoPlayer.Resolve(graph.GetResolver());
+            playableBehaviour.videoPlayer = videoPlayer.Resolve(graph.GetResolver());
-            playableBehaviour.videoClip = videoClip;
+            playableBehaviour.videoClip = videoClip;
-            playableBehaviour.mute = mute;
+            playableBehaviour.mute = mute;
-            playableBehaviour.loop = loop;
+            playableBehaviour.loop = loop;
-            playableBehaviour.preloadTime = preloadTime;
+            playableBehaviour.preloadTime = preloadTime;
-            playableBehaviour.clipInTime = clipInTime;
+            playableBehaviour.clipInTime = clipInTime;
-
+
-            return playable;
+            return playable;
-		}
+		}
-	}
+	}
-}
+}

+ 12 - 12
Assets/DefaultPlayables/Video/VideoScriptPlayableAsset.cs.meta

@@ -1,12 +1,12 @@
-fileFormatVersion: 2
+fileFormatVersion: 2
-guid: 88bb1acb4c6ce544788ae727c940bd7e
+guid: 88bb1acb4c6ce544788ae727c940bd7e
-timeCreated: 1497258618
+timeCreated: 1497258618
-licenseType: Store
+licenseType: Store
-MonoImporter:
+MonoImporter:
-  serializedVersion: 2
+  serializedVersion: 2
-  defaultReferences: []
+  defaultReferences: []
-  executionOrder: 0
+  executionOrder: 0
-  icon: {instanceID: 0}
+  icon: {instanceID: 0}
-  userData: 
+  userData: 
-  assetBundleName: 
+  assetBundleName: 
-  assetBundleVariant: 
+  assetBundleVariant: 

+ 34 - 34
Assets/DefaultPlayables/Video/VideoScriptPlayableTrack.cs

@@ -1,34 +1,34 @@
-using System;
+using System;
-using System.Collections.Generic;
+using System.Collections.Generic;
-using UnityEngine;
+using UnityEngine;
-using UnityEngine.Playables;
+using UnityEngine.Playables;
-
+
-namespace UnityEngine.Timeline
+namespace UnityEngine.Timeline
-{
+{
-	[Serializable]
+	[Serializable]
-    [TrackClipType(typeof(VideoScriptPlayableAsset))]
+    [TrackClipType(typeof(VideoScriptPlayableAsset))]
-    [TrackMediaType(TimelineAsset.MediaType.Script)]
+    [TrackMediaType(TimelineAsset.MediaType.Script)]
-    [TrackColor(0.008f, 0.698f, 0.655f)]
+    [TrackColor(0.008f, 0.698f, 0.655f)]
-    public class VideoScriptPlayableTrack : TrackAsset
+    public class VideoScriptPlayableTrack : TrackAsset
-	{
+	{
-        public override Playable CreateTrackMixer(PlayableGraph graph, GameObject go, int inputCount)
+        public override Playable CreateTrackMixer(PlayableGraph graph, GameObject go, int inputCount)
-        {
+        {
-            PlayableDirector playableDirector = go.GetComponent<PlayableDirector>();
+            PlayableDirector playableDirector = go.GetComponent<PlayableDirector>();
-
+
-            ScriptPlayable<VideoSchedulerPlayableBehaviour> playable =
+            ScriptPlayable<VideoSchedulerPlayableBehaviour> playable =
-                ScriptPlayable<VideoSchedulerPlayableBehaviour>.Create(graph, inputCount);
+                ScriptPlayable<VideoSchedulerPlayableBehaviour>.Create(graph, inputCount);
-
+
-            VideoSchedulerPlayableBehaviour videoSchedulerPlayableBehaviour =
+            VideoSchedulerPlayableBehaviour videoSchedulerPlayableBehaviour =
-                   playable.GetBehaviour();
+                   playable.GetBehaviour();
-
+
-            if (videoSchedulerPlayableBehaviour != null)
+            if (videoSchedulerPlayableBehaviour != null)
-            {
+            {
-                videoSchedulerPlayableBehaviour.director = playableDirector;
+                videoSchedulerPlayableBehaviour.director = playableDirector;
-                videoSchedulerPlayableBehaviour.clips = GetClips();
+                videoSchedulerPlayableBehaviour.clips = GetClips();
-            }
+            }
-
+
-            return playable;
+            return playable;
-        }
+        }
-    }
+    }
-}
+}
-
+

+ 12 - 12
Assets/DefaultPlayables/Video/VideoScriptPlayableTrack.cs.meta

@@ -1,12 +1,12 @@
-fileFormatVersion: 2
+fileFormatVersion: 2
-guid: b5bef7c9d630a7042b864b59b09e597c
+guid: b5bef7c9d630a7042b864b59b09e597c
-timeCreated: 1497258618
+timeCreated: 1497258618
-licenseType: Store
+licenseType: Store
-MonoImporter:
+MonoImporter:
-  serializedVersion: 2
+  serializedVersion: 2
-  defaultReferences: []
+  defaultReferences: []
-  executionOrder: 0
+  executionOrder: 0
-  icon: {instanceID: 0}
+  icon: {instanceID: 0}
-  userData: 
+  userData: 
-  assetBundleName: 
+  assetBundleName: 
-  assetBundleVariant: 
+  assetBundleVariant: 

+ 60 - 60
Assets/DrawingAir/DrawListManager.cs

@@ -1,60 +1,60 @@
-using System.Collections;
+using System.Collections;
-using System.Collections.Generic;
+using System.Collections.Generic;
-using UnityEngine;
+using UnityEngine;
-
+
-public class DrawListManager : MonoBehaviour
+public class DrawListManager : MonoBehaviour
-{
+{
-    public static DrawListManager _instance;
+    public static DrawListManager _instance;
-    private Stack<GameObject> Dlist = new Stack<GameObject>();
+    private Stack<GameObject> Dlist = new Stack<GameObject>();
-    
+    
-    private void Awake()
+    private void Awake()
-    {
+    {
-        _instance = this;
+        _instance = this;
-        MessageCenterController.Instance.Register(GameEnum.MESSAGE_DRAW_UNDO_PREVIOUS, RemoveLast);
+        MessageCenterController.Instance.Register(GameEnum.MESSAGE_DRAW_UNDO_PREVIOUS, RemoveLast);
-        MessageCenterController.Instance.Register(GameEnum.MESSAGE_DRAW_UNDO_ALL, RemoveAll);
+        MessageCenterController.Instance.Register(GameEnum.MESSAGE_DRAW_UNDO_ALL, RemoveAll);
-    }
+    }
-
+
-    private void OnDestroy()
+    private void OnDestroy()
-    {
+    {
-        RemoveAll();
+        RemoveAll();
-        MessageCenterController.Instance.UnRegister(GameEnum.MESSAGE_DRAW_UNDO_PREVIOUS, RemoveLast);
+        MessageCenterController.Instance.UnRegister(GameEnum.MESSAGE_DRAW_UNDO_PREVIOUS, RemoveLast);
-        MessageCenterController.Instance.UnRegister(GameEnum.MESSAGE_DRAW_UNDO_ALL, RemoveAll);
+        MessageCenterController.Instance.UnRegister(GameEnum.MESSAGE_DRAW_UNDO_ALL, RemoveAll);
-    }
+    }
-
+
-
+
-    public void AddBrush(GameObject g)
+    public void AddBrush(GameObject g)
-    {
+    {
-        g.transform.parent = transform;
+        g.transform.parent = transform;
-        Dlist.Push(g);
+        Dlist.Push(g);
-    }
+    }
-
+
-    public void RemoveLast(object o = null)
+    public void RemoveLast(object o = null)
-    {
+    {
-        if (Dlist.Count > 0)
+        if (Dlist.Count > 0)
-        {
+        {
-            GameObject g = Dlist.Pop();
+            GameObject g = Dlist.Pop();
-            Destroy(g);
+            Destroy(g);
-        }
+        }
-    }
+    }
-
+
-    public void RemoveAll(object o = null)
+    public void RemoveAll(object o = null)
-    {
+    {
-        while (Dlist.Count > 0)
+        while (Dlist.Count > 0)
-        {
+        {
-            Destroy(Dlist.Pop());
+            Destroy(Dlist.Pop());
-        }
+        }
-        Dlist.Clear();
+        Dlist.Clear();
-    }
+    }
-
+
-    private void Update()
+    private void Update()
-    {
+    {
-        if (Input.GetKeyUp(KeyCode.H))
+        if (Input.GetKeyUp(KeyCode.H))
-        {
+        {
-            RemoveLast();
+            RemoveLast();
-        }
+        }
-        else if (Input.GetKeyUp(KeyCode.J))
+        else if (Input.GetKeyUp(KeyCode.J))
-        {
+        {
-            RemoveAll();
+            RemoveAll();
-        }
+        }
-    }
+    }
-}
+}

+ 85 - 85
Assets/DrawingAir/Paint.cs

@@ -1,85 +1,85 @@
-using System.Collections;
+using System.Collections;
-using System.Collections.Generic;
+using System.Collections.Generic;
-using UnityEngine;
+using UnityEngine;
-
+
-public class Paint : MonoBehaviour
+public class Paint : MonoBehaviour
-{
+{
-    public GameObject trailPrefab;
+    public GameObject trailPrefab;
-    private TrailRenderer thisTrail;
+    private TrailRenderer thisTrail;
-    private Vector3 startPos;
+    private Vector3 startPos;
-    private Plane objPlane;
+    private Plane objPlane;
-    private Vector3 TeacherPos;
+    private Vector3 TeacherPos;
-    [SerializeField]
+    [SerializeField]
-    private bool isStart = false;
+    private bool isStart = false;
-    void Start()
+    void Start()
-    {
+    {
-        MessageCenterController.Instance.Register(GameEnum.MESSAGE_REFRESH_LINE_TARGET_POS_DATA, RefreshData);
+        MessageCenterController.Instance.Register(GameEnum.MESSAGE_REFRESH_LINE_TARGET_POS_DATA, RefreshData);
-        MessageCenterController.Instance.Register(GameEnum.MESSAGE_DRAW_START, DrawStart);
+        MessageCenterController.Instance.Register(GameEnum.MESSAGE_DRAW_START, DrawStart);
-        MessageCenterController.Instance.Register(GameEnum.MESSAGE_DRAW_END, DrawEnd);
+        MessageCenterController.Instance.Register(GameEnum.MESSAGE_DRAW_END, DrawEnd);
-        isStart = false;
+        isStart = false;
-    }
+    }
-
+
-    private void OnDestroy()
+    private void OnDestroy()
-    {
+    {
-        MessageCenterController.Instance.UnRegister(GameEnum.MESSAGE_REFRESH_LINE_TARGET_POS_DATA, RefreshData);
+        MessageCenterController.Instance.UnRegister(GameEnum.MESSAGE_REFRESH_LINE_TARGET_POS_DATA, RefreshData);
-        MessageCenterController.Instance.UnRegister(GameEnum.MESSAGE_DRAW_START, DrawStart);
+        MessageCenterController.Instance.UnRegister(GameEnum.MESSAGE_DRAW_START, DrawStart);
-        MessageCenterController.Instance.UnRegister(GameEnum.MESSAGE_DRAW_END, DrawEnd);
+        MessageCenterController.Instance.UnRegister(GameEnum.MESSAGE_DRAW_END, DrawEnd);
-    }
+    }
-
+
-    void DrawStart(System.Object o)
+    void DrawStart(System.Object o)
-    {
+    {
-        StartCoroutine(_DrawStart(o));
+        StartCoroutine(_DrawStart(o));
-    }
+    }
-
+
-    IEnumerator _DrawStart(System.Object o)
+    IEnumerator _DrawStart(System.Object o)
-    {
+    {
-        yield return new WaitForEndOfFrame();
+        yield return new WaitForEndOfFrame();
-        DrawData data = (DrawData)o;
+        DrawData data = (DrawData)o;
-        startPos = DrawingManager._instance.DrawPoint(); // 获取射线点
+        startPos = DrawingManager._instance.DrawPoint(); // 获取射线点
-        GameObject g = Instantiate(trailPrefab, startPos, Quaternion.identity);
+        GameObject g = Instantiate(trailPrefab, startPos, Quaternion.identity);
-        // 加入绘制Stack
+        // 加入绘制Stack
-        DrawListManager._instance.AddBrush(g);
+        DrawListManager._instance.AddBrush(g);
-        thisTrail = g.GetComponent<TrailRenderer>();
+        thisTrail = g.GetComponent<TrailRenderer>();
-        thisTrail.startColor = data.GetColor();
+        thisTrail.startColor = data.GetColor();
-        thisTrail.endColor = data.GetColor();
+        thisTrail.endColor = data.GetColor();
-        // thisTrail.widthMultiplier = data.size;
+        // thisTrail.widthMultiplier = data.size;
-        isStart = true;
+        isStart = true;
-    }
+    }
-
+
-    void DrawEnd(System.Object o)
+    void DrawEnd(System.Object o)
-    {
+    {
-        isStart = false;
+        isStart = false;
-    }
+    }
-
+
-
+
-    private void RefreshData(System.Object data)
+    private void RefreshData(System.Object data)
-    {
+    {
-        if (GamePlayerData.Instance.room_data.IsReconnectOwner())
+        if (GamePlayerData.Instance.room_data.IsReconnectOwner())
-        {
+        {
-            return;//如果是老师的话不执行
+            return;//如果是老师的话不执行
-        }
+        }
-        TeacherPos = (Vector3)data;
+        TeacherPos = (Vector3)data;
-    }
+    }
-
+
-    // Update is called once per frame
+    // Update is called once per frame
-    void Update()
+    void Update()
-    {
+    {
-        if (isStart)
+        if (isStart)
-        {
+        {
-            Vector3 v;
+            Vector3 v;
-            if (GamePlayerData.Instance.room_data.IsReconnectOwner())
+            if (GamePlayerData.Instance.room_data.IsReconnectOwner())
-            {
+            {
-                v = DrawingManager.Instance.DrawPoint();
+                v = DrawingManager.Instance.DrawPoint();
-            }
+            }
-            else
+            else
-            {
+            {
-                v = TeacherPos;
+                v = TeacherPos;
-            }
+            }
-            if (thisTrail)
+            if (thisTrail)
-            {
+            {
-                thisTrail.transform.position = v;
+                thisTrail.transform.position = v;
-            }
+            }
-            
+            
-        }
+        }
-    }
+    }
-}
+}

+ 152 - 152
Assets/DrawingAir/PaintBoard.cs

@@ -1,153 +1,153 @@
-using System.Linq;
+using System.Linq;
-using UnityEngine;
+using UnityEngine;
-
+
-/// <summary>
+/// <summary>
-/// 画板
+/// 画板
-/// </summary>
+/// </summary>
-public class PaintBoard : MonoBehaviour
+public class PaintBoard : MonoBehaviour
-{
+{
-    //当画笔移动速度很快时,为了不出现断断续续的点,所以需要对两个点之间进行插值,lerp就是插值系数
+    //当画笔移动速度很快时,为了不出现断断续续的点,所以需要对两个点之间进行插值,lerp就是插值系数
-    [Range(0, 1)]
+    [Range(0, 1)]
-    public float lerp = 0.05f;
+    public float lerp = 0.05f;
-    //初始化背景的图片
+    //初始化背景的图片
-    public Texture2D initailizeTexture;
+    public Texture2D initailizeTexture;
-    //当前背景的图片
+    //当前背景的图片
-    private Texture2D currentTexture;
+    private Texture2D currentTexture;
-    //画笔所在位置映射到画板图片的UV坐标
+    //画笔所在位置映射到画板图片的UV坐标
-    private Vector2 paintPos;
+    private Vector2 paintPos;
-
+
-    private bool isDrawing = false;//当前画笔是不是正在画板上
+    private bool isDrawing = false;//当前画笔是不是正在画板上
-    //离开时画笔所在的位置 
+    //离开时画笔所在的位置 
-    private int lastPaintX;
+    private int lastPaintX;
-    private int lastPaintY;
+    private int lastPaintY;
-    //画笔所代表的色块的大小
+    //画笔所代表的色块的大小
-    private int painterTipsWidth = 30;
+    private int painterTipsWidth = 30;
-    private int painterTipsHeight = 15;
+    private int painterTipsHeight = 15;
-    //当前画板的背景图片的尺寸
+    //当前画板的背景图片的尺寸
-    private int textureWidth;
+    private int textureWidth;
-    private int textureHeight;
+    private int textureHeight;
-
+
-    //画笔的颜色
+    //画笔的颜色
-    private Color32[] painterColor;
+    private Color32[] painterColor;
-
+
-    private Color32[] currentColor;
+    private Color32[] currentColor;
-    private Color32[] originColor;
+    private Color32[] originColor;
-
+
-
+
-    private void Start()
+    private void Start()
-    {
+    {
-        //获取原始图片的大小 
+        //获取原始图片的大小 
-        Texture2D originTexture = GetComponent<MeshRenderer>().material.mainTexture as Texture2D;
+        Texture2D originTexture = GetComponent<MeshRenderer>().material.mainTexture as Texture2D;
-        textureWidth = originTexture.width;//1920   
+        textureWidth = originTexture.width;//1920   
-        textureHeight = originTexture.height;//1080
+        textureHeight = originTexture.height;//1080
-
+
-        //设置当前图片
+        //设置当前图片
-        currentTexture = new Texture2D(textureWidth, textureHeight, TextureFormat.RGBA32, false, true);
+        currentTexture = new Texture2D(textureWidth, textureHeight, TextureFormat.RGBA32, false, true);
-        currentTexture.SetPixels32(originTexture.GetPixels32());
+        currentTexture.SetPixels32(originTexture.GetPixels32());
-        currentTexture.Apply();
+        currentTexture.Apply();
-
+
-        //赋值给黑板
+        //赋值给黑板
-        GetComponent<MeshRenderer>().material.mainTexture = currentTexture;
+        GetComponent<MeshRenderer>().material.mainTexture = currentTexture;
-
+
-        //初始化画笔的颜色
+        //初始化画笔的颜色
-        painterColor = Enumerable.Repeat<Color32>(new Color32(255, 0, 0, 255), painterTipsWidth * painterTipsHeight).ToArray<Color32>();
+        painterColor = Enumerable.Repeat<Color32>(new Color32(255, 0, 0, 255), painterTipsWidth * painterTipsHeight).ToArray<Color32>();
-    }
+    }
-
+
-    private void LateUpdate()
+    private void LateUpdate()
-    {
+    {
-        if (Input.GetKeyUp(KeyCode.Space))
+        if (Input.GetKeyUp(KeyCode.Space))
-        {
+        {
-            currentTexture.ClearRequestedMipmapLevel();
+            currentTexture.ClearRequestedMipmapLevel();
-            currentTexture.Apply();
+            currentTexture.Apply();
-        }
+        }
-        //计算当前画笔,所代表的色块的一个起始点
+        //计算当前画笔,所代表的色块的一个起始点
-        int texPosX = (int)(paintPos.x * (float)textureWidth - (float)(painterTipsWidth / 2));
+        int texPosX = (int)(paintPos.x * (float)textureWidth - (float)(painterTipsWidth / 2));
-        int texPosY = (int)(paintPos.y * (float)textureHeight - (float)(painterTipsHeight / 2));
+        int texPosY = (int)(paintPos.y * (float)textureHeight - (float)(painterTipsHeight / 2));
-        if (isDrawing)
+        if (isDrawing)
-        {
+        {
-            //改变画笔所在的块的像素值
+            //改变画笔所在的块的像素值
-            currentTexture.SetPixels32(texPosX, texPosY, painterTipsWidth, painterTipsHeight, painterColor);
+            currentTexture.SetPixels32(texPosX, texPosY, painterTipsWidth, painterTipsHeight, painterColor);
-            //如果快速移动画笔的话,会出现断续的现象,所以要插值
+            //如果快速移动画笔的话,会出现断续的现象,所以要插值
-            if (lastPaintX != 0 && lastPaintY != 0)
+            if (lastPaintX != 0 && lastPaintY != 0)
-            {
+            {
-                int lerpCount = (int)(1 / lerp);
+                int lerpCount = (int)(1 / lerp);
-                for (int i = 0; i <= lerpCount; i++)
+                for (int i = 0; i <= lerpCount; i++)
-                {
+                {
-                    int x = (int)Mathf.Lerp((float)lastPaintX, (float)texPosX, lerp);
+                    int x = (int)Mathf.Lerp((float)lastPaintX, (float)texPosX, lerp);
-                    int y = (int)Mathf.Lerp((float)lastPaintY, (float)texPosY, lerp);
+                    int y = (int)Mathf.Lerp((float)lastPaintY, (float)texPosY, lerp);
-                    currentTexture.SetPixels32(x, y, painterTipsWidth, painterTipsHeight, painterColor);
+                    currentTexture.SetPixels32(x, y, painterTipsWidth, painterTipsHeight, painterColor);
-                }
+                }
-            }
+            }
-            currentTexture.Apply();
+            currentTexture.Apply();
-            lastPaintX = texPosX;
+            lastPaintX = texPosX;
-            lastPaintY = texPosY;
+            lastPaintY = texPosY;
-        }
+        }
-        else
+        else
-        {
+        {
-            lastPaintX = lastPaintY = 0;
+            lastPaintX = lastPaintY = 0;
-        }
+        }
-
+
-    }
+    }
-
+
-    /// <summary>
+    /// <summary>
-    /// 设置当前画笔所在的UV位置
+    /// 设置当前画笔所在的UV位置
-    /// </summary>
+    /// </summary>
-    /// <param name="x"></param>
+    /// <param name="x"></param>
-    /// <param name="y"></param>
+    /// <param name="y"></param>
-    public void SetPainterPositon(float x, float y)
+    public void SetPainterPositon(float x, float y)
-    {
+    {
-        paintPos.Set(x, y);
+        paintPos.Set(x, y);
-    }
+    }
-
+
-    /// <summary>
+    /// <summary>
-    /// 画笔当前是不是在画画
+    /// 画笔当前是不是在画画
-    /// </summary>
+    /// </summary>
-    public bool IsDrawing
+    public bool IsDrawing
-    {
+    {
-        get
+        get
-        {
+        {
-            return isDrawing;
+            return isDrawing;
-        }
+        }
-        set
+        set
-        {
+        {
-            isDrawing = value;
+            isDrawing = value;
-        }
+        }
-    }
+    }
-
+
-    /// <summary>
+    /// <summary>
-    /// 使用当前正在画板上的画笔的颜色
+    /// 使用当前正在画板上的画笔的颜色
-    /// </summary>
+    /// </summary>
-    /// <param name="color"></param>
+    /// <param name="color"></param>
-    public void SetPainterColor(Color32 color)
+    public void SetPainterColor(Color32 color)
-    {
+    {
-        if (!painterColor[0].IsEqual(color))
+        if (!painterColor[0].IsEqual(color))
-        {
+        {
-            for (int i = 0; i < painterColor.Length; i++)
+            for (int i = 0; i < painterColor.Length; i++)
-            {
+            {
-                painterColor[i] = color;
+                painterColor[i] = color;
-            }
+            }
-        }
+        }
-    }
+    }
-
+
-
+
-}
+}
-public static class MethodExtention
+public static class MethodExtention
-{
+{
-    /// <summary>
+    /// <summary>
-    /// 用于比较两个Color32类型是不是同种颜色
+    /// 用于比较两个Color32类型是不是同种颜色
-    /// </summary>
+    /// </summary>
-    /// <param name="origin"></param>
+    /// <param name="origin"></param>
-    /// <param name="compare"></param>
+    /// <param name="compare"></param>
-    /// <returns></returns>
+    /// <returns></returns>
-    public static bool IsEqual(this Color32 origin, Color32 compare)
+    public static bool IsEqual(this Color32 origin, Color32 compare)
-    {
+    {
-        if (origin.g == compare.g && origin.r == compare.r)
+        if (origin.g == compare.g && origin.r == compare.r)
-        {
+        {
-            if (origin.a == compare.a && origin.b == compare.b)
+            if (origin.a == compare.a && origin.b == compare.b)
-            {
+            {
-                return true;
+                return true;
-            }
+            }
-        }
+        }
-        return false;
+        return false;
-    }
+    }
 }
 }

+ 57 - 57
Assets/DrawingAir/Painter.cs

@@ -1,58 +1,58 @@
-using UnityEngine;
+using UnityEngine;
-
+
-public class Painter : MonoBehaviour
+public class Painter : MonoBehaviour
-{
+{
-    /// <summary>
+    /// <summary>
-    /// 画笔的颜色
+    /// 画笔的颜色
-    /// </summary>
+    /// </summary>
-    public Color32 penColor;
+    public Color32 penColor;
-
+
-    public Transform rayOrigin;
+    public Transform rayOrigin;
-
+
-    private RaycastHit hitInfo;
+    private RaycastHit hitInfo;
-    //这个画笔是不是正在被手柄抓着
+    //这个画笔是不是正在被手柄抓着
-    private bool IsGrabbing;
+    private bool IsGrabbing;
-    private static PaintBoard board;//设置成类型的成员,而不是类型实例的成员,因为所有画笔都是用的同一个board
+    private static PaintBoard board;//设置成类型的成员,而不是类型实例的成员,因为所有画笔都是用的同一个board
-
+
-    private void Start()
+    private void Start()
-    {
+    {
-        //将画笔部件设置为画笔的颜色,用于识别这个画笔的颜色
+        //将画笔部件设置为画笔的颜色,用于识别这个画笔的颜色
-        foreach (var renderer in GetComponentsInChildren<MeshRenderer>())
+        foreach (var renderer in GetComponentsInChildren<MeshRenderer>())
-        {
+        {
-            if (renderer.transform == transform)
+            if (renderer.transform == transform)
-            {
+            {
-                continue;
+                continue;
-            }
+            }
-            renderer.material.color = penColor;
+            renderer.material.color = penColor;
-        }
+        }
-        if (!board)
+        if (!board)
-        {
+        {
-            board = FindObjectOfType<PaintBoard>();
+            board = FindObjectOfType<PaintBoard>();
-        }
+        }
-
+
-    }
+    }
-
+
-    private void Update()
+    private void Update()
-    {
+    {
-        Ray r = new Ray(rayOrigin.position, rayOrigin.forward);
+        Ray r = new Ray(rayOrigin.position, rayOrigin.forward);
-        Debug.DrawLine(rayOrigin.position, rayOrigin.position + rayOrigin.forward * 10, Color.red);
+        Debug.DrawLine(rayOrigin.position, rayOrigin.position + rayOrigin.forward * 10, Color.red);
-        if (Physics.Raycast(r, out hitInfo, 0.1f))
+        if (Physics.Raycast(r, out hitInfo, 0.1f))
-        {
+        {
-            if (hitInfo.collider.tag == "Board")
+            if (hitInfo.collider.tag == "Board")
-            {
+            {
-                //设置画笔所在位置对应画板图片的UV坐标 
+                //设置画笔所在位置对应画板图片的UV坐标 
-                board.SetPainterPositon(hitInfo.textureCoord.x, hitInfo.textureCoord.y);
+                board.SetPainterPositon(hitInfo.textureCoord.x, hitInfo.textureCoord.y);
-                //当前笔的颜色
+                //当前笔的颜色
-                board.SetPainterColor(penColor);
+                board.SetPainterColor(penColor);
-                board.IsDrawing = true;
+                board.IsDrawing = true;
-                IsGrabbing = true;
+                IsGrabbing = true;
-            }
+            }
-        }
+        }
-        else if (IsGrabbing)
+        else if (IsGrabbing)
-        {
+        {
-            board.IsDrawing = false;
+            board.IsDrawing = false;
-            IsGrabbing = false;
+            IsGrabbing = false;
-        }
+        }
-    }
+    }
-
+
 }
 }

+ 0 - 96
Assets/FT_MagicEffects_Vol01/Model/FTME01_sphere01.obj.meta

@@ -1,96 +0,0 @@
-fileFormatVersion: 2
-guid: bb89dc0e9a7608245b3f9873773454d7
-ModelImporter:
-  serializedVersion: 23
-  fileIDToRecycleName:
-    100000: //RootNode
-    100002: sphere
-    400000: //RootNode
-    400002: sphere
-    2300000: sphere
-    3300000: sphere
-    4300000: sphere
-    9500000: //RootNode
-  externalObjects: {}
-  materials:
-    importMaterials: 0
-    materialName: 0
-    materialSearch: 1
-    materialLocation: 0
-  animations:
-    legacyGenerateAnimations: 4
-    bakeSimulation: 0
-    resampleCurves: 1
-    optimizeGameObjects: 0
-    motionNodeName: 
-    rigImportErrors: 
-    rigImportWarnings: 
-    animationImportErrors: 
-    animationImportWarnings: 
-    animationRetargetingWarnings: 
-    animationDoRetargetingWarnings: 0
-    importAnimatedCustomProperties: 0
-    importConstraints: 0
-    animationCompression: 1
-    animationRotationError: 0.5
-    animationPositionError: 0.5
-    animationScaleError: 0.5
-    animationWrapMode: 0
-    extraExposedTransformPaths: []
-    extraUserProperties: []
-    clipAnimations: []
-    isReadable: 1
-  meshes:
-    lODScreenPercentages: []
-    globalScale: 0.1
-    meshCompression: 0
-    addColliders: 0
-    importVisibility: 0
-    importBlendShapes: 1
-    importCameras: 0
-    importLights: 0
-    swapUVChannels: 0
-    generateSecondaryUV: 0
-    useFileUnits: 1
-    optimizeMeshForGPU: 1
-    keepQuads: 0
-    weldVertices: 1
-    preserveHierarchy: 0
-    indexFormat: 1
-    secondaryUVAngleDistortion: 8
-    secondaryUVAreaDistortion: 15.000001
-    secondaryUVHardAngle: 88
-    secondaryUVPackMargin: 4
-    useFileScale: 0
-    previousCalculatedGlobalScale: 1
-    hasPreviousCalculatedGlobalScale: 0
-  tangentSpace:
-    normalSmoothAngle: 60
-    normalImportMode: 1
-    tangentImportMode: 4
-    normalCalculationMode: 0
-  importAnimation: 1
-  copyAvatar: 0
-  humanDescription:
-    serializedVersion: 2
-    human: []
-    skeleton: []
-    armTwist: 0.5
-    foreArmTwist: 0.5
-    upperLegTwist: 0.5
-    legTwist: 0.5
-    armStretch: 0.05
-    legStretch: 0.05
-    feetSpacing: 0
-    rootMotionBoneName: 
-    rootMotionBoneRotation: {x: 0, y: 0, z: 0, w: 1}
-    hasTranslationDoF: 0
-    hasExtraRoot: 0
-    skeletonHasParents: 0
-  lastHumanDescriptionAvatarSource: {instanceID: 0}
-  animationType: 2
-  humanoidOversampling: 1
-  additionalBone: 0
-  userData: 
-  assetBundleName: 
-  assetBundleVariant: 

+ 0 - 96
Assets/FT_MagicEffects_Vol01/Model/FTME01_sphere02.obj.meta

@@ -1,96 +0,0 @@
-fileFormatVersion: 2
-guid: e2e82d7d1923ffd40b8a4f64088bda23
-ModelImporter:
-  serializedVersion: 23
-  fileIDToRecycleName:
-    100000: FTME01_sphere02
-    100002: //RootNode
-    400000: FTME01_sphere02
-    400002: //RootNode
-    2300000: FTME01_sphere02
-    3300000: FTME01_sphere02
-    4300000: FTME01_sphere02
-    9500000: //RootNode
-  externalObjects: {}
-  materials:
-    importMaterials: 0
-    materialName: 0
-    materialSearch: 1
-    materialLocation: 0
-  animations:
-    legacyGenerateAnimations: 4
-    bakeSimulation: 0
-    resampleCurves: 1
-    optimizeGameObjects: 0
-    motionNodeName: 
-    rigImportErrors: 
-    rigImportWarnings: 
-    animationImportErrors: 
-    animationImportWarnings: 
-    animationRetargetingWarnings: 
-    animationDoRetargetingWarnings: 0
-    importAnimatedCustomProperties: 0
-    importConstraints: 0
-    animationCompression: 1
-    animationRotationError: 0.5
-    animationPositionError: 0.5
-    animationScaleError: 0.5
-    animationWrapMode: 0
-    extraExposedTransformPaths: []
-    extraUserProperties: []
-    clipAnimations: []
-    isReadable: 1
-  meshes:
-    lODScreenPercentages: []
-    globalScale: 0.1
-    meshCompression: 0
-    addColliders: 0
-    importVisibility: 0
-    importBlendShapes: 1
-    importCameras: 0
-    importLights: 0
-    swapUVChannels: 0
-    generateSecondaryUV: 0
-    useFileUnits: 1
-    optimizeMeshForGPU: 1
-    keepQuads: 0
-    weldVertices: 1
-    preserveHierarchy: 0
-    indexFormat: 1
-    secondaryUVAngleDistortion: 8
-    secondaryUVAreaDistortion: 15.000001
-    secondaryUVHardAngle: 88
-    secondaryUVPackMargin: 4
-    useFileScale: 0
-    previousCalculatedGlobalScale: 1
-    hasPreviousCalculatedGlobalScale: 0
-  tangentSpace:
-    normalSmoothAngle: 60
-    normalImportMode: 1
-    tangentImportMode: 4
-    normalCalculationMode: 0
-  importAnimation: 1
-  copyAvatar: 0
-  humanDescription:
-    serializedVersion: 2
-    human: []
-    skeleton: []
-    armTwist: 0.5
-    foreArmTwist: 0.5
-    upperLegTwist: 0.5
-    legTwist: 0.5
-    armStretch: 0.05
-    legStretch: 0.05
-    feetSpacing: 0
-    rootMotionBoneName: 
-    rootMotionBoneRotation: {x: 0, y: 0, z: 0, w: 1}
-    hasTranslationDoF: 0
-    hasExtraRoot: 0
-    skeletonHasParents: 0
-  lastHumanDescriptionAvatarSource: {instanceID: 0}
-  animationType: 2
-  humanoidOversampling: 1
-  additionalBone: 0
-  userData: 
-  assetBundleName: 
-  assetBundleVariant: 

+ 0 - 101
Assets/Hard Surface Pro/Shared/Props/Candles/CandleLow.OBJ.meta

@@ -1,101 +0,0 @@
-fileFormatVersion: 2
-guid: 3ed2510dfcef962419177676e2547772
-ModelImporter:
-  serializedVersion: 23
-  fileIDToRecycleName:
-    100000: CandleLow
-    100002: //RootNode
-    400000: CandleLow
-    400002: //RootNode
-    2300000: CandleLow
-    3300000: CandleLow
-    4300000: CandleLow
-    11100000: //RootNode
-  externalObjects:
-  - first:
-      type: UnityEngine:Material
-      assembly: UnityEngine.CoreModule
-      name: CandleLowMat
-    second: {fileID: 2100000, guid: 9c7fd8dbbdc7a3b4f877e059bd90c052, type: 2}
-  materials:
-    importMaterials: 1
-    materialName: 3
-    materialSearch: 1
-    materialLocation: 0
-  animations:
-    legacyGenerateAnimations: 4
-    bakeSimulation: 0
-    resampleCurves: 1
-    optimizeGameObjects: 0
-    motionNodeName: 
-    rigImportErrors: 
-    rigImportWarnings: 
-    animationImportErrors: 
-    animationImportWarnings: 
-    animationRetargetingWarnings: 
-    animationDoRetargetingWarnings: 0
-    importAnimatedCustomProperties: 0
-    importConstraints: 0
-    animationCompression: 1
-    animationRotationError: 0.5
-    animationPositionError: 0.5
-    animationScaleError: 0.5
-    animationWrapMode: 0
-    extraExposedTransformPaths: []
-    extraUserProperties: []
-    clipAnimations: []
-    isReadable: 1
-  meshes:
-    lODScreenPercentages: []
-    globalScale: 0.01
-    meshCompression: 0
-    addColliders: 0
-    importVisibility: 0
-    importBlendShapes: 1
-    importCameras: 0
-    importLights: 0
-    swapUVChannels: 0
-    generateSecondaryUV: 0
-    useFileUnits: 1
-    optimizeMeshForGPU: 1
-    keepQuads: 0
-    weldVertices: 1
-    preserveHierarchy: 0
-    indexFormat: 1
-    secondaryUVAngleDistortion: 8
-    secondaryUVAreaDistortion: 15.000001
-    secondaryUVHardAngle: 88
-    secondaryUVPackMargin: 4
-    useFileScale: 0
-    previousCalculatedGlobalScale: 1
-    hasPreviousCalculatedGlobalScale: 0
-  tangentSpace:
-    normalSmoothAngle: 180
-    normalImportMode: 1
-    tangentImportMode: 4
-    normalCalculationMode: 0
-  importAnimation: 1
-  copyAvatar: 0
-  humanDescription:
-    serializedVersion: 2
-    human: []
-    skeleton: []
-    armTwist: 0.5
-    foreArmTwist: 0.5
-    upperLegTwist: 0.5
-    legTwist: 0.5
-    armStretch: 0.05
-    legStretch: 0.05
-    feetSpacing: 0
-    rootMotionBoneName: 
-    rootMotionBoneRotation: {x: 0, y: 0, z: 0, w: 1}
-    hasTranslationDoF: 0
-    hasExtraRoot: 0
-    skeletonHasParents: 1
-  lastHumanDescriptionAvatarSource: {instanceID: 0}
-  animationType: 1
-  humanoidOversampling: 1
-  additionalBone: 0
-  userData: 
-  assetBundleName: 
-  assetBundleVariant: 

+ 36 - 36
Assets/MaterializeFX/MaterializationFX/Scripts/ShaderParameterSetter.cs

@@ -1,37 +1,37 @@
-using UnityEngine;
+using UnityEngine;
-
+
-namespace MaterializationFX.Scripts
+namespace MaterializationFX.Scripts
-{
+{
-    internal sealed class ShaderParameterSetter
+    internal sealed class ShaderParameterSetter
-    {
+    {
-        private Renderer[] _rends;
+        private Renderer[] _rends;
-
+
-        public void Init(GameObject targetObject, string shaderName, bool modifyChildren)
+        public void Init(GameObject targetObject, string shaderName, bool modifyChildren)
-        {
+        {
-            _rends = !modifyChildren
+            _rends = !modifyChildren
-                ? new[] {targetObject.GetComponent<Renderer>()}
+                ? new[] {targetObject.GetComponent<Renderer>()}
-                : targetObject.GetComponentsInChildren<Renderer>();
+                : targetObject.GetComponentsInChildren<Renderer>();
-
+
-            foreach (var rend in _rends)
+            foreach (var rend in _rends)
-                rend.material.shader = Shader.Find(shaderName);
+                rend.material.shader = Shader.Find(shaderName);
-        }
+        }
-
+
-        public void SetFloat(string propertyName, float value)
+        public void SetFloat(string propertyName, float value)
-        {
+        {
-            foreach (var rend in _rends)
+            foreach (var rend in _rends)
-                rend.material.SetFloat(propertyName, value);
+                rend.material.SetFloat(propertyName, value);
-        }
+        }
-
+
-        public void SetInt(string propertyName, int value)
+        public void SetInt(string propertyName, int value)
-        {
+        {
-            foreach (var rend in _rends)
+            foreach (var rend in _rends)
-                rend.material.SetInt(propertyName, value);
+                rend.material.SetInt(propertyName, value);
-        }
+        }
-        
+        
-        public void SetVector(string propertyName, Vector3 value)
+        public void SetVector(string propertyName, Vector3 value)
-        {
+        {
-            foreach (var rend in _rends)
+            foreach (var rend in _rends)
-                rend.material.SetVector(propertyName, value);
+                rend.material.SetVector(propertyName, value);
-        }
+        }
-    }
+    }
 }
 }

+ 40 - 40
Assets/MaterializeFX/MaterializationFX/Scripts/Utils/DemoPrefabController.cs

@@ -1,41 +1,41 @@
-using UnityEngine;
+using UnityEngine;
-
+
-namespace MaterializationFX.Scripts.Utils
+namespace MaterializationFX.Scripts.Utils
-{
+{
-    internal sealed class DemoPrefabController : MonoBehaviour
+    internal sealed class DemoPrefabController : MonoBehaviour
-    {
+    {
-        public int StartNum;
+        public int StartNum;
-        public GameObject[] Prefabs;
+        public GameObject[] Prefabs;
-
+
-        private GameObject _currentInstance;
+        private GameObject _currentInstance;
-        private int _currentPrefabNum;
+        private int _currentPrefabNum;
-
+
-        public void Next()
+        public void Next()
-        {
+        {
-            if (Prefabs.Length == 0)
+            if (Prefabs.Length == 0)
-                return;
+                return;
-
+
-            _currentPrefabNum++;
+            _currentPrefabNum++;
-            if (_currentPrefabNum >= Prefabs.Length)
+            if (_currentPrefabNum >= Prefabs.Length)
-                _currentPrefabNum = 0;
+                _currentPrefabNum = 0;
-
+
-            ChangePrefab(_currentPrefabNum);
+            ChangePrefab(_currentPrefabNum);
-        }
+        }
-
+
-        private void Start()
+        private void Start()
-        {
+        {
-            _currentPrefabNum = StartNum;
+            _currentPrefabNum = StartNum;
-
+
-            ChangePrefab(_currentPrefabNum);
+            ChangePrefab(_currentPrefabNum);
-        }
+        }
-
+
-        private void ChangePrefab(int num)
+        private void ChangePrefab(int num)
-        {
+        {
-            if (_currentInstance != null)
+            if (_currentInstance != null)
-                Destroy(_currentInstance);
+                Destroy(_currentInstance);
-            var newPrefab = Prefabs[num];
+            var newPrefab = Prefabs[num];
-            _currentInstance = Instantiate(newPrefab, newPrefab.transform.position, newPrefab.transform.transform.rotation);
+            _currentInstance = Instantiate(newPrefab, newPrefab.transform.position, newPrefab.transform.transform.rotation);
-            _currentInstance.SetActive(true);
+            _currentInstance.SetActive(true);
-        }
+        }
-    }
+    }
 }
 }

+ 58 - 58
Assets/MaterializeFX/MaterializationFX/Scripts/Utils/MouseOrbitController.cs

@@ -1,58 +1,58 @@
-using UnityEngine;
+using UnityEngine;
-
+
-namespace MaterializationFX.Scripts.Utils
+namespace MaterializationFX.Scripts.Utils
-{
+{
-	internal sealed class MouseOrbitController : MonoBehaviour
+	internal sealed class MouseOrbitController : MonoBehaviour
-	{
+	{
-		public Transform Target;
+		public Transform Target;
-		public float Distance = 5.0f;
+		public float Distance = 5.0f;
-		public float XSpeed = 120.0f;
+		public float XSpeed = 120.0f;
-		public float YSpeed = 120.0f;
+		public float YSpeed = 120.0f;
-
+
-		public float YMinLimit = 20f;
+		public float YMinLimit = 20f;
-		public float YMaxLimit = 80f;
+		public float YMaxLimit = 80f;
-
+
-		public float DistanceMin = .5f;
+		public float DistanceMin = .5f;
-		public float DistanceMax = 15f;
+		public float DistanceMax = 15f;
-
+
-		private float _x;
+		private float _x;
-		private float _y;
+		private float _y;
-
+
-		private void Start()
+		private void Start()
-		{
+		{
-			var angles = transform.eulerAngles;
+			var angles = transform.eulerAngles;
-			_x = angles.y;
+			_x = angles.y;
-			_y = angles.x;
+			_y = angles.x;
-		}
+		}
-
+
-		private void LateUpdate()
+		private void LateUpdate()
-		{
+		{
-			if (!Input.GetMouseButton(0))
+			if (!Input.GetMouseButton(0))
-				return;
+				return;
-
+
-			_x += Input.GetAxis("Mouse X") * XSpeed * Distance * 0.02f;
+			_x += Input.GetAxis("Mouse X") * XSpeed * Distance * 0.02f;
-			_y -= Input.GetAxis("Mouse Y") * YSpeed * 0.02f;
+			_y -= Input.GetAxis("Mouse Y") * YSpeed * 0.02f;
-
+
-			_y = ClampAngle(_y, YMinLimit, YMaxLimit);
+			_y = ClampAngle(_y, YMinLimit, YMaxLimit);
-
+
-			var rotation = Quaternion.Euler(_y, _x, 0);
+			var rotation = Quaternion.Euler(_y, _x, 0);
-
+
-			Distance -= Input.GetAxis("Mouse ScrollWheel") * 5;
+			Distance -= Input.GetAxis("Mouse ScrollWheel") * 5;
-
+
-			var negDistance = new Vector3(0.0f, 0.0f, -Distance);
+			var negDistance = new Vector3(0.0f, 0.0f, -Distance);
-			var position = rotation * negDistance + Target.position;
+			var position = rotation * negDistance + Target.position;
-
+
-			transform.rotation = rotation;
+			transform.rotation = rotation;
-			transform.position = position;
+			transform.position = position;
-		}
+		}
-
+
-		private static float ClampAngle(float angle, float min, float max)
+		private static float ClampAngle(float angle, float min, float max)
-		{
+		{
-			if (angle < -360F)
+			if (angle < -360F)
-				angle += 360F;
+				angle += 360F;
-			if (angle > 360F)
+			if (angle > 360F)
-				angle -= 360F;
+				angle -= 360F;
-			return Mathf.Clamp(angle, min, max);
+			return Mathf.Clamp(angle, min, max);
-		}
+		}
-	}
+	}
-}
+}

+ 30 - 30
Assets/MathClass/Scripts/Line.cs

@@ -1,30 +1,30 @@
-using System.Collections;
+using System.Collections;
-using System.Collections.Generic;
+using System.Collections.Generic;
-using UnityEngine;
+using UnityEngine;
-
+
-public class Line : MonoBehaviour {
+public class Line : MonoBehaviour {
-	private LineRenderer line;
+	private LineRenderer line;
-	public GameObject pos1;
+	public GameObject pos1;
-	public GameObject pos2;
+	public GameObject pos2;
-
+
-	// Use this for initialization
+	// Use this for initialization
-	void Start () {
+	void Start () {
-		line = this.gameObject.AddComponent<LineRenderer>();
+		line = this.gameObject.AddComponent<LineRenderer>();
-		
+		
-		line.material = new Material(Shader.Find("Standard"));
+		line.material = new Material(Shader.Find("Standard"));
-		line.SetVertexCount(2);
+		line.SetVertexCount(2);
-		line.SetColors(Color.yellow, Color.yellow); 
+		line.SetColors(Color.yellow, Color.yellow); 
-		line.SetWidth(0.01f, 0.01f);
+		line.SetWidth(0.01f, 0.01f);
-
+
-		
+		
-
+
-	}
+	}
-	
+	
-	// Update is called once per frame
+	// Update is called once per frame
-	void Update () {
+	void Update () {
-	
+	
-		line.SetPosition(0, pos1.transform.position);
+		line.SetPosition(0, pos1.transform.position);
-		line.SetPosition(1, pos2.transform.position);
+		line.SetPosition(1, pos2.transform.position);
-
+
-	}
+	}
-}
+}

+ 52 - 52
Assets/MathClass/Scripts/MethodExtensionForUnity.cs

@@ -1,52 +1,52 @@
-using UnityEngine;
+using UnityEngine;
-
+
-//Unity的一些扩展方法
+//Unity的一些扩展方法
-static public class MethodExtensionForUnity
+static public class MethodExtensionForUnity
-{
+{
-	/// <summary>
+	/// <summary>
-	/// Gets or add a component. Usage example:
+	/// Gets or add a component. Usage example:
-	/// BoxCollider boxCollider = transform.GetOrAddComponent<BoxCollider>();
+	/// BoxCollider boxCollider = transform.GetOrAddComponent<BoxCollider>();
-	/// </summary>
+	/// </summary>
-	static public T GetOrAddComponent<T>(this Component child, bool set_enable = false) where T : Component
+	static public T GetOrAddComponent<T>(this Component child, bool set_enable = false) where T : Component
-	{
+	{
-		T result = child.GetComponent<T>();
+		T result = child.GetComponent<T>();
-		if (result == null)
+		if (result == null)
-		{
+		{
-			result = child.gameObject.AddComponent<T>();
+			result = child.gameObject.AddComponent<T>();
-		}
+		}
-		var bcomp = result as Behaviour;
+		var bcomp = result as Behaviour;
-		if (set_enable)
+		if (set_enable)
-		{
+		{
-			if (bcomp != null) bcomp.enabled = true;
+			if (bcomp != null) bcomp.enabled = true;
-		}
+		}
-		return result;
+		return result;
-	}
+	}
-
+
-	static public T GetOrAddComponent<T>(this GameObject go) where T : Component
+	static public T GetOrAddComponent<T>(this GameObject go) where T : Component
-	{
+	{
-		T result = go.transform.GetComponent<T>();
+		T result = go.transform.GetComponent<T>();
-		if (result == null)
+		if (result == null)
-		{
+		{
-			result = go.AddComponent<T>();
+			result = go.AddComponent<T>();
-		}
+		}
-		var bcomp = result as Behaviour;
+		var bcomp = result as Behaviour;
-		if (bcomp != null) bcomp.enabled = true;
+		if (bcomp != null) bcomp.enabled = true;
-		return result;
+		return result;
-	}
+	}
-
+
-
+
-	public static void walk(this GameObject o, System.Action<GameObject> f)
+	public static void walk(this GameObject o, System.Action<GameObject> f)
-	{
+	{
-		f(o);
+		f(o);
-
+
-		int numChildren = o.transform.childCount;
+		int numChildren = o.transform.childCount;
-
+
-		for (int i = 0; i < numChildren; ++i)
+		for (int i = 0; i < numChildren; ++i)
-		{
+		{
-			walk(o.transform.GetChild(i).gameObject, f);
+			walk(o.transform.GetChild(i).gameObject, f);
-		}
+		}
-	}
+	}
-
+
-
+
-}
+}
-
+

+ 59 - 59
Assets/MathClass/Scripts/Play.cs

@@ -1,59 +1,59 @@
-using System.Collections;
+using System.Collections;
-using System.Collections.Generic;
+using System.Collections.Generic;
-using UnityEngine;
+using UnityEngine;
-
+
-public class Play : MonoBehaviour {
+public class Play : MonoBehaviour {
-	//int countIndex=1;
+	//int countIndex=1;
-	public GameObject butPlay;
+	public GameObject butPlay;
-	Animator ani;
+	Animator ani;
-	AudioSource aud;
+	AudioSource aud;
-	public string playani;
+	public string playani;
-
+
-	// Use this for initialization
+	// Use this for initialization
-	void Start () {
+	void Start () {
-		ani = butPlay.GetComponent<Animator> ();
+		ani = butPlay.GetComponent<Animator> ();
-		ani.speed = 0;
+		ani.speed = 0;
-		aud = butPlay.GetComponent<AudioSource> ();
+		aud = butPlay.GetComponent<AudioSource> ();
-	}
+	}
-	
+	
-	// Update is called once per frame
+	// Update is called once per frame
-	void Update () {
+	void Update () {
-		if (Input.GetKeyDown(KeyCode.F)) {
+		if (Input.GetKeyDown(KeyCode.F)) {
-			
+			
-			if(PauseSign.sign==false)
+			if(PauseSign.sign==false)
-			{
+			{
-				ani.speed = 1;
+				ani.speed = 1;
-				ani.Play (playani, 0, 0f);
+				ani.Play (playani, 0, 0f);
-
+
-			}
+			}
-			if (PauseSign.sign == true) 
+			if (PauseSign.sign == true) 
-			{
+			{
-				ani.speed = 1;
+				ani.speed = 1;
-				PauseSign.sign = false;
+				PauseSign.sign = false;
-			
+			
-			}
+			}
-		}
+		}
-
+
-	}
+	}
-	public void onClick(){
+	public void onClick(){
-		//countIndex *= -1;
+		//countIndex *= -1;
-		//if(countIndex>0){
+		//if(countIndex>0){
-		//	ani.speed = 1;
+		//	ani.speed = 1;
-		//}
+		//}
-		//if(countIndex<0){
+		//if(countIndex<0){
-		//	ani.speed = 0;
+		//	ani.speed = 0;
-		//}
+		//}
-		if(PauseSign.sign==false)
+		if(PauseSign.sign==false)
-		{
+		{
-			ani.speed = 1;
+			ani.speed = 1;
-			ani.Play (playani, 0, 0f);
+			ani.Play (playani, 0, 0f);
-			aud.Play ();
+			aud.Play ();
-		}
+		}
-		if (PauseSign.sign == true) 
+		if (PauseSign.sign == true) 
-		{
+		{
-			ani.speed = 1;
+			ani.speed = 1;
-			PauseSign.sign = false;
+			PauseSign.sign = false;
-			aud.Pause ();
+			aud.Pause ();
-		}
+		}
-	}
+	}
-}
+}

+ 54 - 54
Assets/MathClass/Scripts/PolygonDrawer.cs

@@ -1,55 +1,55 @@
-using UnityEngine;
+using UnityEngine;
-
+
-/// <summary>
+/// <summary>
-/// 绘制多边形
+/// 绘制多边形
-/// TODO: 存在两点重合时绘制有问题
+/// TODO: 存在两点重合时绘制有问题
-/// </summary>
+/// </summary>
-public class PolygonDrawer : MonoBehaviour
+public class PolygonDrawer : MonoBehaviour
-{
+{
-	public Material material;
+	public Material material;
-	public Transform[] vertices;
+	public Transform[] vertices;
-	private MeshRenderer mRenderer;
+	private MeshRenderer mRenderer;
-	private MeshFilter mFilter;
+	private MeshFilter mFilter;
-
+
-	void Start()
+	void Start()
-	{
+	{
-		Draw();
+		Draw();
-	}
+	}
-
+
-	void Update()
+	void Update()
-	{
+	{
-		Draw();
+		Draw();
-	}
+	}
-
+
-	[ContextMenu("Draw")]
+	[ContextMenu("Draw")]
-	public void Draw()
+	public void Draw()
-	{
+	{
-		Vector2[] vertices2D = new Vector2[vertices.Length];
+		Vector2[] vertices2D = new Vector2[vertices.Length];
-		Vector3[] vertices3D = new Vector3[vertices.Length];
+		Vector3[] vertices3D = new Vector3[vertices.Length];
-		for (int i = 0; i < vertices.Length; i++)
+		for (int i = 0; i < vertices.Length; i++)
-		{
+		{
-			Vector3 vertice = vertices[i].localPosition;
+			Vector3 vertice = vertices[i].localPosition;
-			vertices2D[i] = new Vector2(vertice.x, vertice.y);
+			vertices2D[i] = new Vector2(vertice.x, vertice.y);
-			vertices3D[i] = vertice;
+			vertices3D[i] = vertice;
-		}
+		}
-
+
-		Triangulator tr = new Triangulator(vertices2D);
+		Triangulator tr = new Triangulator(vertices2D);
-		int[] triangles = tr.Triangulate();
+		int[] triangles = tr.Triangulate();
-
+
-		Mesh mesh = new Mesh();
+		Mesh mesh = new Mesh();
-		mesh.vertices = vertices3D;
+		mesh.vertices = vertices3D;
-		mesh.triangles = triangles;
+		mesh.triangles = triangles;
-
+
-		if (mRenderer == null)
+		if (mRenderer == null)
-		{
+		{
-			mRenderer = gameObject.GetOrAddComponent<MeshRenderer>();
+			mRenderer = gameObject.GetOrAddComponent<MeshRenderer>();
-		}
+		}
-		mRenderer.material = material;
+		mRenderer.material = material;
-		if (mFilter == null)
+		if (mFilter == null)
-		{
+		{
-			mFilter = gameObject.GetOrAddComponent<MeshFilter>();
+			mFilter = gameObject.GetOrAddComponent<MeshFilter>();
-		}
+		}
-		mFilter.mesh = mesh;
+		mFilter.mesh = mesh;
-		
+		
-	}
+	}
 }
 }

+ 120 - 120
Assets/MathClass/Scripts/Triangulator.cs

@@ -1,121 +1,121 @@
-using UnityEngine;
+using UnityEngine;
-using System.Collections.Generic;
+using System.Collections.Generic;
-
+
-public class Triangulator
+public class Triangulator
-{
+{
-	private List<Vector2> m_points = new List<Vector2>();
+	private List<Vector2> m_points = new List<Vector2>();
-
+
-	public Triangulator(Vector2[] points)
+	public Triangulator(Vector2[] points)
-	{
+	{
-		m_points = new List<Vector2>(points);
+		m_points = new List<Vector2>(points);
-	}
+	}
-
+
-	public int[] Triangulate()
+	public int[] Triangulate()
-	{
+	{
-		List<int> indices = new List<int>();
+		List<int> indices = new List<int>();
-
+
-		int n = m_points.Count;
+		int n = m_points.Count;
-		if (n < 3)
+		if (n < 3)
-			return indices.ToArray();
+			return indices.ToArray();
-
+
-		int[] V = new int[n];
+		int[] V = new int[n];
-		if (Area() > 0)
+		if (Area() > 0)
-		{
+		{
-			for (int v = 0; v < n; v++)
+			for (int v = 0; v < n; v++)
-				V[v] = v;
+				V[v] = v;
-		}
+		}
-		else
+		else
-		{
+		{
-			for (int v = 0; v < n; v++)
+			for (int v = 0; v < n; v++)
-				V[v] = (n - 1) - v;
+				V[v] = (n - 1) - v;
-		}
+		}
-
+
-		int nv = n;
+		int nv = n;
-		int count = 2 * nv;
+		int count = 2 * nv;
-		for (int m = 0, v = nv - 1; nv > 2;)
+		for (int m = 0, v = nv - 1; nv > 2;)
-		{
+		{
-			if ((count--) <= 0)
+			if ((count--) <= 0)
-				return indices.ToArray();
+				return indices.ToArray();
-
+
-			int u = v;
+			int u = v;
-			if (nv <= u)
+			if (nv <= u)
-				u = 0;
+				u = 0;
-			v = u + 1;
+			v = u + 1;
-			if (nv <= v)
+			if (nv <= v)
-				v = 0;
+				v = 0;
-			int w = v + 1;
+			int w = v + 1;
-			if (nv <= w)
+			if (nv <= w)
-				w = 0;
+				w = 0;
-
+
-			if (Snip(u, v, w, nv, V))
+			if (Snip(u, v, w, nv, V))
-			{
+			{
-				int a, b, c, s, t;
+				int a, b, c, s, t;
-				a = V[u];
+				a = V[u];
-				b = V[v];
+				b = V[v];
-				c = V[w];
+				c = V[w];
-				indices.Add(a);
+				indices.Add(a);
-				indices.Add(b);
+				indices.Add(b);
-				indices.Add(c);
+				indices.Add(c);
-				m++;
+				m++;
-				for (s = v, t = v + 1; t < nv; s++, t++)
+				for (s = v, t = v + 1; t < nv; s++, t++)
-					V[s] = V[t];
+					V[s] = V[t];
-				nv--;
+				nv--;
-				count = 2 * nv;
+				count = 2 * nv;
-			}
+			}
-		}
+		}
-
+
-		indices.Reverse();
+		indices.Reverse();
-		return indices.ToArray();
+		return indices.ToArray();
-	}
+	}
-
+
-	private float Area()
+	private float Area()
-	{
+	{
-		int n = m_points.Count;
+		int n = m_points.Count;
-		float A = 0.0f;
+		float A = 0.0f;
-		for (int p = n - 1, q = 0; q < n; p = q++)
+		for (int p = n - 1, q = 0; q < n; p = q++)
-		{
+		{
-			Vector2 pval = m_points[p];
+			Vector2 pval = m_points[p];
-			Vector2 qval = m_points[q];
+			Vector2 qval = m_points[q];
-			A += pval.x * qval.y - qval.x * pval.y;
+			A += pval.x * qval.y - qval.x * pval.y;
-		}
+		}
-		return (A * 0.5f);
+		return (A * 0.5f);
-	}
+	}
-
+
-	private bool Snip(int u, int v, int w, int n, int[] V)
+	private bool Snip(int u, int v, int w, int n, int[] V)
-	{
+	{
-		int p;
+		int p;
-		Vector2 A = m_points[V[u]];
+		Vector2 A = m_points[V[u]];
-		Vector2 B = m_points[V[v]];
+		Vector2 B = m_points[V[v]];
-		Vector2 C = m_points[V[w]];
+		Vector2 C = m_points[V[w]];
-		if (Mathf.Epsilon > (((B.x - A.x) * (C.y - A.y)) - ((B.y - A.y) * (C.x - A.x))))
+		if (Mathf.Epsilon > (((B.x - A.x) * (C.y - A.y)) - ((B.y - A.y) * (C.x - A.x))))
-			return false;
+			return false;
-		for (p = 0; p < n; p++)
+		for (p = 0; p < n; p++)
-		{
+		{
-			if ((p == u) || (p == v) || (p == w))
+			if ((p == u) || (p == v) || (p == w))
-				continue;
+				continue;
-			Vector2 P = m_points[V[p]];
+			Vector2 P = m_points[V[p]];
-			if (InsideTriangle(A, B, C, P))
+			if (InsideTriangle(A, B, C, P))
-				return false;
+				return false;
-		}
+		}
-		return true;
+		return true;
-	}
+	}
-
+
-	private bool InsideTriangle(Vector2 A, Vector2 B, Vector2 C, Vector2 P)
+	private bool InsideTriangle(Vector2 A, Vector2 B, Vector2 C, Vector2 P)
-	{
+	{
-		float ax, ay, bx, by, cx, cy, apx, apy, bpx, bpy, cpx, cpy;
+		float ax, ay, bx, by, cx, cy, apx, apy, bpx, bpy, cpx, cpy;
-		float cCROSSap, bCROSScp, aCROSSbp;
+		float cCROSSap, bCROSScp, aCROSSbp;
-
+
-		ax = C.x - B.x; ay = C.y - B.y;
+		ax = C.x - B.x; ay = C.y - B.y;
-		bx = A.x - C.x; by = A.y - C.y;
+		bx = A.x - C.x; by = A.y - C.y;
-		cx = B.x - A.x; cy = B.y - A.y;
+		cx = B.x - A.x; cy = B.y - A.y;
-		apx = P.x - A.x; apy = P.y - A.y;
+		apx = P.x - A.x; apy = P.y - A.y;
-		bpx = P.x - B.x; bpy = P.y - B.y;
+		bpx = P.x - B.x; bpy = P.y - B.y;
-		cpx = P.x - C.x; cpy = P.y - C.y;
+		cpx = P.x - C.x; cpy = P.y - C.y;
-
+
-		aCROSSbp = ax * bpy - ay * bpx;
+		aCROSSbp = ax * bpy - ay * bpx;
-		cCROSSap = cx * apy - cy * apx;
+		cCROSSap = cx * apy - cy * apx;
-		bCROSScp = bx * cpy - by * cpx;
+		bCROSScp = bx * cpy - by * cpx;
-
+
-		return ((aCROSSbp >= 0.0f) && (bCROSScp >= 0.0f) && (cCROSSap >= 0.0f));
+		return ((aCROSSbp >= 0.0f) && (bCROSScp >= 0.0f) && (cCROSSap >= 0.0f));
-	}
+	}
 }
 }

+ 9 - 9
Assets/MathClass/Scripts/test.cs

@@ -1,10 +1,10 @@
-using System.Collections;
+using System.Collections;
-using System.Collections.Generic;
+using System.Collections.Generic;
-using UnityEngine;
+using UnityEngine;
-
+
-public class test {
+public class test {
-	private List<Vector2> m_vector2s = new List<Vector2>();
+	private List<Vector2> m_vector2s = new List<Vector2>();
-	public test(Vector2[] vector2s) {
+	public test(Vector2[] vector2s) {
-		m_vector2s = new List<Vector2>(vector2s);
+		m_vector2s = new List<Vector2>(vector2s);
- }
+ }
 }
 }

+ 100 - 100
Assets/Mirza Beig/Demos/The Last Particle/Scripts/AudioPitchAndVolumeByVelocity.cs

@@ -1,100 +1,100 @@
-
+
-// =================================	
+// =================================	
-// Namespaces.
+// Namespaces.
-// =================================
+// =================================
-
+
-using UnityEngine;
+using UnityEngine;
-
+
-// =================================	
+// =================================	
-// Define namespace.
+// Define namespace.
-// =================================
+// =================================
-
+
-namespace MirzaBeig
+namespace MirzaBeig
-{
+{
-
+
-    namespace Demos
+    namespace Demos
-    {
+    {
-
+
-        namespace TheLastParticle
+        namespace TheLastParticle
-        {
+        {
-
+
-            // =================================	
+            // =================================	
-            // Classes.
+            // Classes.
-            // =================================
+            // =================================
-
+
-            //[ExecuteInEditMode]
+            //[ExecuteInEditMode]
-            [System.Serializable]
+            [System.Serializable]
-
+
-            public class AudioPitchAndVolumeByVelocity : MonoBehaviour
+            public class AudioPitchAndVolumeByVelocity : MonoBehaviour
-            {
+            {
-                // =================================	
+                // =================================	
-                // Nested classes and structures.
+                // Nested classes and structures.
-                // =================================
+                // =================================
-
+
-                // ...
+                // ...
-
+
-                // =================================	
+                // =================================	
-                // Variables.
+                // Variables.
-                // =================================
+                // =================================
-
+
-                // ...
+                // ...
-
+
-                public float maxSpeed = 20.0f;
+                public float maxSpeed = 20.0f;
-
+
-                public Vector2 volumeRange = new Vector2(0.5f, 1.0f);
+                public Vector2 volumeRange = new Vector2(0.5f, 1.0f);
-                public Vector2 pitchRange = new Vector2(0.5f, 2.0f);
+                public Vector2 pitchRange = new Vector2(0.5f, 2.0f);
-
+
-                Rigidbody rb;
+                Rigidbody rb;
-                AudioSource audioSource;
+                AudioSource audioSource;
-
+
-                // =================================	
+                // =================================	
-                // Functions.
+                // Functions.
-                // =================================
+                // =================================
-
+
-                // ...
+                // ...
-
+
-                void Awake()
+                void Awake()
-                {
+                {
-
+
-                }
+                }
-
+
-                // ...
+                // ...
-
+
-                void Start()
+                void Start()
-                {
+                {
-                    rb = GetComponentInParent<Rigidbody>();
+                    rb = GetComponentInParent<Rigidbody>();
-                    audioSource = GetComponent<AudioSource>();
+                    audioSource = GetComponent<AudioSource>();
-                }
+                }
-
+
-                // ...
+                // ...
-
+
-                void LateUpdate()
+                void LateUpdate()
-                {
+                {
-                    float speed = rb.velocity.magnitude;
+                    float speed = rb.velocity.magnitude;
-                    float lerpTimePosition = speed / maxSpeed;
+                    float lerpTimePosition = speed / maxSpeed;
-
+
-                    lerpTimePosition = Mathf.Clamp01(lerpTimePosition);
+                    lerpTimePosition = Mathf.Clamp01(lerpTimePosition);
-
+
-                    audioSource.volume = Mathf.Lerp(volumeRange.x, volumeRange.y, lerpTimePosition);
+                    audioSource.volume = Mathf.Lerp(volumeRange.x, volumeRange.y, lerpTimePosition);
-                    audioSource.pitch = Mathf.Lerp(pitchRange.x, pitchRange.y, lerpTimePosition);
+                    audioSource.pitch = Mathf.Lerp(pitchRange.x, pitchRange.y, lerpTimePosition);
-                }
+                }
-
+
-                // =================================	
+                // =================================	
-                // End functions.
+                // End functions.
-                // =================================
+                // =================================
-
+
-            }
+            }
-
+
-            // =================================	
+            // =================================	
-            // End namespace.
+            // End namespace.
-            // =================================
+            // =================================
-
+
-        }
+        }
-
+
-    }
+    }
-
+
-}
+}
-
+
-// =================================	
+// =================================	
-// --END-- //
+// --END-- //
-// =================================
+// =================================

+ 369 - 369
Assets/Mirza Beig/Demos/The Last Particle/Scripts/CameraController.cs

@@ -1,369 +1,369 @@
-
+
-// =================================	
+// =================================	
-// Namespaces.
+// Namespaces.
-// =================================
+// =================================
-
+
-using UnityEngine;
+using UnityEngine;
-
+
-// =================================	
+// =================================	
-// Define namespace.
+// Define namespace.
-// =================================
+// =================================
-
+
-namespace MirzaBeig
+namespace MirzaBeig
-{
+{
-
+
-    namespace Demos
+    namespace Demos
-    {
+    {
-
+
-        namespace TheLastParticle
+        namespace TheLastParticle
-        {
+        {
-
+
-            // =================================	
+            // =================================	
-            // Classes.
+            // Classes.
-            // =================================
+            // =================================
-
+
-            //[ExecuteInEditMode]
+            //[ExecuteInEditMode]
-            [System.Serializable]
+            [System.Serializable]
-
+
-            public class CameraController : MonoBehaviour
+            public class CameraController : MonoBehaviour
-            {
+            {
-                // =================================	
+                // =================================	
-                // Nested classes and structures.
+                // Nested classes and structures.
-                // =================================
+                // =================================
-
+
-                // ...
+                // ...
-
+
-                public struct ClipPlanePoints
+                public struct ClipPlanePoints
-                {
+                {
-                    public Vector3 UpperLeft;
+                    public Vector3 UpperLeft;
-                    public Vector3 UpperRight;
+                    public Vector3 UpperRight;
-                    public Vector3 LowerLeft;
+                    public Vector3 LowerLeft;
-                    public Vector3 LowerRight;
+                    public Vector3 LowerRight;
-                }
+                }
-
+
-                // =================================	
+                // =================================	
-                // Variables.
+                // Variables.
-                // =================================
+                // =================================
-
+
-                // ...
+                // ...
-
+
-                new Camera camera;
+                new Camera camera;
-
+
-                // Transforms.
+                // Transforms.
-
+
-                [Header("Transforms")]
+                [Header("Transforms")]
-
+
-                public Transform target;
+                public Transform target;
-                public Transform offset;
+                public Transform offset;
-
+
-                // Position.
+                // Position.
-
+
-                [Header("Position")]
+                [Header("Position")]
-
+
-                public float followTargetSpeed = 8.0f;
+                public float followTargetSpeed = 8.0f;
-
+
-                // Rotation.
+                // Rotation.
-
+
-                [Header("Rotation")]
+                [Header("Rotation")]
-
+
-                Vector2 mouseInput;
+                Vector2 mouseInput;
-
+
-                public float mouseRotateAmount = 5.0f;
+                public float mouseRotateAmount = 5.0f;
-                public float mouseRotateSpeed = 5.0f;
+                public float mouseRotateSpeed = 5.0f;
-
+
-                public float rotateZSpeed = 1.0f;
+                public float rotateZSpeed = 1.0f;
-                public float resetZRotationSpeed = 5.0f;
+                public float resetZRotationSpeed = 5.0f;
-
+
-                public Vector2 lookUpDownRange = new Vector2(-80.0f, 80.0f);
+                public Vector2 lookUpDownRange = new Vector2(-80.0f, 80.0f);
-
+
-                // Zoom.
+                // Zoom.
-
+
-                [Header("Zoom")]
+                [Header("Zoom")]
-
+
-                public float zoomDistance = 4.0f;
+                public float zoomDistance = 4.0f;
-
+
-                public float mouseZoomAmount = 1.0f;
+                public float mouseZoomAmount = 1.0f;
-                public float mouseZoomSpeed = 5.0f;
+                public float mouseZoomSpeed = 5.0f;
-
+
-                public float mouseZoomMin = 1.0f;
+                public float mouseZoomMin = 1.0f;
-                public float mouseZoomMax = 5.0f;
+                public float mouseZoomMax = 5.0f;
-
+
-                // ...
+                // ...
-
+
-                [Header("Occlusion Zoom")]
+                [Header("Occlusion Zoom")]
-
+
-                public float occlusionZoomSpeed = 8.0f;
+                public float occlusionZoomSpeed = 8.0f;
-                public float occlusionZoomOffset = 0.0f;
+                public float occlusionZoomOffset = 0.0f;
-
+
-                public float occlusionRaycastDownDistance = 0.5f;
+                public float occlusionRaycastDownDistance = 0.5f;
-
+
-                public AnimationCurve occlisionRaycastDownCurve =
+                public AnimationCurve occlisionRaycastDownCurve =
-                    new AnimationCurve(new Keyframe(0.0f, 1.0f), new Keyframe(1.0f, 0.0f));
+                    new AnimationCurve(new Keyframe(0.0f, 1.0f), new Keyframe(1.0f, 0.0f));
-
+
-                // Offset framing.
+                // Offset framing.
-
+
-                [Header("Offset (Framing)")]
+                [Header("Offset (Framing)")]
-
+
-                public float offsetFramingAmount = 2.0f;
+                public float offsetFramingAmount = 2.0f;
-                public float offsetFramingSpeed = 1.0f;
+                public float offsetFramingSpeed = 1.0f;
-
+
-                public float minPlayerSpeedForOffsetFraming = 1.0f;
+                public float minPlayerSpeedForOffsetFraming = 1.0f;
-                public float minMouseMoveForOffsetFraming = 1.0f;
+                public float minMouseMoveForOffsetFraming = 1.0f;
-
+
-                Vector3 offsetStartPosition;
+                Vector3 offsetStartPosition;
-
+
-                Vector3 offsetPositionTarget;
+                Vector3 offsetPositionTarget;
-                Vector3 offsetMouseFramePosition;
+                Vector3 offsetMouseFramePosition;
-
+
-                // Stored locally as euler because Quaternions take shortest
+                // Stored locally as euler because Quaternions take shortest
-                // path around for rotation. By using euler, I don't run into 
+                // path around for rotation. By using euler, I don't run into 
-                // the problem of spinning the camera too quickly and causing 
+                // the problem of spinning the camera too quickly and causing 
-                // a sudden snap because the rotation exceeded 180 degrees.
+                // a sudden snap because the rotation exceeded 180 degrees.
-
+
-                Vector3 rotationEuler;
+                Vector3 rotationEuler;
-                Vector3 targetRotationEuler;
+                Vector3 targetRotationEuler;
-
+
-                // Player.
+                // Player.
-
+
-                Player player;
+                Player player;
-
+
-                // =================================	
+                // =================================	
-                // Functions.
+                // Functions.
-                // =================================
+                // =================================
-
+
-                // ...
+                // ...
-
+
-                void Awake()
+                void Awake()
-                {
+                {
-
+
-                }
+                }
-
+
-                // ...
+                // ...
-
+
-                void Start()
+                void Start()
-                {
+                {
-                    lockMouse();
+                    lockMouse();
-
+
-                    camera = Camera.main;
+                    camera = Camera.main;
-                    player = FindObjectOfType<Player>();
+                    player = FindObjectOfType<Player>();
-
+
-                    zoomDistance = Vector3.Distance(camera.transform.position, target.position);
+                    zoomDistance = Vector3.Distance(camera.transform.position, target.position);
-
+
-                    offsetStartPosition = offset.localPosition;
+                    offsetStartPosition = offset.localPosition;
-                    offsetPositionTarget = offsetStartPosition;
+                    offsetPositionTarget = offsetStartPosition;
-                }
+                }
-
+
-                // ...
+                // ...
-
+
-                void lockMouse()
+                void lockMouse()
-                {
+                {
-                    Cursor.visible = false;
+                    Cursor.visible = false;
-                    Cursor.lockState = CursorLockMode.Locked;
+                    Cursor.lockState = CursorLockMode.Locked;
-                }
+                }
-                void unlockMouse()
+                void unlockMouse()
-                {
+                {
-                    Cursor.visible = true;
+                    Cursor.visible = true;
-                    Cursor.lockState = CursorLockMode.None;
+                    Cursor.lockState = CursorLockMode.None;
-                }
+                }
-
+
-                // ...
+                // ...
-
+
-                void FixedUpdate()
+                void FixedUpdate()
-                {
+                {
-
+
-                }
+                }
-
+
-                // ...
+                // ...
-
+
-                void Update()
+                void Update()
-                {
+                {
-                    // Input.
+                    // Input.
-
+
-                    mouseInput.x = Input.GetAxis("Mouse X");
+                    mouseInput.x = Input.GetAxis("Mouse X");
-                    mouseInput.y = Input.GetAxis("Mouse Y");
+                    mouseInput.y = Input.GetAxis("Mouse Y");
-
+
-                    if (Input.GetMouseButtonDown(0))
+                    if (Input.GetMouseButtonDown(0))
-                    {
+                    {
-                        lockMouse();
+                        lockMouse();
-                    }
+                    }
-                    else if (Input.GetKeyDown(KeyCode.Escape))
+                    else if (Input.GetKeyDown(KeyCode.Escape))
-                    {
+                    {
-                        unlockMouse();
+                        unlockMouse();
-                    }
+                    }
-                }
+                }
-
+
-                // ...
+                // ...
-
+
-                void LateUpdate()
+                void LateUpdate()
-                {                    
+                {                    
-                    // Follow position.
+                    // Follow position.
-
+
-                    transform.position = Damping.dampVector3(transform.position, target.position, followTargetSpeed, Time.deltaTime);
+                    transform.position = Damping.dampVector3(transform.position, target.position, followTargetSpeed, Time.deltaTime);
-
+
-                    if (Cursor.lockState == CursorLockMode.Locked)
+                    if (Cursor.lockState == CursorLockMode.Locked)
-                    {
+                    {
-                        // Rotation.
+                        // Rotation.
-                        // Can't get it to smooth when rotating, so I just set the physica time step to 0.01f (half of default).
+                        // Can't get it to smooth when rotating, so I just set the physica time step to 0.01f (half of default).
-
+
-                        targetRotationEuler.y += mouseInput.x * mouseRotateAmount;
+                        targetRotationEuler.y += mouseInput.x * mouseRotateAmount;
-                        targetRotationEuler.x += -mouseInput.y * mouseRotateAmount;
+                        targetRotationEuler.x += -mouseInput.y * mouseRotateAmount;
-
+
-                        targetRotationEuler.x = Mathf.Clamp(targetRotationEuler.x, lookUpDownRange.x, lookUpDownRange.y);
+                        targetRotationEuler.x = Mathf.Clamp(targetRotationEuler.x, lookUpDownRange.x, lookUpDownRange.y);
-
+
-                        targetRotationEuler.z += mouseInput.x * rotateZSpeed;
+                        targetRotationEuler.z += mouseInput.x * rotateZSpeed;
-
+
-                        rotationEuler = Damping.dampVector3(rotationEuler, targetRotationEuler, mouseRotateSpeed, Time.deltaTime);
+                        rotationEuler = Damping.dampVector3(rotationEuler, targetRotationEuler, mouseRotateSpeed, Time.deltaTime);
-
+
-                        transform.eulerAngles = rotationEuler;
+                        transform.eulerAngles = rotationEuler;
-
+
-                        //transform.rotation *= Quaternion.AngleAxis(mouseRotateSpeed * Time.deltaTime, Vector3.up);
+                        //transform.rotation *= Quaternion.AngleAxis(mouseRotateSpeed * Time.deltaTime, Vector3.up);
-
+
-                        // Offset framing.
+                        // Offset framing.
-
+
-                        float playerSpeed = player.rb.velocity.magnitude;
+                        float playerSpeed = player.rb.velocity.magnitude;
-
+
-                        if (playerSpeed < minPlayerSpeedForOffsetFraming)
+                        if (playerSpeed < minPlayerSpeedForOffsetFraming)
-                        {
+                        {
-                            offsetMouseFramePosition = offsetStartPosition;
+                            offsetMouseFramePosition = offsetStartPosition;
-                        }
+                        }
-                        else
+                        else
-                        {
+                        {
-                            if (mouseInput.x > minMouseMoveForOffsetFraming)
+                            if (mouseInput.x > minMouseMoveForOffsetFraming)
-                            {
+                            {
-                                offsetMouseFramePosition.x = -offsetFramingAmount;
+                                offsetMouseFramePosition.x = -offsetFramingAmount;
-                            }
+                            }
-                            else if (mouseInput.x < -minMouseMoveForOffsetFraming)
+                            else if (mouseInput.x < -minMouseMoveForOffsetFraming)
-                            {
+                            {
-                                offsetMouseFramePosition.x = offsetFramingAmount;
+                                offsetMouseFramePosition.x = offsetFramingAmount;
-                            }
+                            }
-
+
-                            if (mouseInput.y > minMouseMoveForOffsetFraming)
+                            if (mouseInput.y > minMouseMoveForOffsetFraming)
-                            {
+                            {
-                                offsetMouseFramePosition.y = -offsetFramingAmount;
+                                offsetMouseFramePosition.y = -offsetFramingAmount;
-                            }
+                            }
-                            else if (mouseInput.y < -minMouseMoveForOffsetFraming)
+                            else if (mouseInput.y < -minMouseMoveForOffsetFraming)
-                            {
+                            {
-                                offsetMouseFramePosition.y = offsetFramingAmount;
+                                offsetMouseFramePosition.y = offsetFramingAmount;
-                            }
+                            }
-                        }
+                        }
-
+
-                        offsetPositionTarget = Damping.dampVector3(offsetPositionTarget, offsetMouseFramePosition, offsetFramingSpeed, Time.deltaTime);
+                        offsetPositionTarget = Damping.dampVector3(offsetPositionTarget, offsetMouseFramePosition, offsetFramingSpeed, Time.deltaTime);
-
+
-                        // Balance out rotation around Z back to 0.0f.
+                        // Balance out rotation around Z back to 0.0f.
-
+
-                        targetRotationEuler.z = Damping.dampFloat(targetRotationEuler.z, 0.0f, resetZRotationSpeed, Time.deltaTime);
+                        targetRotationEuler.z = Damping.dampFloat(targetRotationEuler.z, 0.0f, resetZRotationSpeed, Time.deltaTime);
-
+
-                        // Zoom.
+                        // Zoom.
-
+
-                        // Scrolling happens as 0.1f increments. x10.0f to make it 1.0f.
+                        // Scrolling happens as 0.1f increments. x10.0f to make it 1.0f.
-
+
-                        float scroll = Input.GetAxis("Mouse ScrollWheel") * 10.0f;
+                        float scroll = Input.GetAxis("Mouse ScrollWheel") * 10.0f;
-
+
-                        zoomDistance -= scroll * mouseZoomAmount;
+                        zoomDistance -= scroll * mouseZoomAmount;
-                        zoomDistance = Mathf.Clamp(zoomDistance, mouseZoomMin, mouseZoomMax);
+                        zoomDistance = Mathf.Clamp(zoomDistance, mouseZoomMin, mouseZoomMax);
-
+
-                        // Player occlusion check and zoom.
+                        // Player occlusion check and zoom.
-
+
-                        RaycastHit hitInfo;
+                        RaycastHit hitInfo;
-
+
-                        checkIfPlayerOccluded(out hitInfo);
+                        checkIfPlayerOccluded(out hitInfo);
-                        //float nearestDistance = checkCameraPoints(out hitInfo);
+                        //float nearestDistance = checkCameraPoints(out hitInfo);
-
+
-                        Vector3 finalOffsetPositionTarget;
+                        Vector3 finalOffsetPositionTarget;
-
+
-                        RaycastHit hitInfo2;
+                        RaycastHit hitInfo2;
-
+
-                        Transform cameraTransform = camera.transform;
+                        Transform cameraTransform = camera.transform;
-
+
-                        Vector3 directionToTarget = (target.position - cameraTransform.position).normalized;
+                        Vector3 directionToTarget = (target.position - cameraTransform.position).normalized;
-                        Vector3 end = target.position - (directionToTarget * (zoomDistance + occlusionZoomOffset));
+                        Vector3 end = target.position - (directionToTarget * (zoomDistance + occlusionZoomOffset));
-
+
-                        Physics.Raycast(end, Vector3.down, out hitInfo2, occlusionRaycastDownDistance);
+                        Physics.Raycast(end, Vector3.down, out hitInfo2, occlusionRaycastDownDistance);
-                        Debug.DrawLine(end, end + (Vector3.down * occlusionRaycastDownDistance), Color.white);
+                        Debug.DrawLine(end, end + (Vector3.down * occlusionRaycastDownDistance), Color.white);
-
+
-                        if (hitInfo.collider)
+                        if (hitInfo.collider)
-                        {
+                        {
-                            //finalOffsetPositionTarget = offsetPositionTarget.normalized * nearestDistance;
+                            //finalOffsetPositionTarget = offsetPositionTarget.normalized * nearestDistance;
-                            finalOffsetPositionTarget = offsetPositionTarget.normalized * hitInfo.distance;
+                            finalOffsetPositionTarget = offsetPositionTarget.normalized * hitInfo.distance;
-                        }
+                        }
-                        //if (hitInfo2.collider)
+                        //if (hitInfo2.collider)
-                        //{                            
+                        //{                            
-                        //    float curveResult = 1.0f - occlisionRaycastDownCurve.Evaluate(hitInfo2.distance / occlusionRaycastDownDistance);
+                        //    float curveResult = 1.0f - occlisionRaycastDownCurve.Evaluate(hitInfo2.distance / occlusionRaycastDownDistance);
-                        //    finalOffsetPositionTarget = (offsetPositionTarget.normalized * zoomDistance) * curveResult;
+                        //    finalOffsetPositionTarget = (offsetPositionTarget.normalized * zoomDistance) * curveResult;
-                        //}
+                        //}
-                        //else if (hitInfo.collider)
+                        //else if (hitInfo.collider)
-                        //{
+                        //{
-                        //    finalOffsetPositionTarget = Vector3.zero;
+                        //    finalOffsetPositionTarget = Vector3.zero;
-                        //}
+                        //}
-                        else
+                        else
-                        {
+                        {
-                            finalOffsetPositionTarget = offsetPositionTarget.normalized * zoomDistance;
+                            finalOffsetPositionTarget = offsetPositionTarget.normalized * zoomDistance;
-                        }
+                        }
-
+
-                        offset.localPosition = Damping.dampVector3(offset.localPosition, finalOffsetPositionTarget, mouseZoomSpeed, Time.deltaTime);
+                        offset.localPosition = Damping.dampVector3(offset.localPosition, finalOffsetPositionTarget, mouseZoomSpeed, Time.deltaTime);
-                    }
+                    }
-                }
+                }
-
+
-                // ...
+                // ...
-
+
-                void checkIfPlayerOccluded(out RaycastHit hitInfo)
+                void checkIfPlayerOccluded(out RaycastHit hitInfo)
-                {
+                {
-                    if (!camera)
+                    if (!camera)
-                    {
+                    {
-                        camera = Camera.main;
+                        camera = Camera.main;
-                    }
+                    }
-
+
-                    Transform cameraTransform = camera.transform;
+                    Transform cameraTransform = camera.transform;
-
+
-                    Vector3 directionToTarget = (target.position - cameraTransform.position).normalized;
+                    Vector3 directionToTarget = (target.position - cameraTransform.position).normalized;
-
+
-                    Vector3 start = target.position;
+                    Vector3 start = target.position;
-                    Vector3 end = Application.isPlaying ?
+                    Vector3 end = Application.isPlaying ?
-
+
-                        (target.position - (directionToTarget * (zoomDistance + occlusionZoomOffset))) :
+                        (target.position - (directionToTarget * (zoomDistance + occlusionZoomOffset))) :
-                        (offset.position + (-directionToTarget * occlusionZoomOffset));
+                        (offset.position + (-directionToTarget * occlusionZoomOffset));
-
+
-                    Physics.Linecast(start, end, out hitInfo);
+                    Physics.Linecast(start, end, out hitInfo);
-
+
-                    if (!Application.isPlaying)
+                    if (!Application.isPlaying)
-                    {
+                    {
-                        Gizmos.color =
+                        Gizmos.color =
-                            hitInfo.collider ? Color.red : Color.green;
+                            hitInfo.collider ? Color.red : Color.green;
-
+
-                        Gizmos.DrawLine(start, end);
+                        Gizmos.DrawLine(start, end);
-                    }
+                    }
-                    else
+                    else
-                    {
+                    {
-                        Debug.DrawLine(start, end, hitInfo.collider ? Color.red : Color.green);
+                        Debug.DrawLine(start, end, hitInfo.collider ? Color.red : Color.green);
-                    }
+                    }
-                }
+                }
-
+
-                // ...
+                // ...
-
+
-                void OnDrawGizmos()
+                void OnDrawGizmos()
-                {
+                {
-                    RaycastHit hitInfo;
+                    RaycastHit hitInfo;
-
+
-                    checkIfPlayerOccluded(out hitInfo);
+                    checkIfPlayerOccluded(out hitInfo);
-                    //checkCameraPoints(out hitInfo);
+                    //checkCameraPoints(out hitInfo);
-                }
+                }
-
+
-                // =================================	
+                // =================================	
-                // End functions.
+                // End functions.
-                // =================================
+                // =================================
-
+
-            }
+            }
-
+
-            // =================================	
+            // =================================	
-            // End namespace.
+            // End namespace.
-            // =================================
+            // =================================
-
+
-        }
+        }
-
+
-    }
+    }
-
+
-}
+}
-
+
-// =================================	
+// =================================	
-// --END-- //
+// --END-- //
-// =================================
+// =================================

+ 95 - 95
Assets/Mirza Beig/Demos/The Last Particle/Scripts/Collectable.cs

@@ -1,95 +1,95 @@
-
+
-// =================================	
+// =================================	
-// Namespaces.
+// Namespaces.
-// =================================
+// =================================
-
+
-using UnityEngine;
+using UnityEngine;
-
+
-// =================================	
+// =================================	
-// Define namespace.
+// Define namespace.
-// =================================
+// =================================
-
+
-namespace MirzaBeig
+namespace MirzaBeig
-{
+{
-
+
-    namespace Demos
+    namespace Demos
-    {
+    {
-
+
-        namespace TheLastParticle
+        namespace TheLastParticle
-        {
+        {
-
+
-            // =================================	
+            // =================================	
-            // Classes.
+            // Classes.
-            // =================================
+            // =================================
-
+
-            //[ExecuteInEditMode]
+            //[ExecuteInEditMode]
-            [System.Serializable]
+            [System.Serializable]
-
+
-            public class Collectable : MonoBehaviour
+            public class Collectable : MonoBehaviour
-            {
+            {
-                // =================================	
+                // =================================	
-                // Nested classes and structures.
+                // Nested classes and structures.
-                // =================================
+                // =================================
-
+
-                // ...
+                // ...
-
+
-                // =================================	
+                // =================================	
-                // Variables.
+                // Variables.
-                // =================================
+                // =================================
-
+
-                // ...
+                // ...
-
+
-                public GameObject[] deathPrefabs;
+                public GameObject[] deathPrefabs;
-
+
-                SetParent sp;
+                SetParent sp;
-                ParticleSystems.ParticleSystems ps;
+                ParticleSystems.ParticleSystems ps;
-
+
-                // =================================	
+                // =================================	
-                // Functions.
+                // Functions.
-                // =================================
+                // =================================
-
+
-                // ...
+                // ...
-
+
-                void Start()
+                void Start()
-                {
+                {
-                    sp = GetComponent<SetParent>();
+                    sp = GetComponent<SetParent>();
-                    ps = GetComponentInChildren<ParticleSystems.ParticleSystems>();
+                    ps = GetComponentInChildren<ParticleSystems.ParticleSystems>();
-                }
+                }
-
+
-                // ...
+                // ...
-
+
-                void OnTriggerEnter(Collider collider)
+                void OnTriggerEnter(Collider collider)
-                {
+                {
-                    if (collider.tag == "Player")
+                    if (collider.tag == "Player")
-                    {
+                    {
-                        sp.run();
+                        sp.run();
-                        ps.stop();
+                        ps.stop();
-
+
-                        for (int i = 0; i < deathPrefabs.Length; i++)
+                        for (int i = 0; i < deathPrefabs.Length; i++)
-                        {
+                        {
-                            Instantiate(deathPrefabs[i], transform.position, transform.rotation);
+                            Instantiate(deathPrefabs[i], transform.position, transform.rotation);
-                        }
+                        }
-
+
-                        Destroy(gameObject);
+                        Destroy(gameObject);
-                    }
+                    }
-                }
+                }
-
+
-                // =================================	
+                // =================================	
-                // End functions.
+                // End functions.
-                // =================================
+                // =================================
-
+
-            }
+            }
-
+
-            // =================================	
+            // =================================	
-            // End namespace.
+            // End namespace.
-            // =================================
+            // =================================
-
+
-        }
+        }
-
+
-    }
+    }
-
+
-}
+}
-
+
-// =================================	
+// =================================	
-// --END-- //
+// --END-- //
-// =================================
+// =================================

+ 106 - 106
Assets/Mirza Beig/Demos/The Last Particle/Scripts/CollectableSpawner.cs

@@ -1,106 +1,106 @@
-
+
-// =================================	
+// =================================	
-// Namespaces.
+// Namespaces.
-// =================================
+// =================================
-
+
-using UnityEngine;
+using UnityEngine;
-
+
-// =================================	
+// =================================	
-// Define namespace.
+// Define namespace.
-// =================================
+// =================================
-
+
-namespace MirzaBeig
+namespace MirzaBeig
-{
+{
-
+
-    namespace Demos
+    namespace Demos
-    {
+    {
-
+
-        namespace TheLastParticle
+        namespace TheLastParticle
-        {
+        {
-
+
-            // =================================	
+            // =================================	
-            // Classes.
+            // Classes.
-            // =================================
+            // =================================
-
+
-            //[ExecuteInEditMode]
+            //[ExecuteInEditMode]
-            [System.Serializable]
+            [System.Serializable]
-
+
-            public class CollectableSpawner : MonoBehaviour
+            public class CollectableSpawner : MonoBehaviour
-            {
+            {
-                // =================================	
+                // =================================	
-                // Nested classes and structures.
+                // Nested classes and structures.
-                // =================================
+                // =================================
-
+
-                // ...
+                // ...
-
+
-                // =================================	
+                // =================================	
-                // Variables.
+                // Variables.
-                // =================================
+                // =================================
-
+
-                // ...
+                // ...
-
+
-                public Collectable collectable;
+                public Collectable collectable;
-
+
-                public float collectablesPerSecond = 0.25f;
+                public float collectablesPerSecond = 0.25f;
-                public Vector3 spawnBoxScale = Vector3.one * 10.0f;
+                public Vector3 spawnBoxScale = Vector3.one * 10.0f;
-
+
-                float timer;
+                float timer;
-
+
-                // =================================	
+                // =================================	
-                // Functions.
+                // Functions.
-                // =================================
+                // =================================
-
+
-                // ...
+                // ...
-
+
-                void Start()
+                void Start()
-                {
+                {
-                    timer = 0.0f;
+                    timer = 0.0f;
-                }
+                }
-
+
-                // ...
+                // ...
-
+
-                void Update()
+                void Update()
-                {
+                {
-                    timer += Time.deltaTime * collectablesPerSecond;
+                    timer += Time.deltaTime * collectablesPerSecond;
-
+
-                    if (timer >= 1.0f)
+                    if (timer >= 1.0f)
-                    {
+                    {
-                        timer = 0.0f;
+                        timer = 0.0f;
-
+
-                        Vector3 position = transform.position;
+                        Vector3 position = transform.position;
-                        Vector3 scale = spawnBoxScale / 2.0f;
+                        Vector3 scale = spawnBoxScale / 2.0f;
-
+
-                        position.x += Random.Range(-scale.x, scale.x);
+                        position.x += Random.Range(-scale.x, scale.x);
-                        position.y += Random.Range(-scale.y, scale.y);
+                        position.y += Random.Range(-scale.y, scale.y);
-                        position.z += Random.Range(-scale.z, scale.z);
+                        position.z += Random.Range(-scale.z, scale.z);
-                                                
+                                                
-                        Instantiate(collectable, position, Quaternion.identity);
+                        Instantiate(collectable, position, Quaternion.identity);
-                    }
+                    }
-                }
+                }
-
+
-                // ...
+                // ...
-
+
-                void OnDrawGizmos()
+                void OnDrawGizmos()
-                {
+                {
-                    Gizmos.DrawWireCube(transform.position, spawnBoxScale);
+                    Gizmos.DrawWireCube(transform.position, spawnBoxScale);
-                }
+                }
-
+
-                // =================================	
+                // =================================	
-                // End functions.
+                // End functions.
-                // =================================
+                // =================================
-
+
-            }
+            }
-
+
-            // =================================	
+            // =================================	
-            // End namespace.
+            // End namespace.
-            // =================================
+            // =================================
-
+
-        }
+        }
-
+
-    }
+    }
-
+
-}
+}
-
+
-// =================================	
+// =================================	
-// --END-- //
+// --END-- //
-// =================================
+// =================================

+ 79 - 79
Assets/Mirza Beig/Demos/The Last Particle/Scripts/Damping.cs

@@ -1,79 +1,79 @@
-
+
-// =================================	
+// =================================	
-// Namespaces.
+// Namespaces.
-// =================================
+// =================================
-
+
-using UnityEngine;
+using UnityEngine;
-
+
-// =================================	
+// =================================	
-// Define namespace.
+// Define namespace.
-// =================================
+// =================================
-
+
-namespace MirzaBeig
+namespace MirzaBeig
-{
+{
-
+
-    namespace Demos
+    namespace Demos
-    {
+    {
-
+
-        namespace TheLastParticle
+        namespace TheLastParticle
-        {
+        {
-
+
-            // =================================	
+            // =================================	
-            // Classes.
+            // Classes.
-            // =================================
+            // =================================
-
+
-            //[ExecuteInEditMode]
+            //[ExecuteInEditMode]
-            [System.Serializable]
+            [System.Serializable]
-
+
-            public static class Damping
+            public static class Damping
-            {
+            {
-                // =================================	
+                // =================================	
-                // Nested classes and structures.
+                // Nested classes and structures.
-                // =================================
+                // =================================
-
+
-                // ...
+                // ...
-
+
-                // =================================	
+                // =================================	
-                // Variables.
+                // Variables.
-                // =================================
+                // =================================
-
+
-                // ...
+                // ...
-
+
-                // =================================	
+                // =================================	
-                // Functions.
+                // Functions.
-                // =================================
+                // =================================
-
+
-                // ...
+                // ...
-
+
-                public static float dampFloat(float from, float to, float speed, float deltaTime)
+                public static float dampFloat(float from, float to, float speed, float deltaTime)
-                {
+                {
-                    return Mathf.Lerp(from, to, 1.0f - Mathf.Exp(-speed * deltaTime));
+                    return Mathf.Lerp(from, to, 1.0f - Mathf.Exp(-speed * deltaTime));
-                }
+                }
-                public static Vector3 dampVector3(Vector3 from, Vector3 to, float speed, float deltaTime)
+                public static Vector3 dampVector3(Vector3 from, Vector3 to, float speed, float deltaTime)
-                {
+                {
-                    return Vector3.Lerp(from, to, 1.0f - Mathf.Exp(-speed * deltaTime));
+                    return Vector3.Lerp(from, to, 1.0f - Mathf.Exp(-speed * deltaTime));
-                }
+                }
-                public static Quaternion dampQuaternion(Quaternion from, Quaternion to, float speed, float deltaTime)
+                public static Quaternion dampQuaternion(Quaternion from, Quaternion to, float speed, float deltaTime)
-                {
+                {
-                    return Quaternion.Slerp(from, to, 1.0f - Mathf.Exp(-speed * deltaTime));
+                    return Quaternion.Slerp(from, to, 1.0f - Mathf.Exp(-speed * deltaTime));
-                }
+                }
-
+
-                // =================================	
+                // =================================	
-                // End functions.
+                // End functions.
-                // =================================
+                // =================================
-
+
-            }
+            }
-
+
-            // =================================	
+            // =================================	
-            // End namespace.
+            // End namespace.
-            // =================================
+            // =================================
-
+
-        }
+        }
-
+
-    }
+    }
-
+
-}
+}
-
+
-// =================================	
+// =================================	
-// --END-- //
+// --END-- //
-// =================================
+// =================================

+ 83 - 83
Assets/Mirza Beig/Demos/The Last Particle/Scripts/DestroyOnAudioStop.cs

@@ -1,83 +1,83 @@
-
+
-// =================================	
+// =================================	
-// Namespaces.
+// Namespaces.
-// =================================
+// =================================
-
+
-using UnityEngine;
+using UnityEngine;
-
+
-// =================================	
+// =================================	
-// Define namespace.
+// Define namespace.
-// =================================
+// =================================
-
+
-namespace MirzaBeig
+namespace MirzaBeig
-{
+{
-
+
-    namespace Demos
+    namespace Demos
-    {
+    {
-
+
-        namespace TheLastParticle
+        namespace TheLastParticle
-        {
+        {
-
+
-            // =================================	
+            // =================================	
-            // Classes.
+            // Classes.
-            // =================================
+            // =================================
-
+
-            //[ExecuteInEditMode]
+            //[ExecuteInEditMode]
-            [System.Serializable]
+            [System.Serializable]
-
+
-            public class DestroyOnAudioStop : MonoBehaviour
+            public class DestroyOnAudioStop : MonoBehaviour
-            {
+            {
-                // =================================	
+                // =================================	
-                // Nested classes and structures.
+                // Nested classes and structures.
-                // =================================
+                // =================================
-
+
-                // ...
+                // ...
-
+
-                // =================================	
+                // =================================	
-                // Variables.
+                // Variables.
-                // =================================
+                // =================================
-
+
-                // ...
+                // ...
-
+
-                AudioSource audioSource;
+                AudioSource audioSource;
-
+
-                // =================================	
+                // =================================	
-                // Functions.
+                // Functions.
-                // =================================
+                // =================================
-
+
-                // ...
+                // ...
-
+
-                void Start()
+                void Start()
-                {
+                {
-                    audioSource = GetComponent<AudioSource>();
+                    audioSource = GetComponent<AudioSource>();
-                }
+                }
-
+
-                // ...
+                // ...
-
+
-                void Update()
+                void Update()
-                {
+                {
-                    if (!audioSource.isPlaying)
+                    if (!audioSource.isPlaying)
-                    {
+                    {
-                        Destroy(gameObject);
+                        Destroy(gameObject);
-                    }
+                    }
-                }
+                }
-
+
-                // =================================	
+                // =================================	
-                // End functions.
+                // End functions.
-                // =================================
+                // =================================
-
+
-            }
+            }
-
+
-            // =================================	
+            // =================================	
-            // End namespace.
+            // End namespace.
-            // =================================
+            // =================================
-
+
-        }
+        }
-
+
-    }
+    }
-
+
-}
+}
-
+
-// =================================	
+// =================================	
-// --END-- //
+// --END-- //
-// =================================
+// =================================

+ 78 - 78
Assets/Mirza Beig/Demos/The Last Particle/Scripts/InstantiatePrefabOnCollisionEnter.cs

@@ -1,78 +1,78 @@
-
+
-// =================================	
+// =================================	
-// Namespaces.
+// Namespaces.
-// =================================
+// =================================
-
+
-using UnityEngine;
+using UnityEngine;
-
+
-// =================================	
+// =================================	
-// Define namespace.
+// Define namespace.
-// =================================
+// =================================
-
+
-namespace MirzaBeig
+namespace MirzaBeig
-{
+{
-
+
-    namespace Demos
+    namespace Demos
-    {
+    {
-
+
-        namespace TheLastParticle
+        namespace TheLastParticle
-        {
+        {
-
+
-            // =================================	
+            // =================================	
-            // Classes.
+            // Classes.
-            // =================================
+            // =================================
-
+
-            //[ExecuteInEditMode]
+            //[ExecuteInEditMode]
-            [System.Serializable]
+            [System.Serializable]
-
+
-            public class InstantiatePrefabOnCollisionEnter : MonoBehaviour
+            public class InstantiatePrefabOnCollisionEnter : MonoBehaviour
-            {
+            {
-                // =================================	
+                // =================================	
-                // Nested classes and structures.
+                // Nested classes and structures.
-                // =================================
+                // =================================
-
+
-                // ...
+                // ...
-
+
-                // =================================	
+                // =================================	
-                // Variables.
+                // Variables.
-                // =================================
+                // =================================
-
+
-                // ...
+                // ...
-
+
-                public GameObject[] prefabs;
+                public GameObject[] prefabs;
-
+
-                // =================================	
+                // =================================	
-                // Functions.
+                // Functions.
-                // =================================
+                // =================================
-
+
-                // ...
+                // ...
-
+
-                void OnCollisionEnter(Collision collision)
+                void OnCollisionEnter(Collision collision)
-                {
+                {
-                    ContactPoint contactPoint = collision.contacts[0];
+                    ContactPoint contactPoint = collision.contacts[0];
-
+
-                    for (int i = 0; i < prefabs.Length; i++)
+                    for (int i = 0; i < prefabs.Length; i++)
-                    {
+                    {
-                        Instantiate(prefabs[i], contactPoint.point, Quaternion.Euler(contactPoint.point));
+                        Instantiate(prefabs[i], contactPoint.point, Quaternion.Euler(contactPoint.point));
-                    }
+                    }
-                }
+                }
-
+
-                // =================================	
+                // =================================	
-                // End functions.
+                // End functions.
-                // =================================
+                // =================================
-
+
-            }
+            }
-
+
-            // =================================	
+            // =================================	
-            // End namespace.
+            // End namespace.
-            // =================================
+            // =================================
-
+
-        }
+        }
-
+
-    }
+    }
-
+
-}
+}
-
+
-// =================================	
+// =================================	
-// --END-- //
+// --END-- //
-// =================================
+// =================================

+ 77 - 77
Assets/Mirza Beig/Demos/The Last Particle/Scripts/OnTriggerEvents.cs

@@ -1,77 +1,77 @@
-
+
-// =================================	
+// =================================	
-// Namespaces.
+// Namespaces.
-// =================================
+// =================================
-
+
-using UnityEngine;
+using UnityEngine;
-using UnityEngine.Events;
+using UnityEngine.Events;
-
+
-// =================================	
+// =================================	
-// Define namespace.
+// Define namespace.
-// =================================
+// =================================
-
+
-namespace MirzaBeig
+namespace MirzaBeig
-{
+{
-
+
-    namespace Demos
+    namespace Demos
-    {
+    {
-
+
-        namespace TheLastParticle
+        namespace TheLastParticle
-        {
+        {
-
+
-            // =================================	
+            // =================================	
-            // Classes.
+            // Classes.
-            // =================================
+            // =================================
-
+
-            //[ExecuteInEditMode]
+            //[ExecuteInEditMode]
-            [System.Serializable]
+            [System.Serializable]
-
+
-            public class OnTriggerEvents : MonoBehaviour
+            public class OnTriggerEvents : MonoBehaviour
-            {
+            {
-                // =================================	
+                // =================================	
-                // Nested classes and structures.
+                // Nested classes and structures.
-                // =================================
+                // =================================
-
+
-                // ...
+                // ...
-
+
-                // =================================	
+                // =================================	
-                // Variables.
+                // Variables.
-                // =================================
+                // =================================
-
+
-                // ...
+                // ...
-
+
-                public UnityEvent OnTriggerEvent;
+                public UnityEvent OnTriggerEvent;
-
+
-                // =================================	
+                // =================================	
-                // Functions.
+                // Functions.
-                // =================================
+                // =================================
-
+
-                // ...
+                // ...
-
+
-                void OnTriggerEnter(Collider collider)
+                void OnTriggerEnter(Collider collider)
-                {
+                {
-                    if (OnTriggerEvent != null)
+                    if (OnTriggerEvent != null)
-                    {
+                    {
-                        OnTriggerEvent.Invoke();
+                        OnTriggerEvent.Invoke();
-                    }
+                    }
-                }
+                }
-
+
-                // =================================	
+                // =================================	
-                // End functions.
+                // End functions.
-                // =================================
+                // =================================
-
+
-            }
+            }
-
+
-            // =================================	
+            // =================================	
-            // End namespace.
+            // End namespace.
-            // =================================
+            // =================================
-
+
-        }
+        }
-
+
-    }
+    }
-
+
-}
+}
-
+
-// =================================	
+// =================================	
-// --END-- //
+// --END-- //
-// =================================
+// =================================

+ 186 - 186
Assets/Mirza Beig/Demos/The Last Particle/Scripts/Player.cs

@@ -1,186 +1,186 @@
-
+
-// =================================	
+// =================================	
-// Namespaces.
+// Namespaces.
-// =================================
+// =================================
-
+
-using UnityEngine;
+using UnityEngine;
-
+
-// =================================	
+// =================================	
-// Define namespace.
+// Define namespace.
-// =================================
+// =================================
-
+
-namespace MirzaBeig
+namespace MirzaBeig
-{
+{
-
+
-    namespace Demos
+    namespace Demos
-    {
+    {
-
+
-        namespace TheLastParticle
+        namespace TheLastParticle
-        {
+        {
-
+
-            // =================================	
+            // =================================	
-            // Classes.
+            // Classes.
-            // =================================
+            // =================================
-
+
-            //[ExecuteInEditMode]
+            //[ExecuteInEditMode]
-            [System.Serializable]
+            [System.Serializable]
-
+
-            public class Player : MonoBehaviour
+            public class Player : MonoBehaviour
-            {
+            {
-                // =================================	
+                // =================================	
-                // Nested classes and structures.
+                // Nested classes and structures.
-                // =================================
+                // =================================
-
+
-                // ...
+                // ...
-
+
-                // =================================	
+                // =================================	
-                // Variables.
+                // Variables.
-                // =================================
+                // =================================
-
+
-                // ...
+                // ...
-
+
-                public Rigidbody rb { get; set; }
+                public Rigidbody rb { get; set; }
-
+
-                // ...
+                // ...
-
+
-                public float thrust = 0.125f;
+                public float thrust = 0.125f;
-                public float boostThrustMult = 2.0f;
+                public float boostThrustMult = 2.0f;
-
+
-                // ...
+                // ...
-
+
-                new Camera camera;
+                new Camera camera;
-                public float rotateToCameraForwardSpeed = Mathf.Infinity;
+                public float rotateToCameraForwardSpeed = Mathf.Infinity;
-
+
-                // ...
+                // ...
-
+
-                public float cameraFieldOfViewMaxSpeed = 20.0f;
+                public float cameraFieldOfViewMaxSpeed = 20.0f;
-                public Vector2 cameraFieldOfViewAngleRange = new Vector2(50.0f, 75.0f);
+                public Vector2 cameraFieldOfViewAngleRange = new Vector2(50.0f, 75.0f);
-
+
-                // ...
+                // ...
-
+
-                Vector3 startPosition;
+                Vector3 startPosition;
-                Quaternion startRotation;
+                Quaternion startRotation;
-
+
-                // =================================	
+                // =================================	
-                // Functions.
+                // Functions.
-                // =================================
+                // =================================
-
+
-                // ...
+                // ...
-
+
-                void Awake()
+                void Awake()
-                {
+                {
-
+
-                }
+                }
-
+
-                // ...
+                // ...
-
+
-                void Start()
+                void Start()
-                {
+                {
-                    rb = GetComponent<Rigidbody>();
+                    rb = GetComponent<Rigidbody>();
-
+
-                    startPosition = transform.position;
+                    startPosition = transform.position;
-                    startRotation = transform.rotation;
+                    startRotation = transform.rotation;
-
+
-                    lockMouse();
+                    lockMouse();
-
+
-                    camera = Camera.main;
+                    camera = Camera.main;
-                }
+                }
-
+
-                // ...
+                // ...
-
+
-                void lockMouse()
+                void lockMouse()
-                {
+                {
-                    Cursor.visible = false;
+                    Cursor.visible = false;
-                    Cursor.lockState = CursorLockMode.Locked;
+                    Cursor.lockState = CursorLockMode.Locked;
-                }
+                }
-                void unlockMouse()
+                void unlockMouse()
-                {
+                {
-                    Cursor.visible = true;
+                    Cursor.visible = true;
-                    Cursor.lockState = CursorLockMode.None;
+                    Cursor.lockState = CursorLockMode.None;
-                }
+                }
-
+
-                // ...
+                // ...
-
+
-                void FixedUpdate()
+                void FixedUpdate()
-                {
+                {
-                    // Input.
+                    // Input.
-
+
-                    float vertical = Input.GetAxis("Vertical");
+                    float vertical = Input.GetAxis("Vertical");
-                    float horizontal = Input.GetAxis("Horizontal");
+                    float horizontal = Input.GetAxis("Horizontal");
-
+
-                    //float forward = Input.GetKey(KeyCode.LeftShift) ? 1.0f : 0.0f;
+                    //float forward = Input.GetKey(KeyCode.LeftShift) ? 1.0f : 0.0f;
-
+
-                    Vector3 force = Vector3.zero;
+                    Vector3 force = Vector3.zero;
-
+
-                    force += Vector3.forward * vertical;
+                    force += Vector3.forward * vertical;
-                    force += Vector3.right * horizontal;
+                    force += Vector3.right * horizontal;
-
+
-                    force *= thrust;
+                    force *= thrust;
-
+
-                    bool boost = Input.GetKey(KeyCode.LeftShift);
+                    bool boost = Input.GetKey(KeyCode.LeftShift);
-
+
-                    if (boost)
+                    if (boost)
-                    {
+                    {
-                        force *= boostThrustMult;
+                        force *= boostThrustMult;
-                    }
+                    }
-
+
-                    rb.AddRelativeForce(force, ForceMode.VelocityChange);
+                    rb.AddRelativeForce(force, ForceMode.VelocityChange);
-
+
-                    // ...
+                    // ...
-
+
-                    float currentSpeed = rb.velocity.magnitude;
+                    float currentSpeed = rb.velocity.magnitude;
-                    float cameraFieldOfViewSpeedTime = currentSpeed / cameraFieldOfViewMaxSpeed;
+                    float cameraFieldOfViewSpeedTime = currentSpeed / cameraFieldOfViewMaxSpeed;
-
+
-                    cameraFieldOfViewSpeedTime = Mathf.Clamp01(cameraFieldOfViewSpeedTime);
+                    cameraFieldOfViewSpeedTime = Mathf.Clamp01(cameraFieldOfViewSpeedTime);
-
+
-                    camera.fieldOfView = Mathf.Lerp(
+                    camera.fieldOfView = Mathf.Lerp(
-                        cameraFieldOfViewAngleRange.x, cameraFieldOfViewAngleRange.y, cameraFieldOfViewSpeedTime);
+                        cameraFieldOfViewAngleRange.x, cameraFieldOfViewAngleRange.y, cameraFieldOfViewSpeedTime);
-                }
+                }
-
+
-                // ...
+                // ...
-
+
-                void Update()
+                void Update()
-                {
+                {
-                    if (Input.GetMouseButtonDown(0))
+                    if (Input.GetMouseButtonDown(0))
-                    {
+                    {
-                        lockMouse();
+                        lockMouse();
-                    }
+                    }
-                    else if (Input.GetKeyDown(KeyCode.Escape))
+                    else if (Input.GetKeyDown(KeyCode.Escape))
-                    {
+                    {
-                        unlockMouse();
+                        unlockMouse();
-                    }
+                    }
-
+
-                    if (Input.GetKeyDown(KeyCode.R))
+                    if (Input.GetKeyDown(KeyCode.R))
-                    {
+                    {
-                        transform.position = startPosition;
+                        transform.position = startPosition;
-                        transform.rotation = startRotation;
+                        transform.rotation = startRotation;
-                    }
+                    }
-                }
+                }
-
+
-                // ...
+                // ...
-
+
-                void LateUpdate()
+                void LateUpdate()
-                {
+                {
-                    transform.rotation = Damping.dampQuaternion(transform.rotation,
+                    transform.rotation = Damping.dampQuaternion(transform.rotation,
-                        Quaternion.LookRotation(camera.transform.forward), rotateToCameraForwardSpeed, Time.deltaTime);
+                        Quaternion.LookRotation(camera.transform.forward), rotateToCameraForwardSpeed, Time.deltaTime);
-                }
+                }
-
+
-                // =================================	
+                // =================================	
-                // End functions.
+                // End functions.
-                // =================================
+                // =================================
-
+
-            }
+            }
-
+
-            // =================================	
+            // =================================	
-            // End namespace.
+            // End namespace.
-            // =================================
+            // =================================
-
+
-        }
+        }
-
+
-    }
+    }
-
+
-}
+}
-
+
-// =================================	
+// =================================	
-// --END-- //
+// --END-- //
-// =================================
+// =================================

+ 105 - 105
Assets/Mirza Beig/Demos/The Last Particle/Scripts/RandomInvoke.cs

@@ -1,105 +1,105 @@
-
+
-// =================================	
+// =================================	
-// Namespaces.
+// Namespaces.
-// =================================
+// =================================
-
+
-using UnityEngine;
+using UnityEngine;
-using UnityEngine.Events;
+using UnityEngine.Events;
-
+
-// =================================	
+// =================================	
-// Define namespace.
+// Define namespace.
-// =================================
+// =================================
-
+
-namespace MirzaBeig
+namespace MirzaBeig
-{
+{
-
+
-    namespace Demos
+    namespace Demos
-    {
+    {
-
+
-        namespace TheLastParticle
+        namespace TheLastParticle
-        {
+        {
-
+
-            // =================================	
+            // =================================	
-            // Classes.
+            // Classes.
-            // =================================
+            // =================================
-
+
-            [ExecuteInEditMode]
+            [ExecuteInEditMode]
-            [System.Serializable]
+            [System.Serializable]
-
+
-            public class RandomInvoke : MonoBehaviour
+            public class RandomInvoke : MonoBehaviour
-            {
+            {
-                // =================================	
+                // =================================	
-                // Nested classes and structures.
+                // Nested classes and structures.
-                // =================================
+                // =================================
-
+
-                // ...
+                // ...
-
+
-                // =================================	
+                // =================================	
-                // Variables.
+                // Variables.
-                // =================================
+                // =================================
-
+
-                // ...
+                // ...
-
+
-                float timer;
+                float timer;
-                float nextInvokeTime;
+                float nextInvokeTime;
-
+
-                public Vector2 timeRange = new Vector2(2.0f, 5.0f);
+                public Vector2 timeRange = new Vector2(2.0f, 5.0f);
-
+
-                // =================================	
+                // =================================	
-                // Functions.
+                // Functions.
-                // =================================
+                // =================================
-
+
-                // ...
+                // ...
-
+
-                protected virtual void Start()
+                protected virtual void Start()
-                {
+                {
-                    // Even though invoke just calls Invoke, DON'T call the local invoke here!
+                    // Even though invoke just calls Invoke, DON'T call the local invoke here!
-                    // Since it will be overriden and made to do more...
+                    // Since it will be overriden and made to do more...
-
+
-                    // NOTE: Invoke doesn't seem to work with inheritance. So I'll just do it manually.
+                    // NOTE: Invoke doesn't seem to work with inheritance. So I'll just do it manually.
-
+
-                    nextInvokeTime = Random.Range(timeRange.x, timeRange.y);
+                    nextInvokeTime = Random.Range(timeRange.x, timeRange.y);
-                }
+                }
-
+
-                // ...
+                // ...
-
+
-                protected virtual void Update()
+                protected virtual void Update()
-                {
+                {
-                    timer += Time.deltaTime;
+                    timer += Time.deltaTime;
-
+
-                    if (timer >= nextInvokeTime)
+                    if (timer >= nextInvokeTime)
-                    {
+                    {
-                        doSomething();
+                        doSomething();
-
+
-                        timer = 0.0f;
+                        timer = 0.0f;
-                        nextInvokeTime = Random.Range(timeRange.x, timeRange.y);
+                        nextInvokeTime = Random.Range(timeRange.x, timeRange.y);
-
+
-                    }
+                    }
-                }
+                }
-
+
-                // ...
+                // ...
-
+
-                protected virtual void doSomething()
+                protected virtual void doSomething()
-                {
+                {
-
+
-                }
+                }
-
+
-                // =================================	
+                // =================================	
-                // End functions.
+                // End functions.
-                // =================================
+                // =================================
-
+
-            }
+            }
-
+
-            // =================================	
+            // =================================	
-            // End namespace.
+            // End namespace.
-            // =================================
+            // =================================
-
+
-        }
+        }
-
+
-    }
+    }
-
+
-}
+}
-
+
-// =================================	
+// =================================	
-// --END-- //
+// --END-- //
-// =================================
+// =================================

+ 100 - 100
Assets/Mirza Beig/Demos/The Last Particle/Scripts/RandomInvoke_EmitParticle.cs

@@ -1,100 +1,100 @@
-
+
-// =================================	
+// =================================	
-// Namespaces.
+// Namespaces.
-// =================================
+// =================================
-
+
-using UnityEngine;
+using UnityEngine;
-using UnityEngine.Events;
+using UnityEngine.Events;
-
+
-// =================================	
+// =================================	
-// Define namespace.
+// Define namespace.
-// =================================
+// =================================
-
+
-namespace MirzaBeig
+namespace MirzaBeig
-{
+{
-
+
-    namespace Demos
+    namespace Demos
-    {
+    {
-
+
-        namespace TheLastParticle
+        namespace TheLastParticle
-        {
+        {
-
+
-            // =================================	
+            // =================================	
-            // Classes.
+            // Classes.
-            // =================================
+            // =================================
-
+
-            [ExecuteInEditMode]
+            [ExecuteInEditMode]
-            [System.Serializable]
+            [System.Serializable]
-
+
-            public class RandomInvoke_EmitParticle : RandomInvoke
+            public class RandomInvoke_EmitParticle : RandomInvoke
-            {
+            {
-                // =================================	
+                // =================================	
-                // Nested classes and structures.
+                // Nested classes and structures.
-                // =================================
+                // =================================
-
+
-                // ...
+                // ...
-
+
-                // =================================	
+                // =================================	
-                // Variables.
+                // Variables.
-                // =================================
+                // =================================
-
+
-                // ...
+                // ...
-
+
-                ParticleSystem ps;
+                ParticleSystem ps;
-
+
-                public IntRange count = new IntRange(1, 2);
+                public IntRange count = new IntRange(1, 2);
-                public UnityEvent OnEmit;
+                public UnityEvent OnEmit;
-
+
-                // =================================	
+                // =================================	
-                // Functions.
+                // Functions.
-                // =================================
+                // =================================
-
+
-                // ...
+                // ...
-
+
-                protected override void Start()
+                protected override void Start()
-                {
+                {
-                    base.Start();
+                    base.Start();
-
+
-                    ps = GetComponent<ParticleSystem>();
+                    ps = GetComponent<ParticleSystem>();
-                }
+                }
-
+
-                // ...
+                // ...
-
+
-                protected override void Update()
+                protected override void Update()
-                {
+                {
-                    base.Update();
+                    base.Update();
-                }
+                }
-
+
-                // ...
+                // ...
-
+
-                protected override void doSomething()
+                protected override void doSomething()
-                {
+                {
-                    base.doSomething();
+                    base.doSomething();
-
+
-                    ps.Emit(count.random);
+                    ps.Emit(count.random);
-
+
-                    if (OnEmit != null)
+                    if (OnEmit != null)
-                    {
+                    {
-                        OnEmit.Invoke();
+                        OnEmit.Invoke();
-                    }
+                    }
-                }
+                }
-
+
-                // =================================	
+                // =================================	
-                // End functions.
+                // End functions.
-                // =================================
+                // =================================
-
+
-            }
+            }
-
+
-            // =================================	
+            // =================================	
-            // End namespace.
+            // End namespace.
-            // =================================
+            // =================================
-
+
-        }
+        }
-
+
-    }
+    }
-
+
-}
+}
-
+
-// =================================	
+// =================================	
-// --END-- //
+// --END-- //
-// =================================
+// =================================

Неке датотеке нису приказане због велике количине промена