Skip to content

Commit

Permalink
Optimize scripts.
Browse files Browse the repository at this point in the history
  • Loading branch information
mogoson committed Nov 12, 2017
1 parent 51a47b1 commit dd1edc9
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 1 deletion.
1 change: 1 addition & 0 deletions Assets/MGS-PathAnimation/Editor/PathAnimationEditor.cs
Original file line number Diff line number Diff line change
Expand Up @@ -42,6 +42,7 @@ protected void MarkSceneDirty()
public override void OnInspectorGUI()
{
DrawDefaultInspector();

if (GUILayout.Button("AlignToPath"))
{
script.AlignToPath();
Expand Down
5 changes: 4 additions & 1 deletion Assets/MGS-PathAnimation/Editor/PathEditor.cs
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,7 @@ public class PathEditor : Editor
protected Path script { get { return target as Path; } }

protected readonly Color blue = new Color(0, 1, 1, 1);

protected const float nodeSize = 0.1f;
protected const float buttonSize = 0.2f;
protected const float buttonOffset = 0.35f;
Expand Down Expand Up @@ -72,6 +73,7 @@ protected virtual void OnSceneGUI()
var anchorOffset = new Vector3(0, 0, handleSize);
if (i > 0)
anchorOffset = (script.anchors[i] - script.anchors[i - 1]).normalized * handleSize;

script.anchors.Insert(i + 1, script.anchors[i] + anchorOffset);
script.CreateCurve();
MarkSceneDirty();
Expand Down Expand Up @@ -108,7 +110,8 @@ protected virtual void OnSceneGUI()
protected void DrawSphereCap(Vector3 position, Quaternion rotation, float size)
{
#if UNITY_5_5_OR_NEWER
Handles.SphereHandleCap(0, position, rotation, size, EventType.Ignore);
if (Event.current.type == EventType.Repaint)
Handles.SphereHandleCap(0, position, rotation, size, EventType.Repaint);
#else
Handles.SphereCap(0, position, rotation, size);
#endif
Expand Down

0 comments on commit dd1edc9

Please sign in to comment.