#if UNITY_EDITOR
using UnityEngine;
using UnityEditor;
using System.Collections;
namespace MoreMountains.Tools
{
///
/// This class adds names for each LevelMapPathElement next to it on the scene view, for easier setup
///
[CustomEditor(typeof(MMPath),true)]
[InitializeOnLoad]
public class MMPathEditor : Editor
{
public MMPath pathTarget
{
get
{
return (MMPath)target;
}
}
///
/// OnSceneGUI, draws repositionable handles at every point in the path, for easier setup
///
protected virtual void OnSceneGUI()
{
Handles.color=Color.green;
MMPath t = (target as MMPath);
if (t.GetOriginalTransformPositionStatus() == false)
{
return;
}
for (int i=0;i
/// Locks handles movement on x, y, or z axis
///
///
///
///
protected virtual Vector3 ApplyAxisLock(Vector3 oldPoint, Vector3 newPoint)
{
MMPath t = (target as MMPath);
if (t.LockHandlesOnXAxis)
{
newPoint.x = oldPoint.x;
}
if (t.LockHandlesOnYAxis)
{
newPoint.y = oldPoint.y;
}
if (t.LockHandlesOnZAxis)
{
newPoint.z = oldPoint.z;
}
return newPoint;
}
}
}
#endif