Insanely huge initial commit

This commit is contained in:
2026-02-21 16:40:15 -08:00
parent 208d626100
commit f74c547a13
33825 changed files with 5213498 additions and 0 deletions

View File

@@ -0,0 +1,67 @@
using UnityEngine;
using UnityEditor;
namespace MoreMountains.Tools
{
/// <summary>
/// Custom editor for the MMAutoRotate component
/// </summary>
[CustomEditor(typeof(MMAutoRotate), true)]
[CanEditMultipleObjects]
public class MMAutoRotateEditor : Editor
{
/// <summary>
///
/// </summary>
/// <param name="autoRotate"></param>
/// <param name="gizmoType"></param>
[DrawGizmo(GizmoType.InSelectionHierarchy)]
static void DrawHandles(MMAutoRotate autoRotate, GizmoType gizmoType)
{
MMAutoRotate myTarget = autoRotate;
// only draw gizmos if orbiting and gizmos enabled
if (!myTarget.Orbiting || !myTarget.DrawGizmos)
{
return;
};
// if we're not playing, we compute our center/axis
if (!Application.isPlaying)
{
if (myTarget.OrbitCenterTransform != null)
{
myTarget._orbitCenter = myTarget.OrbitCenterTransform.transform.position + myTarget.OrbitCenterOffset;
myTarget._worldRotationAxis = myTarget.OrbitCenterTransform.TransformDirection(myTarget.OrbitRotationAxis);
myTarget._rotationPlane.SetNormalAndPosition(myTarget._worldRotationAxis.normalized, myTarget._orbitCenter);
myTarget._snappedPosition = myTarget._rotationPlane.ClosestPointOnPlane(myTarget.transform.position);
myTarget._radius = myTarget.OrbitRadius * Vector3.Normalize(myTarget._snappedPosition - myTarget._orbitCenter);
}
}
// draws a plane disc
Handles.color = myTarget.OrbitPlaneColor;
Handles.DrawSolidDisc(myTarget._orbitCenter, myTarget._rotationPlane.normal, myTarget.OrbitRadius + 0.5f);
// draws a circle to mark the orbit
Handles.color = myTarget.OrbitLineColor;
Handles.DrawWireArc(myTarget._orbitCenter, myTarget._rotationPlane.normal, Vector3.ProjectOnPlane(myTarget._orbitCenter + Vector3.forward, myTarget._rotationPlane.normal), 360f, myTarget.OrbitRadius);
// draws an arrow to mark the direction
Quaternion newRotation = Quaternion.AngleAxis(1f, myTarget._worldRotationAxis);
Vector3 origin = myTarget._orbitCenter + newRotation * myTarget._radius;
newRotation = Quaternion.AngleAxis(15f, myTarget._worldRotationAxis);
Vector3 direction = Vector3.zero;
if (myTarget.OrbitRotationSpeed > 0f)
{
direction = (myTarget._orbitCenter + newRotation * myTarget._radius) - origin;
}
else
{
direction = origin - (myTarget._orbitCenter + newRotation * myTarget._radius);
}
MMDebug.DebugDrawArrow(origin, direction, myTarget.OrbitLineColor);
}
}
}

View File

@@ -0,0 +1,11 @@
fileFormatVersion: 2
guid: 9b4bf5a88d386b6428629ffc983eb62c
MonoImporter:
externalObjects: {}
serializedVersion: 2
defaultReferences: []
executionOrder: 0
icon: {instanceID: 0}
userData:
assetBundleName:
assetBundleVariant:

View File

@@ -0,0 +1,8 @@
fileFormatVersion: 2
guid: f3c387a5c035e814eb1a19b914829253
folderAsset: yes
DefaultImporter:
externalObjects: {}
userData:
assetBundleName:
assetBundleVariant:

View File

@@ -0,0 +1,88 @@
#if UNITY_EDITOR
using UnityEngine;
using UnityEditor;
using System.Collections;
namespace MoreMountains.Tools
{
/// <summary>
/// This class adds names for each LevelMapPathElement next to it on the scene view, for easier setup
/// </summary>
[CustomEditor(typeof(MMPath),true)]
[InitializeOnLoad]
public class MMPathEditor : Editor
{
public MMPath pathTarget
{
get
{
return (MMPath)target;
}
}
/// <summary>
/// OnSceneGUI, draws repositionable handles at every point in the path, for easier setup
/// </summary>
protected virtual void OnSceneGUI()
{
Handles.color=Color.green;
MMPath t = (target as MMPath);
if (t.GetOriginalTransformPositionStatus() == false)
{
return;
}
for (int i=0;i<t.PathElements.Count;i++)
{
EditorGUI.BeginChangeCheck();
Vector3 oldPoint = t.GetOriginalTransformPosition()+t.PathElements[i].PathElementPosition;
GUIStyle style = new GUIStyle();
// draws the path item number
style.normal.textColor = Color.yellow;
Handles.Label(t.GetOriginalTransformPosition()+t.PathElements[i].PathElementPosition+(Vector3.down*0.4f)+(Vector3.right*0.4f), ""+i,style);
// draws a movable handle
Vector3 newPoint = Handles.FreeMoveHandle(oldPoint, Quaternion.identity,.5f,new Vector3(.25f,.25f,.25f),Handles.CircleHandleCap);
newPoint = ApplyAxisLock(oldPoint, newPoint);
// records changes
if (EditorGUI.EndChangeCheck())
{
Undo.RecordObject(target, "Free Move Handle");
t.PathElements[i].PathElementPosition = newPoint - t.GetOriginalTransformPosition();
}
}
}
/// <summary>
/// Locks handles movement on x, y, or z axis
/// </summary>
/// <param name="oldPoint"></param>
/// <param name="newPoint"></param>
/// <returns></returns>
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

View File

@@ -0,0 +1,11 @@
fileFormatVersion: 2
guid: d103290728e03b448829fc4b58e285ac
MonoImporter:
externalObjects: {}
serializedVersion: 2
defaultReferences: []
executionOrder: 0
icon: {instanceID: 0}
userData:
assetBundleName:
assetBundleVariant:

View File

@@ -0,0 +1,78 @@
#if UNITY_EDITOR
using UnityEngine;
using UnityEditor;
using System.Collections;
namespace MoreMountains.Tools
{
/// <summary>
/// This class adds names for each LevelMapPathElement next to it on the scene view, for easier setup
/// </summary>
[CustomEditor(typeof(MMPathMovement),true)]
[InitializeOnLoad]
public class MMPathMovementEditor : Editor
{
public MMPathMovement pathMovementTarget
{
get
{
return (MMPathMovement)target;
}
}
public override void OnInspectorGUI()
{
serializedObject.Update ();
if (pathMovementTarget.AccelerationType == MMPathMovement.PossibleAccelerationType.AnimationCurve)
{
DrawDefaultInspector ();
}
else
{
Editor.DrawPropertiesExcluding (serializedObject, new string [] { "Acceleration" });
}
serializedObject.ApplyModifiedProperties ();
}
/// <summary>
/// OnSceneGUI, draws repositionable handles at every point in the path, for easier setup
/// </summary>
protected virtual void OnSceneGUI()
{
Handles.color = Color.green;
MMPathMovement t = (target as MMPathMovement);
if (t.GetOriginalTransformPositionStatus() == false)
{
return;
}
for (int i=0;i<t.PathElements.Count;i++)
{
EditorGUI.BeginChangeCheck();
Vector3 oldPoint = t.PointPosition(i);
GUIStyle style = new GUIStyle();
// draws the path item number
style.normal.textColor = Color.yellow;
Handles.Label(t.PointPosition(i) + (Vector3.down*0.4f) + (Vector3.right*0.4f), ""+i,style);
// draws a movable handle
Vector3 newPoint = Handles.FreeMoveHandle(oldPoint, Quaternion.identity,.5f,new Vector3(.25f,.25f,.25f),Handles.CircleHandleCap);
// records changes
if (EditorGUI.EndChangeCheck())
{
Undo.RecordObject(target, "Free Move Handle");
t.PathElements[i].PathElementPosition = newPoint - t.GetOriginalTransformPosition();
}
}
}
}
}
#endif

View File

@@ -0,0 +1,13 @@
fileFormatVersion: 2
guid: 80063623289ee3e49b584d00f3a90a32
timeCreated: 1523894192
licenseType: Store
MonoImporter:
externalObjects: {}
serializedVersion: 2
defaultReferences: []
executionOrder: 0
icon: {instanceID: 0}
userData:
assetBundleName:
assetBundleVariant: