Installed Surge, fixed compile errors, moved a bunch of external stuff into folder

This commit is contained in:
2025-09-10 10:53:04 +02:00
parent a3649c65b0
commit 52bd7ef585
433 changed files with 10589 additions and 4 deletions

View File

@@ -0,0 +1,82 @@
/// <summary>
/// SURGE FRAMEWORK
/// Author: Bob Berkebile
/// Email: bobb@pixelplacement.com
///
/// Custom inspector for the State class.
///
/// </summary>
using UnityEngine;
using System.Collections;
using UnityEditor;
namespace Pixelplacement
{
[CustomEditor (typeof (State), true)]
public class StateEditor : UnityEditor.Editor
{
//Private Variables:
State _target;
//Init:
void OnEnable()
{
_target = target as State;
}
//Inspector GUI:
public override void OnInspectorGUI()
{
DrawDefaultInspector ();
if (!Application.isPlaying)
{
GUILayout.BeginHorizontal();
DrawSoloButton();
DrawHideAllButton();
GUILayout.EndHorizontal();
}
else
{
DrawChangeStateButton();
}
}
//GUI Draw Methods:
void DrawChangeStateButton ()
{
GUI.color = Color.green;
if (GUILayout.Button("Change State"))
{
_target.ChangeState(_target.gameObject);
}
}
void DrawHideAllButton ()
{
GUI.color = Color.red;
if (GUILayout.Button ("Hide All"))
{
Undo.RegisterCompleteObjectUndo (_target.transform.parent.transform, "Hide All");
foreach (Transform item in _target.transform.parent.transform)
{
item.gameObject.SetActive (false);
}
}
}
void DrawSoloButton ()
{
GUI.color = Color.green;
if (GUILayout.Button ("Solo"))
{
foreach (Transform item in _target.transform.parent.transform)
{
if (item != _target.transform) item.gameObject.SetActive (false);
Undo.RegisterCompleteObjectUndo (_target, "Solo");
_target.gameObject.SetActive (true);
}
}
}
}
}

View File

@@ -0,0 +1,19 @@
fileFormatVersion: 2
guid: 2c7a5df70e8f545d3b4898af06994a20
timeCreated: 1444835269
licenseType: Store
MonoImporter:
serializedVersion: 2
defaultReferences: []
executionOrder: 0
icon: {instanceID: 0}
userData:
assetBundleName:
assetBundleVariant:
AssetOrigin:
serializedVersion: 1
productId: 107312
packageName: Surge
packageVersion: 1.0.48
assetPath: Assets/Pixelplacement/Surge/StateMachine/Editor/StateEditor.cs
uploadId: 467433

View File

@@ -0,0 +1,136 @@
/// <summary>
/// SURGE FRAMEWORK
/// Author: Bob Berkebile
/// Email: bobb@pixelplacement.com
///
/// Custom inspector for the StateMachine class.
///
/// </summary>
using UnityEngine;
using System.Collections;
using System.Collections.Generic;
using UnityEditor;
namespace Pixelplacement
{
[CustomEditor (typeof (StateMachine), true)]
public class StateMachineEditor : UnityEditor.Editor
{
//Private Variables:
StateMachine _target;
//Init:
void OnEnable()
{
_target = target as StateMachine;
}
//Inspector GUI:
public override void OnInspectorGUI()
{
//if no states are found:
if (_target.transform.childCount == 0)
{
DrawNotification("Add child Gameobjects for this State Machine to control.", Color.yellow);
return;
}
//change buttons:
if (EditorApplication.isPlaying)
{
DrawStateChangeButtons();
}
serializedObject.Update();
DrawPropertiesExcluding(serializedObject, new string[] {
"currentState",
"_unityEventsFolded",
"defaultState",
"verbose",
"allowReentry",
"returnToDefaultOnDisable",
"Unity Events",
"OnStateExited",
"OnStateEntered",
"OnFirstStateEntered",
"OnFirstStateExited",
"OnLastStateEntered",
"OnLastStateExited"
});
EditorGUILayout.PropertyField(serializedObject.FindProperty("defaultState"));
EditorGUILayout.PropertyField(serializedObject.FindProperty("verbose"));
EditorGUILayout.PropertyField(serializedObject.FindProperty("allowReentry"));
EditorGUILayout.PropertyField(serializedObject.FindProperty("returnToDefaultOnDisable"));
//fold events:
_target._unityEventsFolded = EditorGUILayout.Foldout(_target._unityEventsFolded, "Unity Events", true);
if (_target._unityEventsFolded)
{
EditorGUILayout.PropertyField(serializedObject.FindProperty("OnStateExited"));
EditorGUILayout.PropertyField(serializedObject.FindProperty("OnStateEntered"));
EditorGUILayout.PropertyField(serializedObject.FindProperty("OnFirstStateEntered"));
EditorGUILayout.PropertyField(serializedObject.FindProperty("OnFirstStateExited"));
EditorGUILayout.PropertyField(serializedObject.FindProperty("OnLastStateEntered"));
EditorGUILayout.PropertyField(serializedObject.FindProperty("OnLastStateExited"));
}
serializedObject.ApplyModifiedProperties();
if (!EditorApplication.isPlaying)
{
DrawHideAllButton();
}
}
//GUI Draw Methods:
void DrawStateChangeButtons()
{
if (_target.transform.childCount == 0) return;
Color currentColor = GUI.color;
for (int i = 0; i < _target.transform.childCount; i++)
{
GameObject current = _target.transform.GetChild(i).gameObject;
if (_target.currentState != null && current == _target.currentState)
{
GUI.color = Color.green;
}
else
{
GUI.color = Color.white;
}
if (GUILayout.Button(current.name)) _target.ChangeState(current);
}
GUI.color = currentColor;
if (GUILayout.Button("Exit")) _target.Exit();
}
void DrawHideAllButton()
{
GUI.color = Color.red;
GUILayout.BeginHorizontal();
if (GUILayout.Button("Hide All"))
{
Undo.RegisterCompleteObjectUndo(_target.transform, "Hide All");
foreach (Transform item in _target.transform)
{
item.gameObject.SetActive(false);
}
}
GUILayout.EndHorizontal();
GUI.color = Color.white;
}
void DrawNotification(string message, Color color)
{
Color currentColor = GUI.color;
GUI.color = color;
EditorGUILayout.HelpBox(message, MessageType.Warning);
GUI.color = currentColor;
}
}
}

View File

@@ -0,0 +1,19 @@
fileFormatVersion: 2
guid: 422f5854a358c4431b43cb2db1db4a50
timeCreated: 1444835081
licenseType: Store
MonoImporter:
serializedVersion: 2
defaultReferences: []
executionOrder: 0
icon: {instanceID: 0}
userData:
assetBundleName:
assetBundleVariant:
AssetOrigin:
serializedVersion: 1
productId: 107312
packageName: Surge
packageVersion: 1.0.48
assetPath: Assets/Pixelplacement/Surge/StateMachine/Editor/StateMachineEditor.cs
uploadId: 467433