public override void OnSceneGUI()
        {
            var lookAtAction = (HutongGames.PlayMaker.Actions.LookAt)target;

            if (lookAtAction.UpdateLookAtPosition())
            {
                var go          = target.Fsm.GetOwnerDefaultTarget(lookAtAction.gameObject);
                var goTransform = go.transform;
                var goPosition  = goTransform.position;

                var lookAtPosition = lookAtAction.GetLookAtPosition();
                var lookAtVector   = lookAtPosition - goPosition;
                var lookAtRotation = Quaternion.LookRotation(lookAtVector);
                var lookAtAngle    = Vector3.Angle(goTransform.forward, lookAtVector);
                var lookAtNormal   = Vector3.Cross(goTransform.forward, lookAtVector);

                var handleSize = HandleUtility.GetHandleSize(goPosition);
                var arrowSize  = handleSize * 0.2f;
                var distance   = (lookAtPosition - goPosition).magnitude;

                var goTarget = lookAtAction.targetObject.Value;

                // Position handles

                if (!lookAtAction.targetPosition.IsNone)
                {
                    if (goTarget != null)
                    {
                        // Edit local offset from target object

                        var goTargetTransform = goTarget.transform;
                        var worldTargetPos    = goTargetTransform.TransformPoint(lookAtAction.targetPosition.Value);

                        lookAtAction.targetPosition.Value = goTargetTransform.InverseTransformPoint(Handles.PositionHandle(worldTargetPos, goTarget.transform.rotation));
                        Handles.color = new Color(1, 1, 1, 0.2f);
                        Handles.DrawLine(goTargetTransform.position, lookAtAction.GetLookAtPositionWithVertical());
                    }
                    else
                    {
                        // Edit world position

                        lookAtAction.targetPosition.Value = Handles.PositionHandle(lookAtAction.targetPosition.Value, Quaternion.identity);
                    }
                }

                // Forward vector

                Handles.color = Color.blue;
                Handles.DrawLine(goPosition, goPosition + goTransform.forward * handleSize);

                // Lookat vector

                Handles.DrawLine(goPosition, lookAtPosition);
                Handles.ConeCap(0, goPosition + lookAtVector.normalized * (distance - arrowSize * 0.7f), lookAtRotation, arrowSize);   // fudge factor to position cap correctly

                // Arc between vectors

                Handles.color = new Color(1, 1, 1, 0.2f);
                Handles.DrawSolidArc(goPosition, lookAtNormal, goTransform.forward, lookAtAngle, handleSize);

                // Show vertical offset

                if (lookAtAction.keepVertical.Value)
                {
                    Handles.DrawLine(lookAtPosition, lookAtAction.GetLookAtPositionWithVertical());
                }

                if (GUI.changed)
                {
                    FsmEditor.EditingActions();
                    FsmEditor.Repaint(true);
                }
            }
        }
        public override void OnSceneGUI()
        {
            var moveTowardsAction = (MoveTowardsAdvanced)target;

            if (moveTowardsAction.UpdateTargetPos())
            {
                var go          = target.Fsm.GetOwnerDefaultTarget(moveTowardsAction.gameObject);
                var goTransform = go.transform;
                var goPosition  = goTransform.position;

                var lookAtPosition = moveTowardsAction.GetTargetPos();
                var lookAtVector   = lookAtPosition - goPosition;
                if (lookAtVector == Vector3.zero)
                {
                    return;
                }
                var lookAtRotation = Quaternion.LookRotation(lookAtVector);

                var handleSize = HandleUtility.GetHandleSize(goPosition);
                var arrowSize  = handleSize * 0.2f;
                var distance   = (lookAtPosition - goPosition).magnitude;

                var goTarget = moveTowardsAction.targetObject.Value;

                // Position handles

                if (!moveTowardsAction.targetPosition.IsNone)
                {
                    if (goTarget != null)
                    {
                        // Edit local offset from target object

                        var goTargetTransform = goTarget.transform;
                        var worldTargetPos    = goTargetTransform.TransformPoint(moveTowardsAction.targetPosition.Value);

                        moveTowardsAction.targetPosition.Value = goTargetTransform.InverseTransformPoint(Handles.PositionHandle(worldTargetPos, goTarget.transform.rotation));
                        Handles.color = new Color(1, 1, 1, 0.2f);
                        Handles.DrawLine(goTargetTransform.position, moveTowardsAction.GetTargetPosWithVertical());
                    }
                    else
                    {
                        // Edit world position

                        moveTowardsAction.targetPosition.Value = Handles.PositionHandle(moveTowardsAction.targetPosition.Value, Quaternion.identity);
                    }
                }

                // Target vector

                Handles.DrawLine(goPosition, lookAtPosition);
                Handles.ConeCap(0, goPosition + lookAtVector.normalized * (distance - arrowSize * 0.7f), lookAtRotation, arrowSize);                 // fudge factor to position cap correctly

                // Show vertical offset

                if (moveTowardsAction.ignoreVertical.Value)
                {
                    Handles.DrawLine(lookAtPosition, moveTowardsAction.GetTargetPosWithVertical());
                }

                if (GUI.changed)
                {
                    FsmEditor.EditingActions();
                    FsmEditor.Repaint(true);
                }
            }
        }
    public override void OnSceneGUI()
    {
        // Live iTween path editing

        var iTween = target as iTweenMoveTo;

        if (iTween == null) // shouldn't happen!
        {
            return;
        }

        var fsm = target.Fsm;

        if (fsm == null) // shouldn't happen!
        {
            return;
        }

        if (iTween.transforms.Length >= 2)
        {
#if UNITY_3_5 || UNITY_4_0 || UNITY_4_0_1 || UNITY_4_2
            Undo.SetSnapshotTarget(target.Owner, Strings.Command_Adjust_iTween_Path);
#else
            Undo.RecordObject(target.Owner, Strings.Command_Adjust_iTween_Path);
#endif
            var tempVct3 = new Vector3[iTween.transforms.Length];
            for (var i = 0; i < iTween.transforms.Length; i++)
            {
                if (iTween.transforms[i].IsNone)
                {
                    tempVct3[i] = iTween.vectors[i].IsNone ? Vector3.zero : iTween.vectors[i].Value;
                }
                else
                {
                    if (iTween.transforms[i].Value == null)
                    {
                        tempVct3[i] = iTween.vectors[i].IsNone ? Vector3.zero : iTween.vectors[i].Value;
                    }
                    else
                    {
                        tempVct3[i] = iTween.transforms[i].Value.transform.position +
                                      (iTween.vectors[i].IsNone ? Vector3.zero : iTween.vectors[i].Value);
                    }
                }
                tempVct3[i] = Handles.PositionHandle(tempVct3[i], Quaternion.identity);
                if (iTween.transforms[i].IsNone)
                {
                    if (!iTween.vectors[i].IsNone)
                    {
                        iTween.vectors[i].Value = tempVct3[i];
                    }
                }
                else
                {
                    if (iTween.transforms[i].Value == null)
                    {
                        if (!iTween.vectors[i].IsNone)
                        {
                            iTween.vectors[i].Value = tempVct3[i];
                        }
                    }
                    else
                    {
                        if (!iTween.vectors[i].IsNone)
                        {
                            iTween.vectors[i] = tempVct3[i] - iTween.transforms[i].Value.transform.position;
                        }
                    }
                }
            }

            Handles.Label(tempVct3[0], string.Format(Strings.iTween_Path_Editing_Label_Begin, fsm.Name));
            Handles.Label(tempVct3[tempVct3.Length - 1], string.Format(Strings.iTween_Path_Editing_Label_End, fsm.Name));

            if (GUI.changed)
            {
                FsmEditor.EditingActions();
                FsmEditor.Repaint(true);
            }
        }
    }