Installed Surge, fixed compile errors, moved a bunch of external stuff into folder
This commit is contained in:
82
Assets/External/Pixelplacement/Surge/StateMachine/Editor/StateEditor.cs
vendored
Normal file
82
Assets/External/Pixelplacement/Surge/StateMachine/Editor/StateEditor.cs
vendored
Normal 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);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
19
Assets/External/Pixelplacement/Surge/StateMachine/Editor/StateEditor.cs.meta
vendored
Normal file
19
Assets/External/Pixelplacement/Surge/StateMachine/Editor/StateEditor.cs.meta
vendored
Normal 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
|
||||
136
Assets/External/Pixelplacement/Surge/StateMachine/Editor/StateMachineEditor.cs
vendored
Normal file
136
Assets/External/Pixelplacement/Surge/StateMachine/Editor/StateMachineEditor.cs
vendored
Normal 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;
|
||||
}
|
||||
}
|
||||
}
|
||||
19
Assets/External/Pixelplacement/Surge/StateMachine/Editor/StateMachineEditor.cs.meta
vendored
Normal file
19
Assets/External/Pixelplacement/Surge/StateMachine/Editor/StateMachineEditor.cs.meta
vendored
Normal 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
|
||||
Reference in New Issue
Block a user