Installed Surge, fixed compile errors, moved a bunch of external stuff into folder
This commit is contained in:
8
Assets/External/Pixelplacement/Surge.meta
vendored
Normal file
8
Assets/External/Pixelplacement/Surge.meta
vendored
Normal file
@@ -0,0 +1,8 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 02046d5fdbe21b6438050c1580fc45dc
|
||||
folderAsset: yes
|
||||
DefaultImporter:
|
||||
externalObjects: {}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
9
Assets/External/Pixelplacement/Surge/Chooser.meta
vendored
Normal file
9
Assets/External/Pixelplacement/Surge/Chooser.meta
vendored
Normal file
@@ -0,0 +1,9 @@
|
||||
fileFormatVersion: 2
|
||||
guid: dfe31349ba782e74790b285d1a724204
|
||||
folderAsset: yes
|
||||
timeCreated: 1521832879
|
||||
licenseType: Store
|
||||
DefaultImporter:
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
412
Assets/External/Pixelplacement/Surge/Chooser/Chooser.cs
vendored
Normal file
412
Assets/External/Pixelplacement/Surge/Chooser/Chooser.cs
vendored
Normal file
@@ -0,0 +1,412 @@
|
||||
/// <summary>
|
||||
/// SURGE FRAMEWORK
|
||||
/// Author: Bob Berkebile
|
||||
/// Email: bobb@pixelplacement.com
|
||||
///
|
||||
/// Simplify the act of selecting and interacting with things.
|
||||
///
|
||||
/// </summary>
|
||||
|
||||
#pragma warning disable 0649
|
||||
|
||||
using System.Collections.Generic;
|
||||
using UnityEngine;
|
||||
using UnityEngine.Events;
|
||||
|
||||
namespace Pixelplacement
|
||||
{
|
||||
public class Chooser : MonoBehaviour
|
||||
{
|
||||
//Public Events:
|
||||
public GameObjectEvent OnSelected;
|
||||
public GameObjectEvent OnDeselected;
|
||||
public GameObjectEvent OnPressed;
|
||||
public GameObjectEvent OnReleased;
|
||||
|
||||
//Public Enums:
|
||||
public enum Method { Raycast, RaycastAll };
|
||||
|
||||
//Public Variables:
|
||||
public bool _cursorPropertiesFolded;
|
||||
public bool _unityEventsFolded;
|
||||
public Transform source;
|
||||
public float raycastDistance = 3;
|
||||
public LayerMask layermask = -1;
|
||||
public KeyCode[] pressedInput;
|
||||
public Transform cursor;
|
||||
public float surfaceOffset;
|
||||
public float idleDistance = 3f;
|
||||
public float stabilityDelta = 0.0127f;
|
||||
public float snapDelta = 1;
|
||||
public float stableSpeed = 2;
|
||||
public float unstableSpeed = 20;
|
||||
public bool flipForward;
|
||||
public bool matchSurfaceNormal = true;
|
||||
public bool autoHide;
|
||||
public bool cursorHidden;
|
||||
public bool flipCastDirection;
|
||||
public LineRenderer lineRenderer;
|
||||
|
||||
//Public Properties:
|
||||
public Transform[] Current
|
||||
{
|
||||
get
|
||||
{
|
||||
return _current.ToArray();
|
||||
}
|
||||
}
|
||||
|
||||
public bool IsHitting
|
||||
{
|
||||
get;
|
||||
private set;
|
||||
}
|
||||
|
||||
//Private Variables:
|
||||
[SerializeField] Method _method;
|
||||
[SerializeField] bool _debugView = false;
|
||||
Transform _previousCursor;
|
||||
List<Transform> _current = new List<Transform>();
|
||||
List<Transform> _previous = new List<Transform>();
|
||||
Transform _currentRaycast;
|
||||
Transform _previousRaycast;
|
||||
Vector3 _targetPosition;
|
||||
bool _hidden;
|
||||
|
||||
//Init:
|
||||
private void Reset()
|
||||
{
|
||||
source = transform;
|
||||
pressedInput = new KeyCode[] { KeyCode.Mouse0 };
|
||||
}
|
||||
|
||||
//Flow:
|
||||
private void OnEnable()
|
||||
{
|
||||
if (source == null)
|
||||
{
|
||||
source = transform;
|
||||
}
|
||||
|
||||
if (cursor != null)
|
||||
{
|
||||
cursor.position = source.position;
|
||||
cursor.gameObject.SetActive(true);
|
||||
}
|
||||
if (lineRenderer != null)
|
||||
{
|
||||
lineRenderer.positionCount = 0;
|
||||
lineRenderer.enabled = true;
|
||||
}
|
||||
}
|
||||
|
||||
private void OnDisable()
|
||||
{
|
||||
if (cursor != null) cursor.gameObject.SetActive(false);
|
||||
if (lineRenderer != null) lineRenderer.enabled = false;
|
||||
}
|
||||
|
||||
//Gizmos:
|
||||
private void OnDrawGizmosSelected()
|
||||
{
|
||||
if (Application.isPlaying) return;
|
||||
|
||||
Vector3 castDirection = source.forward;
|
||||
if (flipCastDirection) castDirection *= -1;
|
||||
Gizmos.color = Color.green;
|
||||
Gizmos.DrawRay(source.position, castDirection * raycastDistance);
|
||||
|
||||
if (cursor != null)
|
||||
{
|
||||
Gizmos.color = Color.yellow;
|
||||
Gizmos.DrawLine(source.position, cursor.position);
|
||||
}
|
||||
}
|
||||
|
||||
//Public Methods:
|
||||
public void Pressed()
|
||||
{
|
||||
switch (_method)
|
||||
{
|
||||
case Method.Raycast:
|
||||
if (_currentRaycast != null)
|
||||
{
|
||||
_currentRaycast.SendMessage("Pressed", SendMessageOptions.DontRequireReceiver);
|
||||
if (OnPressed != null) OnPressed.Invoke(_currentRaycast.gameObject);
|
||||
}
|
||||
break;
|
||||
|
||||
case Method.RaycastAll:
|
||||
if (_current.Count > 0)
|
||||
{
|
||||
foreach (var item in _current)
|
||||
{
|
||||
item.SendMessage("Pressed", SendMessageOptions.DontRequireReceiver);
|
||||
if (OnPressed != null) OnPressed.Invoke(item.gameObject);
|
||||
}
|
||||
}
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
public void Released()
|
||||
{
|
||||
switch (_method)
|
||||
{
|
||||
case Method.Raycast:
|
||||
if (_currentRaycast != null)
|
||||
{
|
||||
_currentRaycast.SendMessage("Released", SendMessageOptions.DontRequireReceiver);
|
||||
if (OnReleased != null) OnReleased.Invoke(_currentRaycast.gameObject);
|
||||
}
|
||||
break;
|
||||
|
||||
case Method.RaycastAll:
|
||||
if (_current.Count > 0)
|
||||
{
|
||||
foreach (var item in _current)
|
||||
{
|
||||
item.SendMessage("Released", SendMessageOptions.DontRequireReceiver);
|
||||
if (OnReleased != null) OnReleased.Invoke(item.gameObject);
|
||||
}
|
||||
}
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
//Loops:
|
||||
private void Update()
|
||||
{
|
||||
//cursor setup:
|
||||
if (cursor != _previousCursor)
|
||||
{
|
||||
_previousCursor = cursor;
|
||||
if (cursor == null) return;
|
||||
|
||||
foreach (var item in cursor.GetComponentsInChildren<Collider>())
|
||||
{
|
||||
Debug.Log("Cursor can not contain colliders. Disabling colliders on: " + item.name);
|
||||
item.enabled = false;
|
||||
}
|
||||
}
|
||||
|
||||
//process input:
|
||||
if (pressedInput != null)
|
||||
{
|
||||
foreach (var item in pressedInput)
|
||||
{
|
||||
/* if (Input.GetKeyDown(item))
|
||||
{
|
||||
Pressed();
|
||||
}
|
||||
|
||||
if (Input.GetKeyUp(item))
|
||||
{
|
||||
Released();
|
||||
} */
|
||||
}
|
||||
}
|
||||
|
||||
//clear out:
|
||||
_current.Clear();
|
||||
|
||||
//raycast:
|
||||
RaycastHit hit;
|
||||
Vector3 castDirection = source.forward;
|
||||
if (flipCastDirection) castDirection *= -1;
|
||||
Physics.Raycast(source.position, castDirection, out hit, raycastDistance, layermask);
|
||||
_currentRaycast = hit.transform;
|
||||
IsHitting = hit.transform != null;
|
||||
|
||||
//cache:
|
||||
if (_method == Method.Raycast && IsHitting)
|
||||
{
|
||||
_current.Clear();
|
||||
_current.Add(hit.transform);
|
||||
}
|
||||
|
||||
//debug info:
|
||||
if (_debugView)
|
||||
{
|
||||
if (hit.transform != null)
|
||||
{
|
||||
Debug.DrawLine(source.position, hit.point, Color.green);
|
||||
}
|
||||
else
|
||||
{
|
||||
Debug.DrawRay(source.position, castDirection * raycastDistance, Color.red);
|
||||
}
|
||||
}
|
||||
|
||||
//cursor visibility:
|
||||
if (cursor != null)
|
||||
{
|
||||
if (cursorHidden)
|
||||
{
|
||||
cursor.gameObject.SetActive(false);
|
||||
}
|
||||
else
|
||||
{
|
||||
if (autoHide)
|
||||
{
|
||||
cursor.gameObject.SetActive(IsHitting);
|
||||
if (lineRenderer != null) lineRenderer.enabled = IsHitting;
|
||||
}
|
||||
else
|
||||
{
|
||||
cursor.gameObject.SetActive(true);
|
||||
if (lineRenderer != null) lineRenderer.enabled = true;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
//cursor management:
|
||||
if (cursor != null)
|
||||
{
|
||||
if (hit.transform != null)
|
||||
{
|
||||
//get position:
|
||||
_targetPosition = hit.point + hit.normal * surfaceOffset;
|
||||
|
||||
//get position speed:
|
||||
float posSpeed = unstableSpeed;
|
||||
float delta = Vector3.Distance(_targetPosition, cursor.position);
|
||||
if (delta <= stabilityDelta)
|
||||
{
|
||||
posSpeed = stableSpeed;
|
||||
}
|
||||
|
||||
if (delta >= snapDelta)
|
||||
{
|
||||
cursor.position = _targetPosition;
|
||||
}
|
||||
else
|
||||
{
|
||||
cursor.position = Vector3.Lerp(cursor.position, _targetPosition, Time.unscaledDeltaTime * posSpeed);
|
||||
}
|
||||
|
||||
//set rotation:
|
||||
if (matchSurfaceNormal)
|
||||
{
|
||||
cursor.rotation = Quaternion.LookRotation(hit.normal, source.up);
|
||||
}
|
||||
else
|
||||
{
|
||||
cursor.LookAt(source, Vector3.up);
|
||||
}
|
||||
|
||||
//adjust:
|
||||
if (flipForward)
|
||||
{
|
||||
cursor.Rotate(Vector3.up * 180);
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
//put out in front and face source (flip if needed):
|
||||
Vector3 inFront = source.position + castDirection * idleDistance;
|
||||
float delta = Vector3.Distance(inFront, cursor.position);
|
||||
float posSpeed = unstableSpeed;
|
||||
|
||||
if (delta <= stabilityDelta)
|
||||
{
|
||||
posSpeed = stableSpeed;
|
||||
}
|
||||
|
||||
if (delta >= snapDelta)
|
||||
{
|
||||
cursor.position = inFront;
|
||||
}
|
||||
else
|
||||
{
|
||||
cursor.position = Vector3.Lerp(cursor.position, inFront, Time.unscaledDeltaTime * posSpeed);
|
||||
}
|
||||
|
||||
cursor.LookAt(source.position);
|
||||
if (flipForward)
|
||||
{
|
||||
cursor.Rotate(Vector3.up * 180);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
//handle raycast messages:
|
||||
if (_method == Method.Raycast)
|
||||
{
|
||||
//select:
|
||||
if (_previousRaycast == null && hit.transform != null)
|
||||
{
|
||||
hit.transform.SendMessage("Selected", SendMessageOptions.DontRequireReceiver);
|
||||
if (OnSelected != null) OnSelected.Invoke(hit.transform.gameObject);
|
||||
}
|
||||
|
||||
//updated select:
|
||||
if (hit.transform != null && _previousRaycast != null && _previousRaycast != hit.transform)
|
||||
{
|
||||
_previousRaycast.SendMessage("Deselected", SendMessageOptions.DontRequireReceiver);
|
||||
if (OnDeselected != null) OnDeselected.Invoke(_previousRaycast.gameObject);
|
||||
hit.transform.SendMessage("Selected", SendMessageOptions.DontRequireReceiver);
|
||||
if (OnSelected != null) OnSelected.Invoke(hit.transform.gameObject);
|
||||
}
|
||||
|
||||
//deselect:
|
||||
if (_previousRaycast != null && hit.transform == null)
|
||||
{
|
||||
_previousRaycast.SendMessage("Deselected", SendMessageOptions.DontRequireReceiver);
|
||||
if (OnDeselected != null) OnDeselected.Invoke(_previousRaycast.gameObject);
|
||||
}
|
||||
|
||||
//cache:
|
||||
_previousRaycast = hit.transform;
|
||||
}
|
||||
|
||||
//raycast all:
|
||||
if (_method == Method.RaycastAll)
|
||||
{
|
||||
//catalog:
|
||||
foreach (var item in Physics.RaycastAll(source.position, castDirection, raycastDistance, layermask))
|
||||
{
|
||||
_current.Add(item.transform);
|
||||
}
|
||||
|
||||
//handle selects:
|
||||
if (_current.Count > 0)
|
||||
{
|
||||
foreach (var item in _current)
|
||||
{
|
||||
if (_previous.Count == 0 || !_previous.Contains(item))
|
||||
{
|
||||
item.SendMessage("Selected", SendMessageOptions.DontRequireReceiver);
|
||||
if (OnSelected != null) OnSelected.Invoke(item.gameObject);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
//handle deselects:
|
||||
if (_previous.Count > 0)
|
||||
{
|
||||
foreach (var item in _previous)
|
||||
{
|
||||
if (_current.Count == 0 || !_current.Contains(item))
|
||||
{
|
||||
item.SendMessage("Deselected", SendMessageOptions.DontRequireReceiver);
|
||||
if (OnDeselected != null) OnDeselected.Invoke(item.gameObject);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
//cache:
|
||||
_previous.Clear();
|
||||
_previous.AddRange(_current);
|
||||
}
|
||||
|
||||
//line renderer:
|
||||
if (cursor != null && cursor.gameObject.activeSelf && lineRenderer != null )
|
||||
{
|
||||
if (lineRenderer.positionCount != 2) lineRenderer.positionCount = 2;
|
||||
lineRenderer.SetPosition(0, source.position);
|
||||
lineRenderer.SetPosition(1, cursor.position);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
20
Assets/External/Pixelplacement/Surge/Chooser/Chooser.cs.meta
vendored
Normal file
20
Assets/External/Pixelplacement/Surge/Chooser/Chooser.cs.meta
vendored
Normal file
@@ -0,0 +1,20 @@
|
||||
fileFormatVersion: 2
|
||||
guid: db04a89df0755a04cb9d5f03bb62b19d
|
||||
timeCreated: 1521224863
|
||||
licenseType: Store
|
||||
MonoImporter:
|
||||
externalObjects: {}
|
||||
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/Chooser/Chooser.cs
|
||||
uploadId: 467433
|
||||
9
Assets/External/Pixelplacement/Surge/Chooser/Editor.meta
vendored
Normal file
9
Assets/External/Pixelplacement/Surge/Chooser/Editor.meta
vendored
Normal file
@@ -0,0 +1,9 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 0d863bca9b2680743bd08a98ae378772
|
||||
folderAsset: yes
|
||||
timeCreated: 1522266281
|
||||
licenseType: Store
|
||||
DefaultImporter:
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
106
Assets/External/Pixelplacement/Surge/Chooser/Editor/ChooserEditor.cs
vendored
Normal file
106
Assets/External/Pixelplacement/Surge/Chooser/Editor/ChooserEditor.cs
vendored
Normal file
@@ -0,0 +1,106 @@
|
||||
/// <summary>
|
||||
/// SURGE FRAMEWORK
|
||||
/// Author: Bob Berkebile
|
||||
/// Email: bobb@pixelplacement.com
|
||||
///
|
||||
/// Custom inspector Chooser.
|
||||
///
|
||||
/// </summary>
|
||||
|
||||
using System.Collections;
|
||||
using System.Collections.Generic;
|
||||
using UnityEngine;
|
||||
using UnityEditor;
|
||||
|
||||
namespace Pixelplacement
|
||||
{
|
||||
[CustomEditor(typeof(Chooser), true)]
|
||||
[CanEditMultipleObjects]
|
||||
public class ChooserEditor : UnityEditor.Editor
|
||||
{
|
||||
//Private Variables:
|
||||
Chooser _target;
|
||||
|
||||
//Flow:
|
||||
void OnEnable()
|
||||
{
|
||||
_target = target as Chooser;
|
||||
}
|
||||
|
||||
//Inspector GUI:
|
||||
public override void OnInspectorGUI()
|
||||
{
|
||||
serializedObject.Update();
|
||||
|
||||
DrawPropertiesExcluding(serializedObject, new string[] {
|
||||
"OnSelected",
|
||||
"OnDeselected",
|
||||
"OnPressed",
|
||||
"OnReleased",
|
||||
"_cursorPropertiesFolded",
|
||||
"_unityEventsFolded",
|
||||
"source",
|
||||
"raycastDistance",
|
||||
"layermask",
|
||||
"pressedInput",
|
||||
"cursor",
|
||||
"surfaceOffset",
|
||||
"idleDistance",
|
||||
"stabilityDelta",
|
||||
"snapDelta",
|
||||
"stableSpeed",
|
||||
"unstableSpeed",
|
||||
"flipForward",
|
||||
"matchSurfaceNormal",
|
||||
"autoHide",
|
||||
"cursorHidden",
|
||||
"flipCastDirection",
|
||||
"lineRenderer",
|
||||
"_debugView",
|
||||
"_method"
|
||||
});
|
||||
|
||||
EditorGUILayout.PropertyField(serializedObject.FindProperty("source"));
|
||||
EditorGUILayout.PropertyField(serializedObject.FindProperty("raycastDistance"));
|
||||
EditorGUILayout.PropertyField(serializedObject.FindProperty("flipCastDirection"));
|
||||
EditorGUILayout.PropertyField(serializedObject.FindProperty("layermask"));
|
||||
EditorGUILayout.PropertyField(serializedObject.FindProperty("_method"));
|
||||
EditorGUILayout.PropertyField(serializedObject.FindProperty("_debugView"));
|
||||
EditorGUILayout.PropertyField(serializedObject.FindProperty("pressedInput"), true);
|
||||
|
||||
_target._cursorPropertiesFolded = EditorGUILayout.Foldout(_target._cursorPropertiesFolded, "Cursor Properties", true);
|
||||
if (_target._cursorPropertiesFolded)
|
||||
{
|
||||
EditorGUI.indentLevel = 1;
|
||||
EditorGUILayout.PropertyField(serializedObject.FindProperty("cursor"));
|
||||
GUI.enabled = _target.cursor != null;
|
||||
EditorGUILayout.PropertyField(serializedObject.FindProperty("cursorHidden"));
|
||||
EditorGUILayout.PropertyField(serializedObject.FindProperty("lineRenderer"));
|
||||
EditorGUILayout.PropertyField(serializedObject.FindProperty("surfaceOffset"));
|
||||
EditorGUILayout.PropertyField(serializedObject.FindProperty("idleDistance"));
|
||||
EditorGUILayout.PropertyField(serializedObject.FindProperty("stabilityDelta"));
|
||||
EditorGUILayout.PropertyField(serializedObject.FindProperty("snapDelta"));
|
||||
EditorGUILayout.PropertyField(serializedObject.FindProperty("stableSpeed"));
|
||||
EditorGUILayout.PropertyField(serializedObject.FindProperty("unstableSpeed"));
|
||||
EditorGUILayout.PropertyField(serializedObject.FindProperty("flipForward"));
|
||||
EditorGUILayout.PropertyField(serializedObject.FindProperty("matchSurfaceNormal"));
|
||||
EditorGUILayout.PropertyField(serializedObject.FindProperty("autoHide"));
|
||||
EditorGUI.indentLevel = 0;
|
||||
GUI.enabled = true;
|
||||
EditorGUILayout.Space();
|
||||
}
|
||||
|
||||
_target._unityEventsFolded = EditorGUILayout.Foldout(_target._unityEventsFolded, "Unity Events", true);
|
||||
if (_target._unityEventsFolded)
|
||||
{
|
||||
EditorGUILayout.PropertyField(serializedObject.FindProperty("OnSelected"));
|
||||
EditorGUILayout.PropertyField(serializedObject.FindProperty("OnPressed"));
|
||||
EditorGUILayout.PropertyField(serializedObject.FindProperty("OnReleased"));
|
||||
EditorGUILayout.PropertyField(serializedObject.FindProperty("OnDeselected"));
|
||||
EditorGUILayout.Space();
|
||||
}
|
||||
|
||||
serializedObject.ApplyModifiedProperties();
|
||||
}
|
||||
}
|
||||
}
|
||||
19
Assets/External/Pixelplacement/Surge/Chooser/Editor/ChooserEditor.cs.meta
vendored
Normal file
19
Assets/External/Pixelplacement/Surge/Chooser/Editor/ChooserEditor.cs.meta
vendored
Normal file
@@ -0,0 +1,19 @@
|
||||
fileFormatVersion: 2
|
||||
guid: ad17b9c71d7903743aa42f462c8826fb
|
||||
timeCreated: 1522266293
|
||||
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/Chooser/Editor/ChooserEditor.cs
|
||||
uploadId: 467433
|
||||
9
Assets/External/Pixelplacement/Surge/Chooser/Interfaces.meta
vendored
Normal file
9
Assets/External/Pixelplacement/Surge/Chooser/Interfaces.meta
vendored
Normal file
@@ -0,0 +1,9 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 5e72ba21481229f4d94aad43a786efae
|
||||
folderAsset: yes
|
||||
timeCreated: 1524507533
|
||||
licenseType: Store
|
||||
DefaultImporter:
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
10
Assets/External/Pixelplacement/Surge/Chooser/Interfaces/IChooser.cs
vendored
Normal file
10
Assets/External/Pixelplacement/Surge/Chooser/Interfaces/IChooser.cs
vendored
Normal file
@@ -0,0 +1,10 @@
|
||||
namespace Pixelplacement
|
||||
{
|
||||
interface IChooser
|
||||
{
|
||||
void Selected();
|
||||
void Deselected();
|
||||
void Pressed();
|
||||
void Released();
|
||||
}
|
||||
}
|
||||
19
Assets/External/Pixelplacement/Surge/Chooser/Interfaces/IChooser.cs.meta
vendored
Normal file
19
Assets/External/Pixelplacement/Surge/Chooser/Interfaces/IChooser.cs.meta
vendored
Normal file
@@ -0,0 +1,19 @@
|
||||
fileFormatVersion: 2
|
||||
guid: fbf5a06b4e893814c8820c3be2ddcb66
|
||||
timeCreated: 1524507546
|
||||
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/Chooser/Interfaces/IChooser.cs
|
||||
uploadId: 467433
|
||||
9
Assets/External/Pixelplacement/Surge/ColliderButton.meta
vendored
Normal file
9
Assets/External/Pixelplacement/Surge/ColliderButton.meta
vendored
Normal file
@@ -0,0 +1,9 @@
|
||||
fileFormatVersion: 2
|
||||
guid: f3f82fb6566d9794596b84cdda70c461
|
||||
folderAsset: yes
|
||||
timeCreated: 1521855968
|
||||
licenseType: Store
|
||||
DefaultImporter:
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
608
Assets/External/Pixelplacement/Surge/ColliderButton/ColliderButton.cs
vendored
Normal file
608
Assets/External/Pixelplacement/Surge/ColliderButton/ColliderButton.cs
vendored
Normal file
@@ -0,0 +1,608 @@
|
||||
/// <summary>
|
||||
/// SURGE FRAMEWORK
|
||||
/// Author: Bob Berkebile
|
||||
/// Email: bobb@pixelplacement.com
|
||||
///
|
||||
/// Simple system for turning anything into a button.
|
||||
///
|
||||
/// </summary>
|
||||
|
||||
using UnityEngine;
|
||||
using UnityEngine.UI;
|
||||
using UnityEngine.Events;
|
||||
using UnityEngine.EventSystems;
|
||||
using System;
|
||||
using Pixelplacement.TweenSystem;
|
||||
#if UNITY_2017_2_OR_NEWER
|
||||
using UnityEngine.XR;
|
||||
#else
|
||||
using UnityEngine.VR;
|
||||
#endif
|
||||
|
||||
namespace Pixelplacement
|
||||
{
|
||||
[RequireComponent(typeof(Collider))]
|
||||
[RequireComponent(typeof(Rigidbody))]
|
||||
[ExecuteInEditMode]
|
||||
public sealed class ColliderButton : MonoBehaviour
|
||||
{
|
||||
//Public Events:
|
||||
public ColliderButtonEvent OnSelected;
|
||||
public ColliderButtonEvent OnDeselected;
|
||||
public ColliderButtonEvent OnClick;
|
||||
public ColliderButtonEvent OnPressed;
|
||||
public ColliderButtonEvent OnReleased;
|
||||
public static event Action<ColliderButton> OnSelectedGlobal;
|
||||
public static event Action<ColliderButton> OnDeselectedGlobal;
|
||||
public static event Action<ColliderButton> OnClickGlobal;
|
||||
public static event Action<ColliderButton> OnPressedGlobal;
|
||||
public static event Action<ColliderButton> OnReleasedGlobal;
|
||||
|
||||
//Public Enums:
|
||||
public enum EaseType { EaseOut, EaseOutBack };
|
||||
|
||||
//Public Properties:
|
||||
public bool IsSelected
|
||||
{
|
||||
get;
|
||||
private set;
|
||||
}
|
||||
|
||||
//Public Variables:
|
||||
public KeyCode[] keyInput;
|
||||
public bool _unityEventsFolded;
|
||||
public bool _scaleResponseFolded;
|
||||
public bool _colorResponseFolded;
|
||||
public bool applyColor;
|
||||
public bool applyScale;
|
||||
public LayerMask collisionLayerMask = -1;
|
||||
public Renderer colorRendererTarget;
|
||||
public Image colorImageTarget;
|
||||
public Color selectedColor = Color.gray;
|
||||
public Color pressedColor = Color.green;
|
||||
public Color disabledColor = new Color(.5f, .5f, .5f, .5f);
|
||||
public float colorDuration = .1f;
|
||||
public Transform scaleTarget;
|
||||
public Vector3 normalScale;
|
||||
public Vector3 selectedScale;
|
||||
public Vector3 pressedScale;
|
||||
public float scaleDuration = .1f;
|
||||
public EaseType scaleEaseType;
|
||||
public bool resizeGUIBoxCollider = true;
|
||||
public bool centerGUIBoxCollider = true;
|
||||
public Vector2 guiBoxColliderPadding;
|
||||
public bool interactable = true;
|
||||
|
||||
//Private Variables:
|
||||
bool _clicking;
|
||||
int _selectedCount;
|
||||
bool _colliderSelected;
|
||||
bool _pressed;
|
||||
bool _released;
|
||||
bool _vrRunning;
|
||||
RectTransform _rectTransform;
|
||||
EventTrigger _eventTrigger;
|
||||
EventTrigger.Entry _pressedEventTrigger;
|
||||
EventTrigger.Entry _releasedEventTrigger;
|
||||
EventTrigger.Entry _enterEventTrigger;
|
||||
EventTrigger.Entry _exitEventTrigger;
|
||||
int _colliderCount;
|
||||
BoxCollider _boxCollider;
|
||||
TweenBase _colorTweenImage = null;
|
||||
TweenBase _colorTweenMaterial;
|
||||
TweenBase _scaleTween;
|
||||
Color _normalColorRenderer;
|
||||
Color _normalColorImage;
|
||||
bool _interactableStatus = true;
|
||||
|
||||
//Init:
|
||||
private void Reset()
|
||||
{
|
||||
//var sets:
|
||||
applyColor = true;
|
||||
keyInput = new KeyCode[] { KeyCode.Mouse0 };
|
||||
|
||||
//hook up image to help users:
|
||||
Image image = GetComponent<Image>();
|
||||
if (image != null)
|
||||
{
|
||||
colorImageTarget = image;
|
||||
}
|
||||
|
||||
//hook up renderer to help users:
|
||||
Renderer renderer = GetComponent<Renderer>();
|
||||
if (renderer != null && renderer.sharedMaterial.HasProperty("_Color"))
|
||||
{
|
||||
colorRendererTarget = renderer;
|
||||
}
|
||||
}
|
||||
|
||||
private void Awake()
|
||||
{
|
||||
if (Application.isPlaying)
|
||||
{
|
||||
//color setups:
|
||||
if (colorRendererTarget != null)
|
||||
{
|
||||
if (colorRendererTarget.material.HasProperty("_Color"))
|
||||
{
|
||||
_normalColorRenderer = colorRendererTarget.material.color;
|
||||
}
|
||||
}
|
||||
if (colorImageTarget != null)
|
||||
{
|
||||
_normalColorImage = colorImageTarget.color;
|
||||
}
|
||||
}
|
||||
|
||||
//scale setup:
|
||||
scaleTarget = transform;
|
||||
normalScale = transform.localScale;
|
||||
|
||||
//set initial size on gui collider:
|
||||
_rectTransform = GetComponent<RectTransform>();
|
||||
_boxCollider = GetComponent<BoxCollider>();
|
||||
if (_rectTransform != null && _boxCollider != null) ResizeGUIBoxCollider(_boxCollider);
|
||||
|
||||
//set up rigidbody:
|
||||
GetComponent<Rigidbody>().isKinematic = true;
|
||||
|
||||
//refs:
|
||||
_rectTransform = GetComponent<RectTransform>();
|
||||
_boxCollider = GetComponent<BoxCollider>();
|
||||
|
||||
if (!Application.isPlaying) return;
|
||||
|
||||
//rect and event triggers:
|
||||
_rectTransform = GetComponent<RectTransform>();
|
||||
if (_rectTransform != null)
|
||||
{
|
||||
_eventTrigger = gameObject.AddComponent<EventTrigger>();
|
||||
_pressedEventTrigger = new EventTrigger.Entry();
|
||||
_pressedEventTrigger.eventID = EventTriggerType.PointerDown;
|
||||
_releasedEventTrigger = new EventTrigger.Entry();
|
||||
_releasedEventTrigger.eventID = EventTriggerType.PointerUp;
|
||||
_enterEventTrigger = new EventTrigger.Entry();
|
||||
_enterEventTrigger.eventID = EventTriggerType.PointerEnter;
|
||||
_exitEventTrigger = new EventTrigger.Entry();
|
||||
_exitEventTrigger.eventID = EventTriggerType.PointerExit;
|
||||
}
|
||||
|
||||
//events:
|
||||
if (_rectTransform != null)
|
||||
{
|
||||
//event registrations:
|
||||
_pressedEventTrigger.callback.AddListener((data) => { OnPointerDownDelegate((PointerEventData)data); });
|
||||
_eventTrigger.triggers.Add(_pressedEventTrigger);
|
||||
_releasedEventTrigger.callback.AddListener((data) => { OnPointerUpDelegate((PointerEventData)data); });
|
||||
_eventTrigger.triggers.Add(_releasedEventTrigger);
|
||||
_enterEventTrigger.callback.AddListener((data) => { OnPointerEnterDelegate((PointerEventData)data); });
|
||||
_eventTrigger.triggers.Add(_enterEventTrigger);
|
||||
_exitEventTrigger.callback.AddListener((data) => { OnPointerExitDelegate((PointerEventData)data); });
|
||||
_eventTrigger.triggers.Add(_exitEventTrigger);
|
||||
}
|
||||
}
|
||||
|
||||
//Flow:
|
||||
private void OnEnable()
|
||||
{
|
||||
if (!Application.isPlaying) return;
|
||||
|
||||
ColorReset();
|
||||
}
|
||||
|
||||
private void OnDisable()
|
||||
{
|
||||
if (!Application.isPlaying) return;
|
||||
|
||||
//resets:
|
||||
_pressed = false;
|
||||
_released = false;
|
||||
_clicking = false;
|
||||
_colliderSelected = false;
|
||||
_selectedCount = 0;
|
||||
_colliderCount = 0;
|
||||
|
||||
ColorReset();
|
||||
ScaleReset();
|
||||
}
|
||||
|
||||
//Loops:
|
||||
private void Update()
|
||||
{
|
||||
//disabled?
|
||||
if (_interactableStatus != interactable)
|
||||
{
|
||||
if (interactable)
|
||||
{
|
||||
ColorNormal();
|
||||
}
|
||||
else
|
||||
{
|
||||
ColorDisabled();
|
||||
}
|
||||
|
||||
//handle a Unity GUI button in case it is also attached:
|
||||
Button button = GetComponent<Button>();
|
||||
if (button != null)
|
||||
{
|
||||
button.interactable = interactable;
|
||||
}
|
||||
|
||||
_interactableStatus = interactable;
|
||||
}
|
||||
|
||||
//update gui colliders:
|
||||
if (resizeGUIBoxCollider && _rectTransform != null && _boxCollider != null)
|
||||
{
|
||||
//fit a box collider:
|
||||
ResizeGUIBoxCollider(_boxCollider);
|
||||
}
|
||||
|
||||
//for in editor updating of the gui collider:
|
||||
if (!Application.isPlaying) return;
|
||||
|
||||
//VR status:
|
||||
#if UNITY_2017_2_OR_NEWER
|
||||
_vrRunning = (XRSettings.isDeviceActive);
|
||||
#else
|
||||
_vrRunning = (VRSettings.isDeviceActive);
|
||||
#endif
|
||||
|
||||
if (!interactable) return;
|
||||
|
||||
//collider collision started:
|
||||
if (!_colliderSelected && _colliderCount > 0)
|
||||
{
|
||||
_colliderSelected = true;
|
||||
Selected();
|
||||
}
|
||||
|
||||
//collider collision ended:
|
||||
if (_colliderSelected && _colliderCount == 0)
|
||||
{
|
||||
_colliderSelected = false;
|
||||
Deselected();
|
||||
}
|
||||
|
||||
//process input:
|
||||
if (keyInput != null && _selectedCount > 0)
|
||||
{
|
||||
foreach (var item in keyInput)
|
||||
{
|
||||
/* if (Input.GetKeyDown(item))
|
||||
{
|
||||
if (_selectedCount == 0) return;
|
||||
Pressed();
|
||||
}
|
||||
|
||||
if (Input.GetKeyUp(item))
|
||||
{
|
||||
Released();
|
||||
} */
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
//Event Handlers:
|
||||
private void OnTriggerStay(Collider other)
|
||||
{
|
||||
if (_colliderCount == 0)
|
||||
{
|
||||
_colliderCount++;
|
||||
}
|
||||
}
|
||||
|
||||
private void OnTriggerEnter(Collider other)
|
||||
{
|
||||
_colliderCount++;
|
||||
}
|
||||
|
||||
private void OnTriggerExit(Collider other)
|
||||
{
|
||||
_colliderCount--;
|
||||
}
|
||||
|
||||
private void OnPointerDownDelegate(PointerEventData data)
|
||||
{
|
||||
if (Array.IndexOf(keyInput, KeyCode.Mouse0) == -1) return;
|
||||
Pressed();
|
||||
}
|
||||
|
||||
private void OnPointerUpDelegate(PointerEventData data)
|
||||
{
|
||||
if (Array.IndexOf(keyInput, KeyCode.Mouse0) == -1) return;
|
||||
Released();
|
||||
}
|
||||
|
||||
private void OnPointerEnterDelegate(PointerEventData data)
|
||||
{
|
||||
Selected();
|
||||
}
|
||||
|
||||
private void OnPointerExitDelegate(PointerEventData data)
|
||||
{
|
||||
Deselected();
|
||||
}
|
||||
|
||||
private void OnMouseDown()
|
||||
{
|
||||
if (_vrRunning) return;
|
||||
if (Array.IndexOf(keyInput, KeyCode.Mouse0) == -1) return;
|
||||
Pressed();
|
||||
}
|
||||
|
||||
private void OnMouseUp()
|
||||
{
|
||||
if (_vrRunning) return;
|
||||
if (Array.IndexOf(keyInput, KeyCode.Mouse0) == -1) return;
|
||||
Released();
|
||||
if (Application.isMobilePlatform)
|
||||
{
|
||||
Deselected();
|
||||
}
|
||||
}
|
||||
|
||||
private void OnMouseEnter()
|
||||
{
|
||||
if (Application.isMobilePlatform) return;
|
||||
if (_vrRunning) return;
|
||||
Selected();
|
||||
}
|
||||
|
||||
private void OnMouseExit()
|
||||
{
|
||||
if (_vrRunning) return;
|
||||
Deselected();
|
||||
}
|
||||
|
||||
public void Deselected()
|
||||
{
|
||||
if (!interactable) return;
|
||||
|
||||
_selectedCount--;
|
||||
if (_selectedCount < 0) _selectedCount = 0;
|
||||
if (_selectedCount > 0) return;
|
||||
_clicking = false;
|
||||
ColorNormal();
|
||||
ScaleNormal();
|
||||
if (!Application.isMobilePlatform)
|
||||
{
|
||||
if (OnDeselected != null) OnDeselected.Invoke(this);
|
||||
if (OnDeselectedGlobal != null) OnDeselectedGlobal.Invoke(this);
|
||||
IsSelected = false;
|
||||
}
|
||||
}
|
||||
|
||||
public void Selected()
|
||||
{
|
||||
if (!interactable) return;
|
||||
|
||||
_selectedCount++;
|
||||
if (_selectedCount != 1) return;
|
||||
|
||||
_pressed = false;
|
||||
_released = false;
|
||||
|
||||
_clicking = false;
|
||||
ColorSelected();
|
||||
ScaleSelected();
|
||||
if (OnSelected != null) OnSelected.Invoke(this);
|
||||
if (OnSelectedGlobal != null) OnSelectedGlobal(this);
|
||||
IsSelected = true;
|
||||
}
|
||||
|
||||
public void Pressed()
|
||||
{
|
||||
if (!interactable) return;
|
||||
|
||||
//handheld devices normally have touch screens which means selection is not a separate phase:
|
||||
if (SystemInfo.deviceType != DeviceType.Handheld)
|
||||
{
|
||||
if (_selectedCount <= 0) return;
|
||||
|
||||
}
|
||||
|
||||
if (_pressed) return;
|
||||
_pressed = true;
|
||||
_released = false;
|
||||
|
||||
_clicking = true;
|
||||
ColorPressed();
|
||||
ScalePressed();
|
||||
if (OnPressed != null) OnPressed.Invoke(this);
|
||||
if (OnPressedGlobal != null) OnPressedGlobal(this);
|
||||
}
|
||||
|
||||
public void Released()
|
||||
{
|
||||
if (!interactable) return;
|
||||
|
||||
if (_released) return;
|
||||
_pressed = false;
|
||||
_released = true;
|
||||
|
||||
if (_selectedCount != 0)
|
||||
{
|
||||
ColorSelected();
|
||||
ScaleSelected();
|
||||
}
|
||||
|
||||
if (_clicking)
|
||||
{
|
||||
if (OnClick != null) OnClick.Invoke(this);
|
||||
if (OnClickGlobal != null) OnClickGlobal(this);
|
||||
}
|
||||
_clicking = false;
|
||||
if (OnReleased != null) OnReleased.Invoke(this);
|
||||
if (OnReleasedGlobal != null) OnReleasedGlobal(this);
|
||||
}
|
||||
|
||||
//Private Methods:
|
||||
private void ResizeGUIBoxCollider(BoxCollider boxCollider)
|
||||
{
|
||||
if (!resizeGUIBoxCollider) return;
|
||||
boxCollider.size = new Vector3(_rectTransform.rect.width + guiBoxColliderPadding.x, _rectTransform.rect.height + guiBoxColliderPadding.y, _boxCollider.size.z);
|
||||
|
||||
if (centerGUIBoxCollider)
|
||||
{
|
||||
float centerX = (Mathf.Abs(_rectTransform.pivot.x - 1) - .5f) * boxCollider.size.x;
|
||||
float centerY = (Mathf.Abs(_rectTransform.pivot.y - 1) - .5f) * boxCollider.size.y;
|
||||
boxCollider.center = new Vector3(centerX, centerY, boxCollider.center.z);
|
||||
}
|
||||
}
|
||||
|
||||
private void ColorReset()
|
||||
{
|
||||
//stop running tweens:
|
||||
if (_colorTweenImage != null)
|
||||
{
|
||||
_colorTweenImage.Stop();
|
||||
}
|
||||
|
||||
if (_colorTweenMaterial != null)
|
||||
{
|
||||
_colorTweenMaterial.Stop();
|
||||
}
|
||||
|
||||
if (!applyColor) return;
|
||||
|
||||
//reset material color:
|
||||
if (colorRendererTarget != null && colorRendererTarget.material.HasProperty("_Color"))
|
||||
{
|
||||
colorRendererTarget.material.color = _normalColorRenderer;
|
||||
}
|
||||
|
||||
//reset image color:
|
||||
if (colorImageTarget != null)
|
||||
{
|
||||
colorImageTarget.color = _normalColorImage;
|
||||
}
|
||||
}
|
||||
|
||||
private void ColorNormal()
|
||||
{
|
||||
if (!applyColor) return;
|
||||
|
||||
//tween material color:
|
||||
if (colorRendererTarget != null && colorRendererTarget.material.HasProperty("_Color"))
|
||||
{
|
||||
_colorTweenMaterial = Tween.Color(colorRendererTarget, _normalColorRenderer, colorDuration, 0, null, Tween.LoopType.None, null, null, false);
|
||||
}
|
||||
|
||||
//tween image color:
|
||||
if (colorImageTarget != null)
|
||||
{
|
||||
Tween.Color(colorImageTarget, _normalColorImage, colorDuration, 0, null, Tween.LoopType.None, null, null, false);
|
||||
}
|
||||
}
|
||||
|
||||
private void ColorSelected()
|
||||
{
|
||||
if (!applyColor) return;
|
||||
|
||||
//tween material color:
|
||||
if (colorRendererTarget != null && colorRendererTarget.material.HasProperty("_Color"))
|
||||
{
|
||||
_colorTweenMaterial = Tween.Color(colorRendererTarget, selectedColor, colorDuration, 0, null, Tween.LoopType.None, null, null, false);
|
||||
}
|
||||
|
||||
//tween image color:
|
||||
if (colorImageTarget != null)
|
||||
{
|
||||
Tween.Color(colorImageTarget, selectedColor, colorDuration, 0, null, Tween.LoopType.None, null, null, false);
|
||||
}
|
||||
}
|
||||
|
||||
private void ColorPressed()
|
||||
{
|
||||
if (!applyColor) return;
|
||||
|
||||
//tween material color:
|
||||
if (colorRendererTarget != null && colorRendererTarget.material.HasProperty("_Color"))
|
||||
{
|
||||
_colorTweenMaterial = Tween.Color(colorRendererTarget, pressedColor, colorDuration, 0, null, Tween.LoopType.None, null, null, false);
|
||||
}
|
||||
|
||||
//tween image color:
|
||||
if (colorImageTarget != null)
|
||||
{
|
||||
Tween.Color(colorImageTarget, pressedColor, colorDuration, 0, null, Tween.LoopType.None, null, null, false);
|
||||
}
|
||||
}
|
||||
|
||||
private void ColorDisabled()
|
||||
{
|
||||
if (!applyColor) return;
|
||||
|
||||
//tween material color:
|
||||
if (colorRendererTarget != null && colorRendererTarget.material.HasProperty("_Color"))
|
||||
{
|
||||
_colorTweenMaterial = Tween.Color(colorRendererTarget, disabledColor, colorDuration, 0, null, Tween.LoopType.None, null, null, false);
|
||||
}
|
||||
|
||||
//tween image color:
|
||||
if (colorImageTarget != null)
|
||||
{
|
||||
Tween.Color(colorImageTarget, disabledColor, colorDuration, 0, null, Tween.LoopType.None, null, null, false);
|
||||
}
|
||||
}
|
||||
|
||||
private void ScaleReset()
|
||||
{
|
||||
if (_scaleTween != null) _scaleTween.Stop();
|
||||
scaleTarget.localScale = normalScale;
|
||||
}
|
||||
|
||||
private void ScaleNormal()
|
||||
{
|
||||
if (!applyScale) return;
|
||||
AnimationCurve curve = null;
|
||||
switch (scaleEaseType)
|
||||
{
|
||||
case EaseType.EaseOut:
|
||||
curve = Tween.EaseOutStrong;
|
||||
break;
|
||||
|
||||
case EaseType.EaseOutBack:
|
||||
curve = Tween.EaseOutBack;
|
||||
break;
|
||||
}
|
||||
_scaleTween = Tween.LocalScale(scaleTarget, normalScale, scaleDuration, 0, curve, Tween.LoopType.None, null, null, false);
|
||||
}
|
||||
|
||||
private void ScaleSelected()
|
||||
{
|
||||
if (!applyScale) return;
|
||||
AnimationCurve curve = null;
|
||||
switch (scaleEaseType)
|
||||
{
|
||||
case EaseType.EaseOut:
|
||||
curve = Tween.EaseOutStrong;
|
||||
break;
|
||||
|
||||
case EaseType.EaseOutBack:
|
||||
curve = Tween.EaseOutBack;
|
||||
break;
|
||||
}
|
||||
_scaleTween = Tween.LocalScale(scaleTarget, Vector3.Scale(normalScale, selectedScale), scaleDuration, 0, curve, Tween.LoopType.None, null, null, false);
|
||||
}
|
||||
|
||||
private void ScalePressed()
|
||||
{
|
||||
if (!applyScale) return;
|
||||
AnimationCurve curve = null;
|
||||
switch (scaleEaseType)
|
||||
{
|
||||
case EaseType.EaseOut:
|
||||
curve = Tween.EaseOutStrong;
|
||||
break;
|
||||
|
||||
case EaseType.EaseOutBack:
|
||||
curve = Tween.EaseOutBack;
|
||||
break;
|
||||
}
|
||||
_scaleTween = Tween.LocalScale(scaleTarget, Vector3.Scale(normalScale, pressedScale), scaleDuration, 0, curve, Tween.LoopType.None, null, null, false);
|
||||
}
|
||||
}
|
||||
}
|
||||
20
Assets/External/Pixelplacement/Surge/ColliderButton/ColliderButton.cs.meta
vendored
Normal file
20
Assets/External/Pixelplacement/Surge/ColliderButton/ColliderButton.cs.meta
vendored
Normal file
@@ -0,0 +1,20 @@
|
||||
fileFormatVersion: 2
|
||||
guid: b86ed740b907fcc459270636ef77bddc
|
||||
timeCreated: 1521254994
|
||||
licenseType: Store
|
||||
MonoImporter:
|
||||
externalObjects: {}
|
||||
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/ColliderButton/ColliderButton.cs
|
||||
uploadId: 467433
|
||||
9
Assets/External/Pixelplacement/Surge/ColliderButton/Editor.meta
vendored
Normal file
9
Assets/External/Pixelplacement/Surge/ColliderButton/Editor.meta
vendored
Normal file
@@ -0,0 +1,9 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 53b6a515c1f2ee049862496c7b3cece4
|
||||
folderAsset: yes
|
||||
timeCreated: 1521850290
|
||||
licenseType: Store
|
||||
DefaultImporter:
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
127
Assets/External/Pixelplacement/Surge/ColliderButton/Editor/ColliderButtonEditor.cs
vendored
Normal file
127
Assets/External/Pixelplacement/Surge/ColliderButton/Editor/ColliderButtonEditor.cs
vendored
Normal file
@@ -0,0 +1,127 @@
|
||||
/// <summary>
|
||||
/// SURGE FRAMEWORK
|
||||
/// Author: Bob Berkebile
|
||||
/// Email: bobb@pixelplacement.com
|
||||
///
|
||||
/// Custom inspector ColliderButton.
|
||||
///
|
||||
/// </summary>
|
||||
|
||||
using System.Collections;
|
||||
using System.Collections.Generic;
|
||||
using UnityEngine;
|
||||
using UnityEditor;
|
||||
|
||||
namespace Pixelplacement
|
||||
{
|
||||
[CustomEditor(typeof(ColliderButton), true)]
|
||||
[CanEditMultipleObjects]
|
||||
public class ColliderButtonEditor : UnityEditor.Editor
|
||||
{
|
||||
//Private Variables:
|
||||
ColliderButton _target;
|
||||
|
||||
//Init:
|
||||
void OnEnable()
|
||||
{
|
||||
_target = target as ColliderButton;
|
||||
}
|
||||
|
||||
//Inspector GUI:
|
||||
public override void OnInspectorGUI()
|
||||
{
|
||||
serializedObject.Update();
|
||||
|
||||
DrawPropertiesExcluding(serializedObject, new string[] {
|
||||
"interactable",
|
||||
"keyInput",
|
||||
"collisionLayerMask",
|
||||
"resizeGUIBoxCollider",
|
||||
"centerGUIBoxCollider",
|
||||
"guiBoxColliderPadding",
|
||||
"Color Responses",
|
||||
"applyColor",
|
||||
"colorRendererTarget",
|
||||
"colorImageTarget",
|
||||
"colorImageTarget",
|
||||
"selectedColor",
|
||||
"pressedColor",
|
||||
"disabledColor",
|
||||
"colorDuration",
|
||||
"Scale Responses",
|
||||
"applyScale",
|
||||
"scaleTarget",
|
||||
"normalScale",
|
||||
"selectedScale",
|
||||
"pressedScale",
|
||||
"scaleDuration",
|
||||
"scaleEaseType",
|
||||
"Unity Events",
|
||||
"OnSelected",
|
||||
"OnDeselected",
|
||||
"OnClick",
|
||||
"OnPressed",
|
||||
"OnReleased",
|
||||
"_unityEventsFolded",
|
||||
"_scaleResponseFolded",
|
||||
"_colorResponseFolded"
|
||||
});
|
||||
|
||||
EditorGUILayout.PropertyField(serializedObject.FindProperty("interactable"));
|
||||
EditorGUILayout.PropertyField(serializedObject.FindProperty("keyInput"), true);
|
||||
EditorGUILayout.PropertyField(serializedObject.FindProperty("collisionLayerMask"));
|
||||
EditorGUILayout.PropertyField(serializedObject.FindProperty("resizeGUIBoxCollider"));
|
||||
EditorGUILayout.PropertyField(serializedObject.FindProperty("centerGUIBoxCollider"));
|
||||
GUI.enabled = _target.resizeGUIBoxCollider;
|
||||
EditorGUILayout.PropertyField(serializedObject.FindProperty("guiBoxColliderPadding"));
|
||||
GUI.enabled = true;
|
||||
|
||||
_target._colorResponseFolded = EditorGUILayout.Foldout(_target._colorResponseFolded, "Color Responses", true);
|
||||
if (_target._colorResponseFolded)
|
||||
{
|
||||
EditorGUI.indentLevel = 1;
|
||||
EditorGUILayout.PropertyField(serializedObject.FindProperty("applyColor"));
|
||||
GUI.enabled = _target.applyColor;
|
||||
EditorGUILayout.PropertyField(serializedObject.FindProperty("colorRendererTarget"));
|
||||
EditorGUILayout.PropertyField(serializedObject.FindProperty("colorImageTarget"));
|
||||
EditorGUILayout.PropertyField(serializedObject.FindProperty("selectedColor"));
|
||||
EditorGUILayout.PropertyField(serializedObject.FindProperty("pressedColor"));
|
||||
EditorGUILayout.PropertyField(serializedObject.FindProperty("disabledColor"));
|
||||
EditorGUILayout.PropertyField(serializedObject.FindProperty("colorDuration"));
|
||||
EditorGUI.indentLevel = 0;
|
||||
GUI.enabled = true;
|
||||
EditorGUILayout.Space();
|
||||
}
|
||||
|
||||
_target._scaleResponseFolded = EditorGUILayout.Foldout(_target._scaleResponseFolded, "Scale Responses", true);
|
||||
if (_target._scaleResponseFolded)
|
||||
{
|
||||
EditorGUI.indentLevel = 1;
|
||||
EditorGUILayout.PropertyField(serializedObject.FindProperty("applyScale"));
|
||||
GUI.enabled = _target.applyScale;
|
||||
EditorGUILayout.PropertyField(serializedObject.FindProperty("scaleTarget"));
|
||||
EditorGUILayout.PropertyField(serializedObject.FindProperty("normalScale"));
|
||||
EditorGUILayout.PropertyField(serializedObject.FindProperty("selectedScale"));
|
||||
EditorGUILayout.PropertyField(serializedObject.FindProperty("pressedScale"));
|
||||
EditorGUILayout.PropertyField(serializedObject.FindProperty("scaleDuration"));
|
||||
EditorGUILayout.PropertyField(serializedObject.FindProperty("scaleEaseType"));
|
||||
EditorGUI.indentLevel = 0;
|
||||
GUI.enabled = true;
|
||||
EditorGUILayout.Space();
|
||||
}
|
||||
|
||||
//fold events:
|
||||
_target._unityEventsFolded = EditorGUILayout.Foldout(_target._unityEventsFolded, "Unity Events", true);
|
||||
if (_target._unityEventsFolded)
|
||||
{
|
||||
EditorGUILayout.PropertyField(serializedObject.FindProperty("OnSelected"));
|
||||
EditorGUILayout.PropertyField(serializedObject.FindProperty("OnDeselected"));
|
||||
EditorGUILayout.PropertyField(serializedObject.FindProperty("OnClick"));
|
||||
EditorGUILayout.PropertyField(serializedObject.FindProperty("OnPressed"));
|
||||
EditorGUILayout.PropertyField(serializedObject.FindProperty("OnReleased"));
|
||||
}
|
||||
|
||||
serializedObject.ApplyModifiedProperties();
|
||||
}
|
||||
}
|
||||
}
|
||||
19
Assets/External/Pixelplacement/Surge/ColliderButton/Editor/ColliderButtonEditor.cs.meta
vendored
Normal file
19
Assets/External/Pixelplacement/Surge/ColliderButton/Editor/ColliderButtonEditor.cs.meta
vendored
Normal file
@@ -0,0 +1,19 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 3f63601133a78564180c3d96d8448bda
|
||||
timeCreated: 1521850300
|
||||
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/ColliderButton/Editor/ColliderButtonEditor.cs
|
||||
uploadId: 467433
|
||||
9
Assets/External/Pixelplacement/Surge/ColliderButton/Utilities.meta
vendored
Normal file
9
Assets/External/Pixelplacement/Surge/ColliderButton/Utilities.meta
vendored
Normal file
@@ -0,0 +1,9 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 20da7b5e7fc886442acbe0783c00c3ad
|
||||
folderAsset: yes
|
||||
timeCreated: 1529379383
|
||||
licenseType: Store
|
||||
DefaultImporter:
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
29
Assets/External/Pixelplacement/Surge/ColliderButton/Utilities/ColliderButtonInteraction.cs
vendored
Normal file
29
Assets/External/Pixelplacement/Surge/ColliderButton/Utilities/ColliderButtonInteraction.cs
vendored
Normal file
@@ -0,0 +1,29 @@
|
||||
/// <summary>
|
||||
/// SURGE FRAMEWORK
|
||||
/// Author: Bob Berkebile
|
||||
/// Email: bobb@pixelplacement.com
|
||||
///
|
||||
/// An optional helper class that sets up a GameObject so that it can "physically" collide with a ColliderButton for input events...
|
||||
/// all this means is that is has a collider that has 'isTrigger' set to true.
|
||||
///
|
||||
/// </summary>
|
||||
|
||||
using System.Collections;
|
||||
using System.Collections.Generic;
|
||||
using UnityEngine;
|
||||
|
||||
[RequireComponent(typeof(Collider))]
|
||||
public class ColliderButtonInteraction : MonoBehaviour
|
||||
{
|
||||
//Init
|
||||
private void Reset()
|
||||
{
|
||||
GetComponent<Collider>().isTrigger = true;
|
||||
}
|
||||
|
||||
private void Awake()
|
||||
{
|
||||
Collider collider = GetComponent<Collider>();
|
||||
collider.isTrigger = true;
|
||||
}
|
||||
}
|
||||
19
Assets/External/Pixelplacement/Surge/ColliderButton/Utilities/ColliderButtonInteraction.cs.meta
vendored
Normal file
19
Assets/External/Pixelplacement/Surge/ColliderButton/Utilities/ColliderButtonInteraction.cs.meta
vendored
Normal file
@@ -0,0 +1,19 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 8ab5578e5d95947499bc4b5fdeee419c
|
||||
timeCreated: 1529529355
|
||||
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/ColliderButton/Utilities/ColliderButtonInteraction.cs
|
||||
uploadId: 467433
|
||||
84
Assets/External/Pixelplacement/Surge/ColliderButton/Utilities/ColliderButtonSelector.cs
vendored
Normal file
84
Assets/External/Pixelplacement/Surge/ColliderButton/Utilities/ColliderButtonSelector.cs
vendored
Normal file
@@ -0,0 +1,84 @@
|
||||
/// <summary>
|
||||
/// SURGE FRAMEWORK
|
||||
/// Author: Bob Berkebile
|
||||
/// Email: bobb@pixelplacement.com
|
||||
///
|
||||
/// Allows for easy selection toggle of Collider Buttons.
|
||||
///
|
||||
/// </summary>
|
||||
|
||||
using System.Collections;
|
||||
using System.Collections.Generic;
|
||||
using UnityEngine;
|
||||
using Pixelplacement;
|
||||
|
||||
public class ColliderButtonSelector : MonoBehaviour
|
||||
{
|
||||
//Public Variables:
|
||||
public Chooser chooser;
|
||||
public bool loopAround;
|
||||
public KeyCode previousKey = KeyCode.LeftArrow;
|
||||
public KeyCode nextKey = KeyCode.RightArrow;
|
||||
public ColliderButton[] colliderButtons;
|
||||
|
||||
//Private Variables
|
||||
private int _index;
|
||||
|
||||
//Init:
|
||||
private void OnEnable()
|
||||
{
|
||||
_index = -1;
|
||||
Next();
|
||||
}
|
||||
|
||||
private void Reset()
|
||||
{
|
||||
chooser = GetComponent<Chooser>();
|
||||
}
|
||||
|
||||
//Loops:
|
||||
private void Update()
|
||||
{
|
||||
// if (Input.GetKeyDown(previousKey)) Previous();
|
||||
// if (Input.GetKeyDown(nextKey)) Next();
|
||||
}
|
||||
|
||||
//Public Methods:
|
||||
public void Next()
|
||||
{
|
||||
_index++;
|
||||
|
||||
if (_index > colliderButtons.Length-1)
|
||||
{
|
||||
if (loopAround)
|
||||
{
|
||||
_index = 0;
|
||||
}
|
||||
else
|
||||
{
|
||||
_index = colliderButtons.Length - 1;
|
||||
}
|
||||
}
|
||||
|
||||
chooser.transform.LookAt(colliderButtons[_index].transform);
|
||||
}
|
||||
|
||||
public void Previous()
|
||||
{
|
||||
_index--;
|
||||
|
||||
if (_index < 0)
|
||||
{
|
||||
if (loopAround)
|
||||
{
|
||||
_index = colliderButtons.Length - 1;
|
||||
}
|
||||
else
|
||||
{
|
||||
_index = 0;
|
||||
}
|
||||
}
|
||||
|
||||
chooser.transform.LookAt(colliderButtons[_index].transform);
|
||||
}
|
||||
}
|
||||
18
Assets/External/Pixelplacement/Surge/ColliderButton/Utilities/ColliderButtonSelector.cs.meta
vendored
Normal file
18
Assets/External/Pixelplacement/Surge/ColliderButton/Utilities/ColliderButtonSelector.cs.meta
vendored
Normal file
@@ -0,0 +1,18 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 593681621a0c31349ab960f41488b221
|
||||
MonoImporter:
|
||||
externalObjects: {}
|
||||
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/ColliderButton/Utilities/ColliderButtonSelector.cs
|
||||
uploadId: 467433
|
||||
9
Assets/External/Pixelplacement/Surge/DisplayObject.meta
vendored
Normal file
9
Assets/External/Pixelplacement/Surge/DisplayObject.meta
vendored
Normal file
@@ -0,0 +1,9 @@
|
||||
fileFormatVersion: 2
|
||||
guid: a08b796eb5fbf0042a4ec882d0cf43ce
|
||||
folderAsset: yes
|
||||
timeCreated: 1500598979
|
||||
licenseType: Store
|
||||
DefaultImporter:
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
113
Assets/External/Pixelplacement/Surge/DisplayObject/DisplayObject.cs
vendored
Normal file
113
Assets/External/Pixelplacement/Surge/DisplayObject/DisplayObject.cs
vendored
Normal file
@@ -0,0 +1,113 @@
|
||||
/// <summary>
|
||||
/// SURGE FRAMEWORK
|
||||
/// Author: Bob Berkebile
|
||||
/// Email: bobb@pixelplacement.com
|
||||
///
|
||||
/// An elegant solution for allowing stronger code-controlled object visibility that doesn't depend on how an object was last left in the editor.
|
||||
///
|
||||
/// </summary>
|
||||
|
||||
using UnityEngine;
|
||||
using System.Collections;
|
||||
using System.Collections.Generic;
|
||||
using UnityEngine.UI;
|
||||
|
||||
namespace Pixelplacement
|
||||
{
|
||||
[RequireComponent (typeof (Initialization))]
|
||||
public class DisplayObject : MonoBehaviour
|
||||
{
|
||||
//Private Variables:
|
||||
private bool _activated;
|
||||
|
||||
//Public Properties:
|
||||
/// <summary>
|
||||
/// Wrapper for GameObject's ActiveSelf property for ease of use.
|
||||
/// </summary>
|
||||
public bool ActiveSelf
|
||||
{
|
||||
get
|
||||
{
|
||||
return gameObject.activeSelf;
|
||||
}
|
||||
|
||||
set
|
||||
{
|
||||
SetActive(value);
|
||||
}
|
||||
}
|
||||
|
||||
//Public Methods:
|
||||
/// <summary>
|
||||
/// Registers this DisplayObject - should only be called by Initialization.
|
||||
/// </summary>
|
||||
public void Register ()
|
||||
{
|
||||
if (!_activated)
|
||||
{
|
||||
_activated = true;
|
||||
gameObject.SetActive (false);
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Wrapper for GameObject's SetActive method for ease of use.
|
||||
/// </summary>
|
||||
public void SetActive (bool value)
|
||||
{
|
||||
_activated = true;
|
||||
gameObject.SetActive (value);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Solo this DisplayObject within other DisplayObjects at the same level in the hierarchy.
|
||||
/// </summary>
|
||||
public void Solo ()
|
||||
{
|
||||
Register();
|
||||
|
||||
if (transform.parent != null)
|
||||
{
|
||||
foreach (Transform item in transform.parent)
|
||||
{
|
||||
if (item == transform) continue;
|
||||
DisplayObject displayObject = item.GetComponent<DisplayObject> ();
|
||||
if (displayObject != null) displayObject.SetActive (false);
|
||||
}
|
||||
gameObject.SetActive (true);
|
||||
}else{
|
||||
foreach (var item in Resources.FindObjectsOfTypeAll<DisplayObject> ())
|
||||
{
|
||||
if (item.transform.parent == null)
|
||||
{
|
||||
if (item == this)
|
||||
{
|
||||
item.SetActive (true);
|
||||
}else{
|
||||
item.SetActive (false);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Hides all DisplayObjects at the same level in the hierarchy as this DisplayObject.
|
||||
/// </summary>
|
||||
public void HideAll ()
|
||||
{
|
||||
if (transform.parent != null)
|
||||
{
|
||||
foreach (Transform item in transform.parent)
|
||||
{
|
||||
if (item.GetComponent<DisplayObject> () != null) item.gameObject.SetActive (false);
|
||||
}
|
||||
}else{
|
||||
foreach (var item in Resources.FindObjectsOfTypeAll<DisplayObject> ())
|
||||
{
|
||||
if (item.transform.parent == null) item.gameObject.SetActive (false);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
19
Assets/External/Pixelplacement/Surge/DisplayObject/DisplayObject.cs.meta
vendored
Normal file
19
Assets/External/Pixelplacement/Surge/DisplayObject/DisplayObject.cs.meta
vendored
Normal file
@@ -0,0 +1,19 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 1c09009af25a0c84aa7360bbc94c9b59
|
||||
timeCreated: 1479232771
|
||||
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/DisplayObject/DisplayObject.cs
|
||||
uploadId: 467433
|
||||
9
Assets/External/Pixelplacement/Surge/DisplayObject/Editor.meta
vendored
Normal file
9
Assets/External/Pixelplacement/Surge/DisplayObject/Editor.meta
vendored
Normal file
@@ -0,0 +1,9 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 76df9d89226c52547a1d901d663c2ae9
|
||||
folderAsset: yes
|
||||
timeCreated: 1500598980
|
||||
licenseType: Store
|
||||
DefaultImporter:
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
82
Assets/External/Pixelplacement/Surge/DisplayObject/Editor/DisplayObjectEditor.cs
vendored
Normal file
82
Assets/External/Pixelplacement/Surge/DisplayObject/Editor/DisplayObjectEditor.cs
vendored
Normal file
@@ -0,0 +1,82 @@
|
||||
/// <summary>
|
||||
/// SURGE FRAMEWORK
|
||||
/// Author: Bob Berkebile
|
||||
/// Email: bobb@pixelplacement.com
|
||||
///
|
||||
/// Custom inspector for the DisplayObject class.
|
||||
///
|
||||
/// </summary>
|
||||
|
||||
using UnityEngine;
|
||||
using System.Collections;
|
||||
using UnityEditor;
|
||||
|
||||
namespace Pixelplacement
|
||||
{
|
||||
[CustomEditor (typeof (DisplayObject), true)]
|
||||
public class DisplayObjectEditor : UnityEditor.Editor
|
||||
{
|
||||
//Private Variables:
|
||||
DisplayObject _target;
|
||||
|
||||
//Init:
|
||||
void OnEnable()
|
||||
{
|
||||
_target = target as DisplayObject;
|
||||
}
|
||||
|
||||
//Inspector GUI:
|
||||
public override void OnInspectorGUI()
|
||||
{
|
||||
DrawDefaultInspector ();
|
||||
|
||||
GUILayout.BeginHorizontal ();
|
||||
DrawSoloButton ();
|
||||
DrawShowButton ();
|
||||
DrawHideButton ();
|
||||
DrawHideAllButton ();
|
||||
GUILayout.EndHorizontal ();
|
||||
}
|
||||
|
||||
//GUI Draw Methods:
|
||||
void DrawShowButton ()
|
||||
{
|
||||
GUI.color = Color.yellow;
|
||||
if (GUILayout.Button ("Show"))
|
||||
{
|
||||
Undo.RegisterCompleteObjectUndo (_target, "Show DisplayObject");
|
||||
_target.SetActive (true);
|
||||
}
|
||||
}
|
||||
|
||||
void DrawSoloButton ()
|
||||
{
|
||||
GUI.color = Color.green;
|
||||
if (GUILayout.Button ("Solo"))
|
||||
{
|
||||
Undo.RegisterCompleteObjectUndo (_target, "Solo DisplayObject");
|
||||
_target.Solo ();
|
||||
}
|
||||
}
|
||||
|
||||
void DrawHideButton ()
|
||||
{
|
||||
GUI.color = new Color (1, 0.5f, 0, 1);
|
||||
if (GUILayout.Button ("Hide"))
|
||||
{
|
||||
Undo.RegisterCompleteObjectUndo (_target, "Hide DisplayObject");
|
||||
_target.SetActive (false);
|
||||
}
|
||||
}
|
||||
|
||||
void DrawHideAllButton ()
|
||||
{
|
||||
GUI.color = Color.red;
|
||||
if (GUILayout.Button ("Hide All"))
|
||||
{
|
||||
Undo.RegisterCompleteObjectUndo (_target, "Hide all DisplayObjects");
|
||||
_target.HideAll ();
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
19
Assets/External/Pixelplacement/Surge/DisplayObject/Editor/DisplayObjectEditor.cs.meta
vendored
Normal file
19
Assets/External/Pixelplacement/Surge/DisplayObject/Editor/DisplayObjectEditor.cs.meta
vendored
Normal file
@@ -0,0 +1,19 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 1494a48c2c33dfc499b2bfdd0ce24f5b
|
||||
timeCreated: 1479232771
|
||||
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/DisplayObject/Editor/DisplayObjectEditor.cs
|
||||
uploadId: 467433
|
||||
9
Assets/External/Pixelplacement/Surge/Editor.meta
vendored
Normal file
9
Assets/External/Pixelplacement/Surge/Editor.meta
vendored
Normal file
@@ -0,0 +1,9 @@
|
||||
fileFormatVersion: 2
|
||||
guid: fad24824d7fb240929c2cf5ae694d87b
|
||||
folderAsset: yes
|
||||
timeCreated: 1500598979
|
||||
licenseType: Store
|
||||
DefaultImporter:
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
60
Assets/External/Pixelplacement/Surge/Editor/InitializationRequirements.cs
vendored
Normal file
60
Assets/External/Pixelplacement/Surge/Editor/InitializationRequirements.cs
vendored
Normal file
@@ -0,0 +1,60 @@
|
||||
/// <summary>
|
||||
/// SURGE FRAMEWORK
|
||||
/// Author: Bob Berkebile
|
||||
/// Email: bobb@pixelplacement.com
|
||||
///
|
||||
/// This looks over all pieces of the framework to ensure they are properly set up - this is normally needed if a script that was already added to a GameObject suddenly extends something with a RequireComponent which is a decent bug in my opinion but this approach seems to work as a decent safety net.
|
||||
///
|
||||
/// </summary>
|
||||
|
||||
using UnityEngine;
|
||||
using UnityEditor;
|
||||
using System;
|
||||
|
||||
namespace Pixelplacement
|
||||
{
|
||||
[InitializeOnLoad]
|
||||
public class InitializationRequirements
|
||||
{
|
||||
static InitializationRequirements ()
|
||||
{
|
||||
//state machines:
|
||||
StateMachine[] stateMachines = Resources.FindObjectsOfTypeAll<StateMachine> ();
|
||||
foreach (StateMachine item in stateMachines)
|
||||
{
|
||||
if (item.GetComponent<Initialization> () == null) item.gameObject.AddComponent<Initialization> ();
|
||||
}
|
||||
|
||||
//display object:
|
||||
DisplayObject[] displayObjects = Resources.FindObjectsOfTypeAll<DisplayObject> ();
|
||||
foreach (DisplayObject item in displayObjects)
|
||||
{
|
||||
if (item.GetComponent<Initialization> () == null) item.gameObject.AddComponent<Initialization> ();
|
||||
}
|
||||
|
||||
//singleton (generics require some hackery to find what we need):
|
||||
foreach (GameObject item in Resources.FindObjectsOfTypeAll<GameObject> ())
|
||||
{
|
||||
foreach (Component subItem in item.GetComponents<Component> ())
|
||||
{
|
||||
//bypass this component if its currently unavailable due to a broken or missing script:
|
||||
if (subItem == null) continue;
|
||||
|
||||
string baseType;
|
||||
|
||||
#if NETFX_CORE
|
||||
baseType = subItem.GetType ().GetTypeInfo ().BaseType.ToString ();
|
||||
#else
|
||||
baseType = subItem.GetType ().BaseType.ToString ();
|
||||
#endif
|
||||
|
||||
if (baseType.Contains ("Singleton") && baseType.Contains ("Pixelplacement"))
|
||||
{
|
||||
if (item.GetComponent<Initialization> () == null) item.gameObject.AddComponent<Initialization> ();
|
||||
continue;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
19
Assets/External/Pixelplacement/Surge/Editor/InitializationRequirements.cs.meta
vendored
Normal file
19
Assets/External/Pixelplacement/Surge/Editor/InitializationRequirements.cs.meta
vendored
Normal file
@@ -0,0 +1,19 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 782df48806e1e4bf69ff0e82ea46e2e7
|
||||
timeCreated: 1447256356
|
||||
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/Editor/InitializationRequirements.cs
|
||||
uploadId: 467433
|
||||
10
Assets/External/Pixelplacement/Surge/Events.meta
vendored
Normal file
10
Assets/External/Pixelplacement/Surge/Events.meta
vendored
Normal file
@@ -0,0 +1,10 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 5c6283dd06d004a02828ac6ba0adb1f0
|
||||
folderAsset: yes
|
||||
timeCreated: 1509649384
|
||||
licenseType: Store
|
||||
DefaultImporter:
|
||||
externalObjects: {}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
22
Assets/External/Pixelplacement/Surge/Events/Events.cs
vendored
Normal file
22
Assets/External/Pixelplacement/Surge/Events/Events.cs
vendored
Normal file
@@ -0,0 +1,22 @@
|
||||
/// <summary>
|
||||
/// SURGE FRAMEWORK
|
||||
/// Author: Bob Berkebile
|
||||
/// Email: bobb@pixelplacement.com
|
||||
/// </summary>
|
||||
|
||||
using System.Collections;
|
||||
using System.Collections.Generic;
|
||||
using UnityEngine;
|
||||
using UnityEngine.Events;
|
||||
|
||||
namespace Pixelplacement
|
||||
{
|
||||
[System.Serializable]
|
||||
public class GameObjectEvent : UnityEvent<GameObject> { }
|
||||
|
||||
[System.Serializable]
|
||||
public class ColliderButtonEvent : UnityEvent<ColliderButton> { }
|
||||
|
||||
[System.Serializable]
|
||||
public class BoolEvent : UnityEvent<bool> { }
|
||||
}
|
||||
20
Assets/External/Pixelplacement/Surge/Events/Events.cs.meta
vendored
Normal file
20
Assets/External/Pixelplacement/Surge/Events/Events.cs.meta
vendored
Normal file
@@ -0,0 +1,20 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 0ea39ae1e7cff46c083405d1e5bdb704
|
||||
timeCreated: 1509649392
|
||||
licenseType: Store
|
||||
MonoImporter:
|
||||
externalObjects: {}
|
||||
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/Events/Events.cs
|
||||
uploadId: 467433
|
||||
10
Assets/External/Pixelplacement/Surge/License.txt
vendored
Normal file
10
Assets/External/Pixelplacement/Surge/License.txt
vendored
Normal file
@@ -0,0 +1,10 @@
|
||||
The MIT License (MIT)
|
||||
|
||||
Surge Framework for Unity
|
||||
Copyright (c) 2017 Bob Berkebile - pixelplacement.com
|
||||
|
||||
Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:
|
||||
|
||||
The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.
|
||||
|
||||
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
||||
15
Assets/External/Pixelplacement/Surge/License.txt.meta
vendored
Normal file
15
Assets/External/Pixelplacement/Surge/License.txt.meta
vendored
Normal file
@@ -0,0 +1,15 @@
|
||||
fileFormatVersion: 2
|
||||
guid: e389e9bcd4f944c338327697bd209cad
|
||||
timeCreated: 1469016738
|
||||
licenseType: Store
|
||||
TextScriptImporter:
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
AssetOrigin:
|
||||
serializedVersion: 1
|
||||
productId: 107312
|
||||
packageName: Surge
|
||||
packageVersion: 1.0.48
|
||||
assetPath: Assets/Pixelplacement/Surge/License.txt
|
||||
uploadId: 467433
|
||||
25
Assets/External/Pixelplacement/Surge/ReadMe.txt
vendored
Normal file
25
Assets/External/Pixelplacement/Surge/ReadMe.txt
vendored
Normal file
@@ -0,0 +1,25 @@
|
||||
Surge
|
||||
http://surge.pixelplacement.com
|
||||
|
||||
A collection of free tools to help take your Unity development to another level so you can get things done faster.
|
||||
|
||||
Tween
|
||||
Animate anything with style and just one line of code.
|
||||
|
||||
State Machine
|
||||
Logical, visual, sane, organization for turning small things into powerful solutions.
|
||||
|
||||
Singleton
|
||||
Simplified global access, streamlined solution development and portable, reusable tool creation at your fingertips.
|
||||
|
||||
Display Object
|
||||
Ultimate control for visual content availability.
|
||||
|
||||
Spline
|
||||
Powerful and elegant tools for visualing a spline, moving objects along a complex path, controlling particles systems and more!
|
||||
|
||||
Collider Button
|
||||
A unified button solution that operates as expected across any and all platforms from mobile to virtual reality.
|
||||
|
||||
Chooser
|
||||
The complete solution for identifying and responding to pointing or gazing.
|
||||
9
Assets/External/Pixelplacement/Surge/ReadMe.txt.meta
vendored
Normal file
9
Assets/External/Pixelplacement/Surge/ReadMe.txt.meta
vendored
Normal file
@@ -0,0 +1,9 @@
|
||||
fileFormatVersion: 2
|
||||
guid: f1e0da947b69648fdb1884d602088d92
|
||||
AssetOrigin:
|
||||
serializedVersion: 1
|
||||
productId: 107312
|
||||
packageName: Surge
|
||||
packageVersion: 1.0.48
|
||||
assetPath: Assets/Pixelplacement/Surge/ReadMe.txt
|
||||
uploadId: 467433
|
||||
9
Assets/External/Pixelplacement/Surge/Singleton.meta
vendored
Normal file
9
Assets/External/Pixelplacement/Surge/Singleton.meta
vendored
Normal file
@@ -0,0 +1,9 @@
|
||||
fileFormatVersion: 2
|
||||
guid: ac0c11ce590164764ad3638b17cb5475
|
||||
folderAsset: yes
|
||||
timeCreated: 1500598979
|
||||
licenseType: Store
|
||||
DefaultImporter:
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
78
Assets/External/Pixelplacement/Surge/Singleton/Singleton.cs
vendored
Normal file
78
Assets/External/Pixelplacement/Surge/Singleton/Singleton.cs
vendored
Normal file
@@ -0,0 +1,78 @@
|
||||
/// <summary>
|
||||
/// SURGE FRAMEWORK
|
||||
/// Author: Bob Berkebile
|
||||
/// Email: bobb@pixelplacement.com
|
||||
///
|
||||
/// A generic singleton.
|
||||
///
|
||||
/// </summary>
|
||||
|
||||
using System;
|
||||
using UnityEngine;
|
||||
using System.Collections;
|
||||
|
||||
namespace Pixelplacement
|
||||
{
|
||||
[RequireComponent(typeof(Initialization))]
|
||||
public abstract class Singleton<T> : MonoBehaviour
|
||||
{
|
||||
//Public Properties:
|
||||
/// <summary>
|
||||
/// Gets the instance.
|
||||
/// </summary>
|
||||
public static T Instance
|
||||
{
|
||||
get
|
||||
{
|
||||
if (_instance == null)
|
||||
{
|
||||
Debug.LogError("Singleton not registered! Make sure the GameObject running your singleton is active in your scene and has an Initialization component attached.");
|
||||
return default(T);
|
||||
}
|
||||
return _instance;
|
||||
}
|
||||
}
|
||||
|
||||
//Private Variables:
|
||||
[SerializeField] bool _dontDestroyOnLoad = false;
|
||||
static T _instance;
|
||||
|
||||
//Virtual Methods:
|
||||
/// <summary>
|
||||
/// Override this method to have code run when this singleton is initialized which is guaranteed to run before Awake and Start.
|
||||
/// </summary>
|
||||
protected virtual void OnRegistration()
|
||||
{
|
||||
}
|
||||
|
||||
//Public Methods:
|
||||
/// <summary>
|
||||
/// Generic method that registers the singleton instance.
|
||||
/// </summary>
|
||||
public void RegisterSingleton(T instance)
|
||||
{
|
||||
_instance = instance;
|
||||
}
|
||||
|
||||
//Private Methods:
|
||||
protected void Initialize(T instance)
|
||||
{
|
||||
if (_dontDestroyOnLoad && _instance != null)
|
||||
{
|
||||
//there is already an instance:
|
||||
Destroy(gameObject);
|
||||
return;
|
||||
}
|
||||
|
||||
if (_dontDestroyOnLoad)
|
||||
{
|
||||
//don't destroy on load only works on root objects so let's force this transform to be a root object:
|
||||
transform.parent = null;
|
||||
DontDestroyOnLoad(gameObject);
|
||||
}
|
||||
|
||||
_instance = instance;
|
||||
OnRegistration();
|
||||
}
|
||||
}
|
||||
}
|
||||
19
Assets/External/Pixelplacement/Surge/Singleton/Singleton.cs.meta
vendored
Normal file
19
Assets/External/Pixelplacement/Surge/Singleton/Singleton.cs.meta
vendored
Normal file
@@ -0,0 +1,19 @@
|
||||
fileFormatVersion: 2
|
||||
guid: b7d30087f7a6b44dcb88559bb6032379
|
||||
timeCreated: 1476073265
|
||||
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/Singleton/Singleton.cs
|
||||
uploadId: 467433
|
||||
9
Assets/External/Pixelplacement/Surge/Spline.meta
vendored
Normal file
9
Assets/External/Pixelplacement/Surge/Spline.meta
vendored
Normal file
@@ -0,0 +1,9 @@
|
||||
fileFormatVersion: 2
|
||||
guid: f2c0ddbd051694e06a215cd3fa97273c
|
||||
folderAsset: yes
|
||||
timeCreated: 1500598979
|
||||
licenseType: Store
|
||||
DefaultImporter:
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
9
Assets/External/Pixelplacement/Surge/Spline/Art.meta
vendored
Normal file
9
Assets/External/Pixelplacement/Surge/Spline/Art.meta
vendored
Normal file
@@ -0,0 +1,9 @@
|
||||
fileFormatVersion: 2
|
||||
guid: ee8affbccac6549ac82fb8f39c805b85
|
||||
folderAsset: yes
|
||||
timeCreated: 1500598980
|
||||
licenseType: Store
|
||||
DefaultImporter:
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
9
Assets/External/Pixelplacement/Surge/Spline/Art/Materials.meta
vendored
Normal file
9
Assets/External/Pixelplacement/Surge/Spline/Art/Materials.meta
vendored
Normal file
@@ -0,0 +1,9 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 848bc5a07520549dfbc8f3e76b14f33d
|
||||
folderAsset: yes
|
||||
timeCreated: 1500598980
|
||||
licenseType: Store
|
||||
DefaultImporter:
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
127
Assets/External/Pixelplacement/Surge/Spline/Art/Materials/Node.mat
vendored
Normal file
127
Assets/External/Pixelplacement/Surge/Spline/Art/Materials/Node.mat
vendored
Normal file
@@ -0,0 +1,127 @@
|
||||
%YAML 1.1
|
||||
%TAG !u! tag:unity3d.com,2011:
|
||||
--- !u!21 &2100000
|
||||
Material:
|
||||
serializedVersion: 6
|
||||
m_ObjectHideFlags: 0
|
||||
m_PrefabParentObject: {fileID: 0}
|
||||
m_PrefabInternal: {fileID: 0}
|
||||
m_Name: Node
|
||||
m_Shader: {fileID: 4800000, guid: 11970eb7b004b42a88ab68ab6772c39f, type: 3}
|
||||
m_ShaderKeywords: _EMISSION
|
||||
m_LightmapFlags: 1
|
||||
m_CustomRenderQueue: 8792
|
||||
stringTagMap: {}
|
||||
m_SavedProperties:
|
||||
serializedVersion: 2
|
||||
m_TexEnvs:
|
||||
- first:
|
||||
name: _BumpMap
|
||||
second:
|
||||
m_Texture: {fileID: 0}
|
||||
m_Scale: {x: 1, y: 1}
|
||||
m_Offset: {x: 0, y: 0}
|
||||
- first:
|
||||
name: _DetailAlbedoMap
|
||||
second:
|
||||
m_Texture: {fileID: 0}
|
||||
m_Scale: {x: 1, y: 1}
|
||||
m_Offset: {x: 0, y: 0}
|
||||
- first:
|
||||
name: _DetailMask
|
||||
second:
|
||||
m_Texture: {fileID: 0}
|
||||
m_Scale: {x: 1, y: 1}
|
||||
m_Offset: {x: 0, y: 0}
|
||||
- first:
|
||||
name: _DetailNormalMap
|
||||
second:
|
||||
m_Texture: {fileID: 0}
|
||||
m_Scale: {x: 1, y: 1}
|
||||
m_Offset: {x: 0, y: 0}
|
||||
- first:
|
||||
name: _EmissionMap
|
||||
second:
|
||||
m_Texture: {fileID: 0}
|
||||
m_Scale: {x: 1, y: 1}
|
||||
m_Offset: {x: 0, y: 0}
|
||||
- first:
|
||||
name: _MainTex
|
||||
second:
|
||||
m_Texture: {fileID: 0}
|
||||
m_Scale: {x: 1, y: 1}
|
||||
m_Offset: {x: 0, y: 0}
|
||||
- first:
|
||||
name: _MetallicGlossMap
|
||||
second:
|
||||
m_Texture: {fileID: 0}
|
||||
m_Scale: {x: 1, y: 1}
|
||||
m_Offset: {x: 0, y: 0}
|
||||
- first:
|
||||
name: _OcclusionMap
|
||||
second:
|
||||
m_Texture: {fileID: 0}
|
||||
m_Scale: {x: 1, y: 1}
|
||||
m_Offset: {x: 0, y: 0}
|
||||
- first:
|
||||
name: _ParallaxMap
|
||||
second:
|
||||
m_Texture: {fileID: 0}
|
||||
m_Scale: {x: 1, y: 1}
|
||||
m_Offset: {x: 0, y: 0}
|
||||
m_Floats:
|
||||
- first:
|
||||
name: _BumpScale
|
||||
second: 1
|
||||
- first:
|
||||
name: _Cutoff
|
||||
second: 0.5
|
||||
- first:
|
||||
name: _DetailNormalMapScale
|
||||
second: 1
|
||||
- first:
|
||||
name: _DstBlend
|
||||
second: 0
|
||||
- first:
|
||||
name: _GlossMapScale
|
||||
second: 1
|
||||
- first:
|
||||
name: _Glossiness
|
||||
second: 0.5
|
||||
- first:
|
||||
name: _GlossyReflections
|
||||
second: 1
|
||||
- first:
|
||||
name: _Metallic
|
||||
second: 0
|
||||
- first:
|
||||
name: _Mode
|
||||
second: 0
|
||||
- first:
|
||||
name: _OcclusionStrength
|
||||
second: 1
|
||||
- first:
|
||||
name: _Parallax
|
||||
second: 0.02
|
||||
- first:
|
||||
name: _SmoothnessTextureChannel
|
||||
second: 0
|
||||
- first:
|
||||
name: _SpecularHighlights
|
||||
second: 1
|
||||
- first:
|
||||
name: _SrcBlend
|
||||
second: 1
|
||||
- first:
|
||||
name: _UVSec
|
||||
second: 0
|
||||
- first:
|
||||
name: _ZWrite
|
||||
second: 1
|
||||
m_Colors:
|
||||
- first:
|
||||
name: _Color
|
||||
second: {r: 1, g: 1, b: 1, a: 0}
|
||||
- first:
|
||||
name: _EmissionColor
|
||||
second: {r: 0, g: 0, b: 0, a: 1}
|
||||
15
Assets/External/Pixelplacement/Surge/Spline/Art/Materials/Node.mat.meta
vendored
Normal file
15
Assets/External/Pixelplacement/Surge/Spline/Art/Materials/Node.mat.meta
vendored
Normal file
@@ -0,0 +1,15 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 1642fbcacc9dc42ed934b98457781f23
|
||||
timeCreated: 1479356539
|
||||
licenseType: Store
|
||||
NativeFormatImporter:
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
AssetOrigin:
|
||||
serializedVersion: 1
|
||||
productId: 107312
|
||||
packageName: Surge
|
||||
packageVersion: 1.0.48
|
||||
assetPath: Assets/Pixelplacement/Surge/Spline/Art/Materials/Node.mat
|
||||
uploadId: 467433
|
||||
9
Assets/External/Pixelplacement/Surge/Spline/Art/Models.meta
vendored
Normal file
9
Assets/External/Pixelplacement/Surge/Spline/Art/Models.meta
vendored
Normal file
@@ -0,0 +1,9 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 30cf75c7ac7044e7e926279230158d65
|
||||
folderAsset: yes
|
||||
timeCreated: 1500598981
|
||||
licenseType: Store
|
||||
DefaultImporter:
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
9
Assets/External/Pixelplacement/Surge/Spline/Art/Models/Node.meta
vendored
Normal file
9
Assets/External/Pixelplacement/Surge/Spline/Art/Models/Node.meta
vendored
Normal file
@@ -0,0 +1,9 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 958d750a1fed14c4287b588b02d25610
|
||||
folderAsset: yes
|
||||
timeCreated: 1500598981
|
||||
licenseType: Store
|
||||
DefaultImporter:
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
9
Assets/External/Pixelplacement/Surge/Spline/Art/Models/Node/Materials.meta
vendored
Normal file
9
Assets/External/Pixelplacement/Surge/Spline/Art/Models/Node/Materials.meta
vendored
Normal file
@@ -0,0 +1,9 @@
|
||||
fileFormatVersion: 2
|
||||
guid: ef5ff669963e0470599f2a05b6612d19
|
||||
folderAsset: yes
|
||||
timeCreated: 1500598981
|
||||
licenseType: Store
|
||||
DefaultImporter:
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
127
Assets/External/Pixelplacement/Surge/Spline/Art/Models/Node/Materials/Node.mat
vendored
Normal file
127
Assets/External/Pixelplacement/Surge/Spline/Art/Models/Node/Materials/Node.mat
vendored
Normal file
@@ -0,0 +1,127 @@
|
||||
%YAML 1.1
|
||||
%TAG !u! tag:unity3d.com,2011:
|
||||
--- !u!21 &2100000
|
||||
Material:
|
||||
serializedVersion: 6
|
||||
m_ObjectHideFlags: 0
|
||||
m_PrefabParentObject: {fileID: 0}
|
||||
m_PrefabInternal: {fileID: 0}
|
||||
m_Name: Node
|
||||
m_Shader: {fileID: 46, guid: 0000000000000000f000000000000000, type: 0}
|
||||
m_ShaderKeywords: _EMISSION
|
||||
m_LightmapFlags: 1
|
||||
m_CustomRenderQueue: -1
|
||||
stringTagMap: {}
|
||||
m_SavedProperties:
|
||||
serializedVersion: 2
|
||||
m_TexEnvs:
|
||||
- first:
|
||||
name: _BumpMap
|
||||
second:
|
||||
m_Texture: {fileID: 0}
|
||||
m_Scale: {x: 1, y: 1}
|
||||
m_Offset: {x: 0, y: 0}
|
||||
- first:
|
||||
name: _DetailAlbedoMap
|
||||
second:
|
||||
m_Texture: {fileID: 0}
|
||||
m_Scale: {x: 1, y: 1}
|
||||
m_Offset: {x: 0, y: 0}
|
||||
- first:
|
||||
name: _DetailMask
|
||||
second:
|
||||
m_Texture: {fileID: 0}
|
||||
m_Scale: {x: 1, y: 1}
|
||||
m_Offset: {x: 0, y: 0}
|
||||
- first:
|
||||
name: _DetailNormalMap
|
||||
second:
|
||||
m_Texture: {fileID: 0}
|
||||
m_Scale: {x: 1, y: 1}
|
||||
m_Offset: {x: 0, y: 0}
|
||||
- first:
|
||||
name: _EmissionMap
|
||||
second:
|
||||
m_Texture: {fileID: 0}
|
||||
m_Scale: {x: 1, y: 1}
|
||||
m_Offset: {x: 0, y: 0}
|
||||
- first:
|
||||
name: _MainTex
|
||||
second:
|
||||
m_Texture: {fileID: 0}
|
||||
m_Scale: {x: 1, y: 1}
|
||||
m_Offset: {x: 0, y: 0}
|
||||
- first:
|
||||
name: _MetallicGlossMap
|
||||
second:
|
||||
m_Texture: {fileID: 0}
|
||||
m_Scale: {x: 1, y: 1}
|
||||
m_Offset: {x: 0, y: 0}
|
||||
- first:
|
||||
name: _OcclusionMap
|
||||
second:
|
||||
m_Texture: {fileID: 0}
|
||||
m_Scale: {x: 1, y: 1}
|
||||
m_Offset: {x: 0, y: 0}
|
||||
- first:
|
||||
name: _ParallaxMap
|
||||
second:
|
||||
m_Texture: {fileID: 0}
|
||||
m_Scale: {x: 1, y: 1}
|
||||
m_Offset: {x: 0, y: 0}
|
||||
m_Floats:
|
||||
- first:
|
||||
name: _BumpScale
|
||||
second: 1
|
||||
- first:
|
||||
name: _Cutoff
|
||||
second: 0.5
|
||||
- first:
|
||||
name: _DetailNormalMapScale
|
||||
second: 1
|
||||
- first:
|
||||
name: _DstBlend
|
||||
second: 0
|
||||
- first:
|
||||
name: _GlossMapScale
|
||||
second: 1
|
||||
- first:
|
||||
name: _Glossiness
|
||||
second: 0.5
|
||||
- first:
|
||||
name: _GlossyReflections
|
||||
second: 1
|
||||
- first:
|
||||
name: _Metallic
|
||||
second: 0
|
||||
- first:
|
||||
name: _Mode
|
||||
second: 0
|
||||
- first:
|
||||
name: _OcclusionStrength
|
||||
second: 1
|
||||
- first:
|
||||
name: _Parallax
|
||||
second: 0.02
|
||||
- first:
|
||||
name: _SmoothnessTextureChannel
|
||||
second: 0
|
||||
- first:
|
||||
name: _SpecularHighlights
|
||||
second: 1
|
||||
- first:
|
||||
name: _SrcBlend
|
||||
second: 1
|
||||
- first:
|
||||
name: _UVSec
|
||||
second: 0
|
||||
- first:
|
||||
name: _ZWrite
|
||||
second: 1
|
||||
m_Colors:
|
||||
- first:
|
||||
name: _Color
|
||||
second: {r: 0.7, g: 0.7, b: 0.7, a: 1}
|
||||
- first:
|
||||
name: _EmissionColor
|
||||
second: {r: 0, g: 0, b: 0, a: 1}
|
||||
15
Assets/External/Pixelplacement/Surge/Spline/Art/Models/Node/Materials/Node.mat.meta
vendored
Normal file
15
Assets/External/Pixelplacement/Surge/Spline/Art/Models/Node/Materials/Node.mat.meta
vendored
Normal file
@@ -0,0 +1,15 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 2e1a4aa1789a64bf1ad83e97f3ec44d7
|
||||
timeCreated: 1483156177
|
||||
licenseType: Store
|
||||
NativeFormatImporter:
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
AssetOrigin:
|
||||
serializedVersion: 1
|
||||
productId: 107312
|
||||
packageName: Surge
|
||||
packageVersion: 1.0.48
|
||||
assetPath: Assets/Pixelplacement/Surge/Spline/Art/Models/Node/Materials/Node.mat
|
||||
uploadId: 467433
|
||||
BIN
Assets/External/Pixelplacement/Surge/Spline/Art/Models/Node/Node.fbx
vendored
Normal file
BIN
Assets/External/Pixelplacement/Surge/Spline/Art/Models/Node/Node.fbx
vendored
Normal file
Binary file not shown.
84
Assets/External/Pixelplacement/Surge/Spline/Art/Models/Node/Node.fbx.meta
vendored
Normal file
84
Assets/External/Pixelplacement/Surge/Spline/Art/Models/Node/Node.fbx.meta
vendored
Normal file
@@ -0,0 +1,84 @@
|
||||
fileFormatVersion: 2
|
||||
guid: eae229cde7c374059a09c8052360682c
|
||||
timeCreated: 1483156177
|
||||
licenseType: Store
|
||||
ModelImporter:
|
||||
serializedVersion: 19
|
||||
fileIDToRecycleName:
|
||||
100000: //RootNode
|
||||
400000: //RootNode
|
||||
2300000: //RootNode
|
||||
3300000: //RootNode
|
||||
4300000: Node
|
||||
9500000: //RootNode
|
||||
materials:
|
||||
importMaterials: 1
|
||||
materialName: 0
|
||||
materialSearch: 1
|
||||
animations:
|
||||
legacyGenerateAnimations: 4
|
||||
bakeSimulation: 0
|
||||
resampleCurves: 1
|
||||
optimizeGameObjects: 0
|
||||
motionNodeName:
|
||||
animationImportErrors:
|
||||
animationImportWarnings:
|
||||
animationRetargetingWarnings:
|
||||
animationDoRetargetingWarnings: 0
|
||||
animationCompression: 1
|
||||
animationRotationError: 0.5
|
||||
animationPositionError: 0.5
|
||||
animationScaleError: 0.5
|
||||
animationWrapMode: 0
|
||||
extraExposedTransformPaths: []
|
||||
clipAnimations: []
|
||||
isReadable: 1
|
||||
meshes:
|
||||
lODScreenPercentages: []
|
||||
globalScale: 1
|
||||
meshCompression: 0
|
||||
addColliders: 0
|
||||
importBlendShapes: 1
|
||||
swapUVChannels: 0
|
||||
generateSecondaryUV: 0
|
||||
useFileUnits: 1
|
||||
optimizeMeshForGPU: 1
|
||||
keepQuads: 0
|
||||
weldVertices: 1
|
||||
secondaryUVAngleDistortion: 8
|
||||
secondaryUVAreaDistortion: 15.000001
|
||||
secondaryUVHardAngle: 88
|
||||
secondaryUVPackMargin: 4
|
||||
useFileScale: 1
|
||||
tangentSpace:
|
||||
normalSmoothAngle: 60
|
||||
normalImportMode: 0
|
||||
tangentImportMode: 3
|
||||
importAnimation: 1
|
||||
copyAvatar: 0
|
||||
humanDescription:
|
||||
human: []
|
||||
skeleton: []
|
||||
armTwist: 0.5
|
||||
foreArmTwist: 0.5
|
||||
upperLegTwist: 0.5
|
||||
legTwist: 0.5
|
||||
armStretch: 0.05
|
||||
legStretch: 0.05
|
||||
feetSpacing: 0
|
||||
rootMotionBoneName:
|
||||
hasTranslationDoF: 0
|
||||
lastHumanDescriptionAvatarSource: {instanceID: 0}
|
||||
animationType: 0
|
||||
humanoidOversampling: 1
|
||||
additionalBone: 0
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
AssetOrigin:
|
||||
serializedVersion: 1
|
||||
productId: 107312
|
||||
packageName: Surge
|
||||
packageVersion: 1.0.48
|
||||
assetPath: Assets/Pixelplacement/Surge/Spline/Art/Models/Node/Node.fbx
|
||||
uploadId: 467433
|
||||
9
Assets/External/Pixelplacement/Surge/Spline/Art/Models/ScaleNode.meta
vendored
Normal file
9
Assets/External/Pixelplacement/Surge/Spline/Art/Models/ScaleNode.meta
vendored
Normal file
@@ -0,0 +1,9 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 310ca64957859452682f4f8b755d00e3
|
||||
folderAsset: yes
|
||||
timeCreated: 1500598981
|
||||
licenseType: Store
|
||||
DefaultImporter:
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
9
Assets/External/Pixelplacement/Surge/Spline/Art/Models/ScaleNode/Materials.meta
vendored
Normal file
9
Assets/External/Pixelplacement/Surge/Spline/Art/Models/ScaleNode/Materials.meta
vendored
Normal file
@@ -0,0 +1,9 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 920f79e699daa4471bc705a40d5ea68a
|
||||
folderAsset: yes
|
||||
timeCreated: 1500598981
|
||||
licenseType: Store
|
||||
DefaultImporter:
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
127
Assets/External/Pixelplacement/Surge/Spline/Art/Models/ScaleNode/Materials/ScaleNode.mat
vendored
Normal file
127
Assets/External/Pixelplacement/Surge/Spline/Art/Models/ScaleNode/Materials/ScaleNode.mat
vendored
Normal file
@@ -0,0 +1,127 @@
|
||||
%YAML 1.1
|
||||
%TAG !u! tag:unity3d.com,2011:
|
||||
--- !u!21 &2100000
|
||||
Material:
|
||||
serializedVersion: 6
|
||||
m_ObjectHideFlags: 0
|
||||
m_PrefabParentObject: {fileID: 0}
|
||||
m_PrefabInternal: {fileID: 0}
|
||||
m_Name: ScaleNode
|
||||
m_Shader: {fileID: 46, guid: 0000000000000000f000000000000000, type: 0}
|
||||
m_ShaderKeywords: _EMISSION
|
||||
m_LightmapFlags: 1
|
||||
m_CustomRenderQueue: -1
|
||||
stringTagMap: {}
|
||||
m_SavedProperties:
|
||||
serializedVersion: 2
|
||||
m_TexEnvs:
|
||||
- first:
|
||||
name: _BumpMap
|
||||
second:
|
||||
m_Texture: {fileID: 0}
|
||||
m_Scale: {x: 1, y: 1}
|
||||
m_Offset: {x: 0, y: 0}
|
||||
- first:
|
||||
name: _DetailAlbedoMap
|
||||
second:
|
||||
m_Texture: {fileID: 0}
|
||||
m_Scale: {x: 1, y: 1}
|
||||
m_Offset: {x: 0, y: 0}
|
||||
- first:
|
||||
name: _DetailMask
|
||||
second:
|
||||
m_Texture: {fileID: 0}
|
||||
m_Scale: {x: 1, y: 1}
|
||||
m_Offset: {x: 0, y: 0}
|
||||
- first:
|
||||
name: _DetailNormalMap
|
||||
second:
|
||||
m_Texture: {fileID: 0}
|
||||
m_Scale: {x: 1, y: 1}
|
||||
m_Offset: {x: 0, y: 0}
|
||||
- first:
|
||||
name: _EmissionMap
|
||||
second:
|
||||
m_Texture: {fileID: 0}
|
||||
m_Scale: {x: 1, y: 1}
|
||||
m_Offset: {x: 0, y: 0}
|
||||
- first:
|
||||
name: _MainTex
|
||||
second:
|
||||
m_Texture: {fileID: 0}
|
||||
m_Scale: {x: 1, y: 1}
|
||||
m_Offset: {x: 0, y: 0}
|
||||
- first:
|
||||
name: _MetallicGlossMap
|
||||
second:
|
||||
m_Texture: {fileID: 0}
|
||||
m_Scale: {x: 1, y: 1}
|
||||
m_Offset: {x: 0, y: 0}
|
||||
- first:
|
||||
name: _OcclusionMap
|
||||
second:
|
||||
m_Texture: {fileID: 0}
|
||||
m_Scale: {x: 1, y: 1}
|
||||
m_Offset: {x: 0, y: 0}
|
||||
- first:
|
||||
name: _ParallaxMap
|
||||
second:
|
||||
m_Texture: {fileID: 0}
|
||||
m_Scale: {x: 1, y: 1}
|
||||
m_Offset: {x: 0, y: 0}
|
||||
m_Floats:
|
||||
- first:
|
||||
name: _BumpScale
|
||||
second: 1
|
||||
- first:
|
||||
name: _Cutoff
|
||||
second: 0.5
|
||||
- first:
|
||||
name: _DetailNormalMapScale
|
||||
second: 1
|
||||
- first:
|
||||
name: _DstBlend
|
||||
second: 0
|
||||
- first:
|
||||
name: _GlossMapScale
|
||||
second: 1
|
||||
- first:
|
||||
name: _Glossiness
|
||||
second: 0.5
|
||||
- first:
|
||||
name: _GlossyReflections
|
||||
second: 1
|
||||
- first:
|
||||
name: _Metallic
|
||||
second: 0
|
||||
- first:
|
||||
name: _Mode
|
||||
second: 0
|
||||
- first:
|
||||
name: _OcclusionStrength
|
||||
second: 1
|
||||
- first:
|
||||
name: _Parallax
|
||||
second: 0.02
|
||||
- first:
|
||||
name: _SmoothnessTextureChannel
|
||||
second: 0
|
||||
- first:
|
||||
name: _SpecularHighlights
|
||||
second: 1
|
||||
- first:
|
||||
name: _SrcBlend
|
||||
second: 1
|
||||
- first:
|
||||
name: _UVSec
|
||||
second: 0
|
||||
- first:
|
||||
name: _ZWrite
|
||||
second: 1
|
||||
m_Colors:
|
||||
- first:
|
||||
name: _Color
|
||||
second: {r: 0.7, g: 0.7, b: 0.7, a: 1}
|
||||
- first:
|
||||
name: _EmissionColor
|
||||
second: {r: 0, g: 0, b: 0, a: 1}
|
||||
15
Assets/External/Pixelplacement/Surge/Spline/Art/Models/ScaleNode/Materials/ScaleNode.mat.meta
vendored
Normal file
15
Assets/External/Pixelplacement/Surge/Spline/Art/Models/ScaleNode/Materials/ScaleNode.mat.meta
vendored
Normal file
@@ -0,0 +1,15 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 0ac95597f20c94c12a751f4ee6918ecc
|
||||
timeCreated: 1483123098
|
||||
licenseType: Store
|
||||
NativeFormatImporter:
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
AssetOrigin:
|
||||
serializedVersion: 1
|
||||
productId: 107312
|
||||
packageName: Surge
|
||||
packageVersion: 1.0.48
|
||||
assetPath: Assets/Pixelplacement/Surge/Spline/Art/Models/ScaleNode/Materials/ScaleNode.mat
|
||||
uploadId: 467433
|
||||
BIN
Assets/External/Pixelplacement/Surge/Spline/Art/Models/ScaleNode/ScaleNode.fbx
vendored
Normal file
BIN
Assets/External/Pixelplacement/Surge/Spline/Art/Models/ScaleNode/ScaleNode.fbx
vendored
Normal file
Binary file not shown.
87
Assets/External/Pixelplacement/Surge/Spline/Art/Models/ScaleNode/ScaleNode.fbx.meta
vendored
Normal file
87
Assets/External/Pixelplacement/Surge/Spline/Art/Models/ScaleNode/ScaleNode.fbx.meta
vendored
Normal file
@@ -0,0 +1,87 @@
|
||||
fileFormatVersion: 2
|
||||
guid: c0de5c847168f47b48791e9f1912e7c0
|
||||
timeCreated: 1483123098
|
||||
licenseType: Store
|
||||
ModelImporter:
|
||||
serializedVersion: 19
|
||||
fileIDToRecycleName:
|
||||
100000: //RootNode
|
||||
100002: ScaleJoint
|
||||
400000: //RootNode
|
||||
400002: ScaleJoint
|
||||
2300000: //RootNode
|
||||
3300000: //RootNode
|
||||
4300000: Node
|
||||
9500000: //RootNode
|
||||
13700000: //RootNode
|
||||
materials:
|
||||
importMaterials: 1
|
||||
materialName: 0
|
||||
materialSearch: 1
|
||||
animations:
|
||||
legacyGenerateAnimations: 4
|
||||
bakeSimulation: 0
|
||||
resampleCurves: 1
|
||||
optimizeGameObjects: 0
|
||||
motionNodeName:
|
||||
animationImportErrors:
|
||||
animationImportWarnings:
|
||||
animationRetargetingWarnings:
|
||||
animationDoRetargetingWarnings: 0
|
||||
animationCompression: 3
|
||||
animationRotationError: 0.5
|
||||
animationPositionError: 0.5
|
||||
animationScaleError: 0.5
|
||||
animationWrapMode: 0
|
||||
extraExposedTransformPaths: []
|
||||
clipAnimations: []
|
||||
isReadable: 1
|
||||
meshes:
|
||||
lODScreenPercentages: []
|
||||
globalScale: 1
|
||||
meshCompression: 0
|
||||
addColliders: 0
|
||||
importBlendShapes: 1
|
||||
swapUVChannels: 0
|
||||
generateSecondaryUV: 0
|
||||
useFileUnits: 1
|
||||
optimizeMeshForGPU: 1
|
||||
keepQuads: 0
|
||||
weldVertices: 1
|
||||
secondaryUVAngleDistortion: 8
|
||||
secondaryUVAreaDistortion: 15.000001
|
||||
secondaryUVHardAngle: 88
|
||||
secondaryUVPackMargin: 4
|
||||
useFileScale: 1
|
||||
tangentSpace:
|
||||
normalSmoothAngle: 60
|
||||
normalImportMode: 0
|
||||
tangentImportMode: 3
|
||||
importAnimation: 0
|
||||
copyAvatar: 0
|
||||
humanDescription:
|
||||
human: []
|
||||
skeleton: []
|
||||
armTwist: 0.5
|
||||
foreArmTwist: 0.5
|
||||
upperLegTwist: 0.5
|
||||
legTwist: 0.5
|
||||
armStretch: 0.05
|
||||
legStretch: 0.05
|
||||
feetSpacing: 0
|
||||
rootMotionBoneName:
|
||||
hasTranslationDoF: 0
|
||||
lastHumanDescriptionAvatarSource: {instanceID: 0}
|
||||
animationType: 0
|
||||
humanoidOversampling: 1
|
||||
additionalBone: 0
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
AssetOrigin:
|
||||
serializedVersion: 1
|
||||
productId: 107312
|
||||
packageName: Surge
|
||||
packageVersion: 1.0.48
|
||||
assetPath: Assets/Pixelplacement/Surge/Spline/Art/Models/ScaleNode/ScaleNode.fbx
|
||||
uploadId: 467433
|
||||
9
Assets/External/Pixelplacement/Surge/Spline/Art/Shaders.meta
vendored
Normal file
9
Assets/External/Pixelplacement/Surge/Spline/Art/Shaders.meta
vendored
Normal file
@@ -0,0 +1,9 @@
|
||||
fileFormatVersion: 2
|
||||
guid: ebfbee500b6ab435b94f495a201f83a7
|
||||
folderAsset: yes
|
||||
timeCreated: 1500598980
|
||||
licenseType: Store
|
||||
DefaultImporter:
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
51
Assets/External/Pixelplacement/Surge/Spline/Art/Shaders/Invisible.shader
vendored
Normal file
51
Assets/External/Pixelplacement/Surge/Spline/Art/Shaders/Invisible.shader
vendored
Normal file
@@ -0,0 +1,51 @@
|
||||
/// <summary>
|
||||
/// SURGE FRAMEWORK
|
||||
/// Author: Bob Berkebile
|
||||
/// Email: bobb@pixelplacement.com
|
||||
/// </summary>
|
||||
|
||||
Shader "Invisible"
|
||||
{
|
||||
Subshader
|
||||
{
|
||||
Pass
|
||||
{
|
||||
GLSLPROGRAM
|
||||
#ifdef VERTEX
|
||||
void main() {}
|
||||
#endif
|
||||
|
||||
#ifdef FRAGMENT
|
||||
void main() {}
|
||||
#endif
|
||||
ENDGLSL
|
||||
}
|
||||
}
|
||||
|
||||
Subshader
|
||||
{
|
||||
Pass
|
||||
{
|
||||
CGPROGRAM
|
||||
#pragma vertex vert
|
||||
#pragma fragment frag
|
||||
struct v2f
|
||||
{
|
||||
fixed4 position : SV_POSITION;
|
||||
};
|
||||
|
||||
v2f vert()
|
||||
{
|
||||
v2f o;
|
||||
o.position = fixed4(0,0,0,0);
|
||||
return o;
|
||||
}
|
||||
|
||||
fixed4 frag() : COLOR
|
||||
{
|
||||
return fixed4(0,0,0,0);
|
||||
}
|
||||
ENDCG
|
||||
}
|
||||
}
|
||||
}
|
||||
16
Assets/External/Pixelplacement/Surge/Spline/Art/Shaders/Invisible.shader.meta
vendored
Normal file
16
Assets/External/Pixelplacement/Surge/Spline/Art/Shaders/Invisible.shader.meta
vendored
Normal file
@@ -0,0 +1,16 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 11970eb7b004b42a88ab68ab6772c39f
|
||||
timeCreated: 1482204536
|
||||
licenseType: Store
|
||||
ShaderImporter:
|
||||
defaultTextures: []
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
AssetOrigin:
|
||||
serializedVersion: 1
|
||||
productId: 107312
|
||||
packageName: Surge
|
||||
packageVersion: 1.0.48
|
||||
assetPath: Assets/Pixelplacement/Surge/Spline/Art/Shaders/Invisible.shader
|
||||
uploadId: 467433
|
||||
9
Assets/External/Pixelplacement/Surge/Spline/Editor.meta
vendored
Normal file
9
Assets/External/Pixelplacement/Surge/Spline/Editor.meta
vendored
Normal file
@@ -0,0 +1,9 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 274948d5adb104b28a8d42ee1308cee0
|
||||
folderAsset: yes
|
||||
timeCreated: 1500598980
|
||||
licenseType: Store
|
||||
DefaultImporter:
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
38
Assets/External/Pixelplacement/Surge/Spline/Editor/SplineAnchorEditor.cs
vendored
Normal file
38
Assets/External/Pixelplacement/Surge/Spline/Editor/SplineAnchorEditor.cs
vendored
Normal file
@@ -0,0 +1,38 @@
|
||||
/// <summary>
|
||||
/// SURGE FRAMEWORK
|
||||
/// Author: Bob Berkebile
|
||||
/// Email: bobb@pixelplacement.com
|
||||
///
|
||||
/// Forces pivot mode to center so an anchor's pivot is always correct while adjusting a spline.
|
||||
///
|
||||
/// </summary>
|
||||
|
||||
using UnityEditor;
|
||||
using UnityEngine;
|
||||
|
||||
namespace Pixelplacement
|
||||
{
|
||||
[CustomEditor(typeof(SplineAnchor))]
|
||||
public class SplineAnchorEditor : UnityEditor.Editor
|
||||
{
|
||||
//Scene GUI:
|
||||
void OnSceneGUI ()
|
||||
{
|
||||
//ensure pivot is used so anchor selection has a proper transform origin:
|
||||
if (Tools.pivotMode == PivotMode.Center)
|
||||
{
|
||||
Tools.pivotMode = PivotMode.Pivot;
|
||||
}
|
||||
}
|
||||
|
||||
//Gizmos:
|
||||
[DrawGizmo(GizmoType.Selected)]
|
||||
static void RenderCustomGizmo(Transform objectTransform, GizmoType gizmoType)
|
||||
{
|
||||
if (objectTransform.parent != null)
|
||||
{
|
||||
SplineEditor.RenderCustomGizmo(objectTransform.parent, gizmoType);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
19
Assets/External/Pixelplacement/Surge/Spline/Editor/SplineAnchorEditor.cs.meta
vendored
Normal file
19
Assets/External/Pixelplacement/Surge/Spline/Editor/SplineAnchorEditor.cs.meta
vendored
Normal file
@@ -0,0 +1,19 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 15d4e254e3652404797dcee644ec6a84
|
||||
timeCreated: 1483388323
|
||||
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/Spline/Editor/SplineAnchorEditor.cs
|
||||
uploadId: 467433
|
||||
136
Assets/External/Pixelplacement/Surge/Spline/Editor/SplineEditor.cs
vendored
Normal file
136
Assets/External/Pixelplacement/Surge/Spline/Editor/SplineEditor.cs
vendored
Normal file
@@ -0,0 +1,136 @@
|
||||
/// <summary>
|
||||
/// SURGE FRAMEWORK
|
||||
/// Author: Bob Berkebile
|
||||
/// Email: bobb@pixelplacement.com
|
||||
///
|
||||
/// Draws all controls for a spline.
|
||||
///
|
||||
/// </summary>
|
||||
|
||||
using UnityEditor;
|
||||
using UnityEngine;
|
||||
|
||||
namespace Pixelplacement
|
||||
{
|
||||
[CustomEditor(typeof(Spline))]
|
||||
public class SplineEditor : UnityEditor.Editor
|
||||
{
|
||||
//Private Variables
|
||||
Spline _target;
|
||||
|
||||
//Init:
|
||||
void OnEnable ()
|
||||
{
|
||||
_target = target as Spline;
|
||||
}
|
||||
|
||||
//Inspector:
|
||||
public override void OnInspectorGUI ()
|
||||
{
|
||||
//draw:
|
||||
DrawDefaultInspector ();
|
||||
DrawAddButton ();
|
||||
}
|
||||
|
||||
//Gizmo Overload:
|
||||
[DrawGizmo(GizmoType.Selected)]
|
||||
public static void RenderCustomGizmo (Transform objectTransform, GizmoType gizmoType)
|
||||
{
|
||||
DrawTools (objectTransform);
|
||||
}
|
||||
|
||||
//Scene GUI:
|
||||
void OnSceneGUI ()
|
||||
{
|
||||
DrawTools ((target as Spline).transform);
|
||||
}
|
||||
|
||||
//Draw Methods:
|
||||
void DrawAddButton ()
|
||||
{
|
||||
if (GUILayout.Button ("Extend"))
|
||||
{
|
||||
Undo.RegisterCreatedObjectUndo (_target.AddAnchors (1) [0], "Extend Spline");
|
||||
}
|
||||
}
|
||||
|
||||
static void DrawTools (Transform target)
|
||||
{
|
||||
Spline spline = target.GetComponent<Spline> ();
|
||||
if (spline == null) return;
|
||||
if (target.transform.childCount == 0) return;
|
||||
|
||||
//set primary draw color:
|
||||
Handles.color = spline.SecondaryColor;
|
||||
|
||||
for (int i = 0; i < spline.Anchors.Length; i++)
|
||||
{
|
||||
//refs:
|
||||
Quaternion lookRotation = Quaternion.identity;
|
||||
SplineAnchor currentAnchor = spline.Anchors[i];
|
||||
|
||||
//scale geometry:
|
||||
currentAnchor.InTangent.localScale = Vector3.one * (spline.toolScale * 1.3f);
|
||||
currentAnchor.OutTangent.localScale = Vector3.one * (spline.toolScale * 1.3f);
|
||||
currentAnchor.Anchor.localScale = Vector3.one * (spline.toolScale * 2.1f);
|
||||
|
||||
if (spline.toolScale > 0)
|
||||
{
|
||||
//draw persistent identifiers that face the scene view camera and only draw if the corrosponding tangent is active:
|
||||
if (currentAnchor.OutTangent.gameObject.activeSelf)
|
||||
{
|
||||
//connection:
|
||||
Handles.DrawDottedLine (currentAnchor.Anchor.position, currentAnchor.OutTangent.position, 3);
|
||||
|
||||
//indicators:
|
||||
if (SceneView.currentDrawingSceneView != null)
|
||||
{
|
||||
lookRotation = Quaternion.LookRotation ((SceneView.currentDrawingSceneView.camera.transform.position - currentAnchor.OutTangent.position).normalized);
|
||||
Handles.CircleHandleCap (0, currentAnchor.OutTangent.position, lookRotation, spline.toolScale * .65f, EventType.Repaint);
|
||||
Handles.CircleHandleCap (0, currentAnchor.OutTangent.position, lookRotation, spline.toolScale * .25f, EventType.Repaint);
|
||||
}
|
||||
}
|
||||
|
||||
if (currentAnchor.InTangent.gameObject.activeSelf)
|
||||
{
|
||||
//connection:
|
||||
Handles.DrawDottedLine (currentAnchor.Anchor.position, currentAnchor.InTangent.position, 3);
|
||||
|
||||
//indicators:
|
||||
if (SceneView.currentDrawingSceneView != null)
|
||||
{
|
||||
lookRotation = Quaternion.LookRotation ((SceneView.currentDrawingSceneView.camera.transform.position - currentAnchor.InTangent.position).normalized);
|
||||
Handles.CircleHandleCap (0, currentAnchor.InTangent.position, lookRotation, spline.toolScale * .65f, EventType.Repaint);
|
||||
Handles.CircleHandleCap (0, currentAnchor.InTangent.position, lookRotation, spline.toolScale * .25f, EventType.Repaint);
|
||||
}
|
||||
}
|
||||
|
||||
//anchor tools:
|
||||
if (SceneView.currentDrawingSceneView != null)
|
||||
{
|
||||
lookRotation = Quaternion.LookRotation ((SceneView.currentDrawingSceneView.camera.transform.position - currentAnchor.Anchor.position).normalized);
|
||||
Handles.CircleHandleCap (0, currentAnchor.Anchor.position, lookRotation, spline.toolScale, EventType.Repaint);
|
||||
}
|
||||
|
||||
//identify path origin:
|
||||
if (spline.direction == SplineDirection.Forward && i == 0 || spline.direction == SplineDirection.Backwards && i == spline.Anchors.Length - 1)
|
||||
{
|
||||
Handles.CircleHandleCap (0, currentAnchor.Anchor.position, lookRotation, spline.toolScale * .8f, EventType.Repaint);
|
||||
Handles.CircleHandleCap (0, currentAnchor.Anchor.position, lookRotation, spline.toolScale * .75f, EventType.Repaint);
|
||||
Handles.CircleHandleCap (0, currentAnchor.Anchor.position, lookRotation, spline.toolScale * .5f, EventType.Repaint);
|
||||
Handles.CircleHandleCap (0, currentAnchor.Anchor.position, lookRotation, spline.toolScale * .45f, EventType.Repaint);
|
||||
Handles.CircleHandleCap (0, currentAnchor.Anchor.position, lookRotation, spline.toolScale * .25f, EventType.Repaint);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
//draw spline:
|
||||
for (int i = 0; i < spline.Anchors.Length - 1; i++)
|
||||
{
|
||||
SplineAnchor startAnchor = spline.Anchors[i];
|
||||
SplineAnchor endAnchor = spline.Anchors[i+1];
|
||||
Handles.DrawBezier (startAnchor.Anchor.position, endAnchor.Anchor.position, startAnchor.OutTangent.position, endAnchor.InTangent.position, spline.color, null, 2);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
19
Assets/External/Pixelplacement/Surge/Spline/Editor/SplineEditor.cs.meta
vendored
Normal file
19
Assets/External/Pixelplacement/Surge/Spline/Editor/SplineEditor.cs.meta
vendored
Normal file
@@ -0,0 +1,19 @@
|
||||
fileFormatVersion: 2
|
||||
guid: bf584abde32dd4d28abdf7112e4cd744
|
||||
timeCreated: 1483123495
|
||||
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/Spline/Editor/SplineEditor.cs
|
||||
uploadId: 467433
|
||||
38
Assets/External/Pixelplacement/Surge/Spline/Editor/SplineTangentEditor.cs
vendored
Normal file
38
Assets/External/Pixelplacement/Surge/Spline/Editor/SplineTangentEditor.cs
vendored
Normal file
@@ -0,0 +1,38 @@
|
||||
/// <summary>
|
||||
/// SURGE FRAMEWORK
|
||||
/// Author: Bob Berkebile
|
||||
/// Email: bobb@pixelplacement.com
|
||||
///
|
||||
/// Forces pivot mode to center so an anchor's pivot is always correct while adjusting a spline.
|
||||
///
|
||||
/// </summary>
|
||||
|
||||
using UnityEditor;
|
||||
using UnityEngine;
|
||||
|
||||
namespace Pixelplacement
|
||||
{
|
||||
[CustomEditor(typeof(SplineTangent))]
|
||||
public class SplineTangentEditor : UnityEditor.Editor
|
||||
{
|
||||
//Scene GUI:
|
||||
void OnSceneGUI ()
|
||||
{
|
||||
//ensure pivot is used so anchor selection has a proper transform origin:
|
||||
if (Tools.pivotMode == PivotMode.Center)
|
||||
{
|
||||
Tools.pivotMode = PivotMode.Pivot;
|
||||
}
|
||||
}
|
||||
|
||||
//Gizmos:
|
||||
[DrawGizmo(GizmoType.Selected)]
|
||||
static void RenderCustomGizmo(Transform objectTransform, GizmoType gizmoType)
|
||||
{
|
||||
if (objectTransform.parent != null && objectTransform.parent.parent != null)
|
||||
{
|
||||
SplineEditor.RenderCustomGizmo(objectTransform.parent.parent, gizmoType);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
19
Assets/External/Pixelplacement/Surge/Spline/Editor/SplineTangentEditor.cs.meta
vendored
Normal file
19
Assets/External/Pixelplacement/Surge/Spline/Editor/SplineTangentEditor.cs.meta
vendored
Normal file
@@ -0,0 +1,19 @@
|
||||
fileFormatVersion: 2
|
||||
guid: def6dcf256e22a049928f540963d59f0
|
||||
timeCreated: 1532464219
|
||||
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/Spline/Editor/SplineTangentEditor.cs
|
||||
uploadId: 467433
|
||||
9
Assets/External/Pixelplacement/Surge/Spline/Objects.meta
vendored
Normal file
9
Assets/External/Pixelplacement/Surge/Spline/Objects.meta
vendored
Normal file
@@ -0,0 +1,9 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 76cb8730de7f6dc4196915f9f2ca0eb6
|
||||
folderAsset: yes
|
||||
timeCreated: 1505174723
|
||||
licenseType: Store
|
||||
DefaultImporter:
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
105
Assets/External/Pixelplacement/Surge/Spline/Objects/BezierCurves.cs
vendored
Normal file
105
Assets/External/Pixelplacement/Surge/Spline/Objects/BezierCurves.cs
vendored
Normal file
@@ -0,0 +1,105 @@
|
||||
/// <summary>
|
||||
/// SURGE FRAMEWORK
|
||||
/// Author: Bob Berkebile
|
||||
/// Email: bobb@pixelplacement.com
|
||||
///
|
||||
/// Methods for evaluating curves.
|
||||
///
|
||||
/// </summary>
|
||||
|
||||
using UnityEngine;
|
||||
|
||||
namespace Pixelplacement
|
||||
{
|
||||
public static class BezierCurves
|
||||
{
|
||||
//Quadratic Bezier:
|
||||
public static Vector3 GetPoint (Vector3 startPosition, Vector3 controlPoint, Vector3 endPosition, float percentage)
|
||||
{
|
||||
percentage = Mathf.Clamp01 (percentage);
|
||||
float oneMinusT = 1f - percentage;
|
||||
return oneMinusT * oneMinusT * startPosition + 2f * oneMinusT * percentage * controlPoint + percentage * percentage * endPosition;
|
||||
}
|
||||
|
||||
public static Vector3 GetFirstDerivative (Vector3 startPoint, Vector3 controlPoint, Vector3 endPosition, float percentage)
|
||||
{
|
||||
percentage = Mathf.Clamp01 (percentage);
|
||||
return 2f * (1f - percentage) * (controlPoint - startPoint) + 2f * percentage * (endPosition - controlPoint);
|
||||
}
|
||||
|
||||
//Cubic Bezier:
|
||||
public static Vector3 GetPoint (Vector3 startPosition, Vector3 endPosition, Vector3 startTangent, Vector3 endTangent, float percentage, bool evenDistribution, int distributionSteps)
|
||||
{
|
||||
if (evenDistribution)
|
||||
{
|
||||
int maxPoint = distributionSteps + 1;
|
||||
float[] arcLengths = new float[maxPoint];
|
||||
Vector3 previousPoint = Locate(startPosition, endPosition, startTangent, endTangent, 0);
|
||||
float sum = 0;
|
||||
|
||||
//store arc lengths:
|
||||
for (int i = 1; i < maxPoint; i++)
|
||||
{
|
||||
Vector3 p = Locate(startPosition, endPosition, startTangent, endTangent, i / (float)maxPoint);
|
||||
sum += Vector3.Distance(previousPoint, p);
|
||||
arcLengths[i] = sum;
|
||||
previousPoint = p;
|
||||
}
|
||||
|
||||
float targetLength = percentage * arcLengths[distributionSteps];
|
||||
|
||||
//search:
|
||||
int low = 0;
|
||||
int high = distributionSteps;
|
||||
int index = 0;
|
||||
while (low < high)
|
||||
{
|
||||
index = low + (((high - low) / 2) | 0);
|
||||
if (arcLengths[index] < targetLength)
|
||||
{
|
||||
low = index + 1;
|
||||
|
||||
}
|
||||
else
|
||||
{
|
||||
high = index;
|
||||
}
|
||||
}
|
||||
|
||||
//adjust:
|
||||
if (arcLengths[index] > targetLength)
|
||||
{
|
||||
index--;
|
||||
}
|
||||
|
||||
float lengthBefore = arcLengths[index];
|
||||
|
||||
//interpolate or use as is:
|
||||
if (lengthBefore == targetLength)
|
||||
{
|
||||
return Locate(startPosition, endPosition, startTangent, endTangent, index / distributionSteps);
|
||||
}
|
||||
else
|
||||
{
|
||||
return Locate(startPosition, endPosition, startTangent, endTangent, (index + (targetLength - lengthBefore) / (arcLengths[index + 1] - lengthBefore)) / distributionSteps);
|
||||
}
|
||||
}
|
||||
|
||||
return Locate(startPosition, endPosition, startTangent, endTangent, percentage);
|
||||
}
|
||||
|
||||
public static Vector3 GetFirstDerivative (Vector3 startPosition, Vector3 endPosition, Vector3 startTangent, Vector3 endTangent, float percentage)
|
||||
{
|
||||
percentage = Mathf.Clamp01 (percentage);
|
||||
float oneMinusT = 1f - percentage;
|
||||
return 3f * oneMinusT * oneMinusT * (startTangent - startPosition) + 6f * oneMinusT * percentage * (endTangent - startTangent) + 3f * percentage * percentage * (endPosition - endTangent);
|
||||
}
|
||||
|
||||
private static Vector3 Locate(Vector3 startPosition, Vector3 endPosition, Vector3 startTangent, Vector3 endTangent, float percentage)
|
||||
{
|
||||
percentage = Mathf.Clamp01(percentage);
|
||||
float oneMinusT = 1f - percentage;
|
||||
return oneMinusT * oneMinusT * oneMinusT * startPosition + 3f * oneMinusT * oneMinusT * percentage * startTangent + 3f * oneMinusT * percentage * percentage * endTangent + percentage * percentage * percentage * endPosition;
|
||||
}
|
||||
}
|
||||
}
|
||||
19
Assets/External/Pixelplacement/Surge/Spline/Objects/BezierCurves.cs.meta
vendored
Normal file
19
Assets/External/Pixelplacement/Surge/Spline/Objects/BezierCurves.cs.meta
vendored
Normal file
@@ -0,0 +1,19 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 09965dbc9fd354a369b626ee0e9ba143
|
||||
timeCreated: 1482974494
|
||||
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/Spline/Objects/BezierCurves.cs
|
||||
uploadId: 467433
|
||||
29
Assets/External/Pixelplacement/Surge/Spline/Objects/CurveDetail.cs
vendored
Normal file
29
Assets/External/Pixelplacement/Surge/Spline/Objects/CurveDetail.cs
vendored
Normal file
@@ -0,0 +1,29 @@
|
||||
/// <summary>
|
||||
/// SURGE FRAMEWORK
|
||||
/// Author: Bob Berkebile
|
||||
/// Email: bobb@pixelplacement.com
|
||||
///
|
||||
/// Holds details of a spline's curve.
|
||||
///
|
||||
/// </summary>
|
||||
|
||||
using System.Collections;
|
||||
using System.Collections.Generic;
|
||||
using UnityEngine;
|
||||
|
||||
namespace Pixelplacement
|
||||
{
|
||||
public struct CurveDetail
|
||||
{
|
||||
//Public Variables:
|
||||
public int currentCurve;
|
||||
public float currentCurvePercentage;
|
||||
|
||||
//Constructor:
|
||||
public CurveDetail (int currentCurve, float currentCurvePercentage)
|
||||
{
|
||||
this.currentCurve = currentCurve;
|
||||
this.currentCurvePercentage = currentCurvePercentage;
|
||||
}
|
||||
}
|
||||
}
|
||||
19
Assets/External/Pixelplacement/Surge/Spline/Objects/CurveDetail.cs.meta
vendored
Normal file
19
Assets/External/Pixelplacement/Surge/Spline/Objects/CurveDetail.cs.meta
vendored
Normal file
@@ -0,0 +1,19 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 5612bd02e9949884bbed28239455d20e
|
||||
timeCreated: 1505174773
|
||||
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/Spline/Objects/CurveDetail.cs
|
||||
uploadId: 467433
|
||||
527
Assets/External/Pixelplacement/Surge/Spline/Objects/Spline.cs
vendored
Normal file
527
Assets/External/Pixelplacement/Surge/Spline/Objects/Spline.cs
vendored
Normal file
@@ -0,0 +1,527 @@
|
||||
/// <summary>
|
||||
/// SURGE FRAMEWORK
|
||||
/// Author: Bob Berkebile
|
||||
/// Email: bobb@pixelplacement.com
|
||||
///
|
||||
/// Creates and manages splines.
|
||||
///
|
||||
/// </summary>
|
||||
|
||||
using UnityEngine;
|
||||
using System.Collections.Generic;
|
||||
using System;
|
||||
|
||||
namespace Pixelplacement
|
||||
{
|
||||
public enum SplineDirection { Forward, Backwards }
|
||||
|
||||
[ExecuteInEditMode]
|
||||
public class Spline : MonoBehaviour
|
||||
{
|
||||
//Public Events:
|
||||
public event Action OnSplineChanged;
|
||||
|
||||
//Private Classes
|
||||
private class SplineReparam
|
||||
{
|
||||
//Public Variables:
|
||||
public float length;
|
||||
public float percentage;
|
||||
|
||||
//Constructors:
|
||||
public SplineReparam(float length, float percentage)
|
||||
{
|
||||
this.length = length;
|
||||
this.percentage = percentage;
|
||||
}
|
||||
}
|
||||
|
||||
//Public Variables:
|
||||
public Color color = Color.yellow;
|
||||
[Range(0, 1)] public float toolScale = .1f;
|
||||
public TangentMode defaultTangentMode;
|
||||
public SplineDirection direction;
|
||||
public bool loop;
|
||||
public SplineFollower[] followers;
|
||||
|
||||
//Private Variables:
|
||||
private SplineAnchor[] _anchors;
|
||||
private int _curveCount;
|
||||
private int _previousAnchorCount;
|
||||
private int _previousChildCount;
|
||||
private bool _wasLooping;
|
||||
private bool _previousLoopChoice;
|
||||
private bool _anchorsChanged;
|
||||
private SplineDirection _previousDirection;
|
||||
private float _curvePercentage = 0;
|
||||
private int _operatingCurve = 0;
|
||||
private float _currentCurve = 0;
|
||||
private int _previousLength;
|
||||
private int _slicesPerCurve = 10;
|
||||
private List<SplineReparam> _splineReparams = new List<SplineReparam>();
|
||||
private bool _lengthDirty = true;
|
||||
|
||||
//Public Properties:
|
||||
public float Length
|
||||
{
|
||||
get;
|
||||
private set;
|
||||
}
|
||||
|
||||
public SplineAnchor[] Anchors
|
||||
{
|
||||
get
|
||||
{
|
||||
//if loop is toggled make sure we reset anchors:
|
||||
if (loop != _wasLooping)
|
||||
{
|
||||
_previousAnchorCount = -1;
|
||||
_wasLooping = loop;
|
||||
}
|
||||
|
||||
if (!loop)
|
||||
{
|
||||
if (transform.childCount != _previousAnchorCount || transform.childCount == 0)
|
||||
{
|
||||
_anchors = GetComponentsInChildren<SplineAnchor>();
|
||||
_previousAnchorCount = transform.childCount;
|
||||
}
|
||||
|
||||
return _anchors;
|
||||
}
|
||||
else
|
||||
{
|
||||
if (transform.childCount != _previousAnchorCount || transform.childCount == 0)
|
||||
{
|
||||
//for a loop we need an array whose last element is the first element:
|
||||
_anchors = GetComponentsInChildren<SplineAnchor>();
|
||||
Array.Resize(ref _anchors, _anchors.Length + 1);
|
||||
_anchors[_anchors.Length - 1] = _anchors[0];
|
||||
_previousAnchorCount = transform.childCount;
|
||||
}
|
||||
return _anchors;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public Color SecondaryColor
|
||||
{
|
||||
get
|
||||
{
|
||||
Color secondaryColor = Color.Lerp(color, Color.black, .2f);
|
||||
return secondaryColor;
|
||||
}
|
||||
}
|
||||
|
||||
//Init:
|
||||
void Reset()
|
||||
{
|
||||
//if we don't have at least 2 anchors, fix it:
|
||||
if (Anchors.Length < 2)
|
||||
{
|
||||
AddAnchors(2 - Anchors.Length);
|
||||
}
|
||||
}
|
||||
|
||||
//Loop:
|
||||
void Update()
|
||||
{
|
||||
//place followers (if supplied and something relavent changed):
|
||||
if (followers != null && followers.Length > 0 && Anchors.Length >= 2)
|
||||
{
|
||||
bool needToUpdate = false;
|
||||
|
||||
//was anything else changed?
|
||||
if (_anchorsChanged || _previousChildCount != transform.childCount || direction != _previousDirection || loop != _previousLoopChoice)
|
||||
{
|
||||
_previousChildCount = transform.childCount;
|
||||
_previousLoopChoice = loop;
|
||||
_previousDirection = direction;
|
||||
_anchorsChanged = false;
|
||||
needToUpdate = true;
|
||||
}
|
||||
|
||||
//were any followers moved?
|
||||
for (int i = 0; i < followers.Length; i++)
|
||||
{
|
||||
if (followers[i].WasMoved || needToUpdate)
|
||||
{
|
||||
followers[i].UpdateOrientation(this);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
//manage anchors:
|
||||
bool anchorChanged = false;
|
||||
if (Anchors.Length > 1)
|
||||
{
|
||||
for (int i = 0; i < Anchors.Length; i++)
|
||||
{
|
||||
//if this spline has changed notify and wipe cached percentage:
|
||||
if (Anchors[i].Changed)
|
||||
{
|
||||
anchorChanged = true;
|
||||
Anchors[i].Changed = false;
|
||||
_anchorsChanged = true;
|
||||
}
|
||||
|
||||
//if this isn't a loop then the first and last tangents are unnecessary:
|
||||
if (!loop)
|
||||
{
|
||||
//turn first tangent off:
|
||||
if (i == 0)
|
||||
{
|
||||
Anchors[i].SetTangentStatus(false, true);
|
||||
continue;
|
||||
}
|
||||
|
||||
//turn last tangent off:
|
||||
if (i == Anchors.Length - 1)
|
||||
{
|
||||
Anchors[i].SetTangentStatus(true, false);
|
||||
continue;
|
||||
}
|
||||
|
||||
//turn both tangents on:
|
||||
Anchors[i].SetTangentStatus(true, true);
|
||||
|
||||
}
|
||||
else
|
||||
{
|
||||
//all tangents are needed in a loop:
|
||||
Anchors[i].SetTangentStatus(true, true);
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
//length changed:
|
||||
if (_previousLength != Anchors.Length || anchorChanged)
|
||||
{
|
||||
HangleLengthChange();
|
||||
_previousLength = Anchors.Length;
|
||||
}
|
||||
}
|
||||
|
||||
//Event Handlers:
|
||||
private void HangleLengthChange()
|
||||
{
|
||||
_lengthDirty = true;
|
||||
|
||||
//fire event:
|
||||
OnSplineChanged?.Invoke();
|
||||
}
|
||||
|
||||
//Private Methods:
|
||||
private float Reparam(float percent)
|
||||
{
|
||||
if (_lengthDirty) CalculateLength();
|
||||
|
||||
//TODO: consider optimization of reversing this if the percent is > .5f to go in either direction:
|
||||
for (int i = 0; i < _splineReparams.Count; i++)
|
||||
{
|
||||
float currentPercentage = _splineReparams[i].length / Length;
|
||||
|
||||
if (currentPercentage == percent)
|
||||
{
|
||||
return _splineReparams[i].percentage;
|
||||
}
|
||||
|
||||
if (currentPercentage > percent)
|
||||
{
|
||||
float fromP = _splineReparams[i - 1].length / Length;
|
||||
float toP = currentPercentage;
|
||||
|
||||
//slide scale to 0:
|
||||
float maxAdjusted = toP - fromP;
|
||||
float percentAdjusted = percent - fromP;
|
||||
|
||||
//find out percentage:
|
||||
float inBetweenPercentage = percentAdjusted / maxAdjusted;
|
||||
float location = Mathf.Lerp(_splineReparams[i - 1].percentage, _splineReparams[i].percentage, inBetweenPercentage);
|
||||
|
||||
return location;
|
||||
}
|
||||
}
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
//Public Methods:
|
||||
/// <summary>
|
||||
/// Calculates the length of this spline and puts the result into the Length property.
|
||||
/// </summary>
|
||||
public void CalculateLength()
|
||||
{
|
||||
//prep:
|
||||
int totalSlices = (Anchors.Length - 1) * _slicesPerCurve;
|
||||
Length = 0;
|
||||
_splineReparams.Clear();
|
||||
|
||||
//initial entries:
|
||||
_splineReparams.Add(new SplineReparam(0, 0));
|
||||
|
||||
//find spline length:
|
||||
for (int i = 1; i < totalSlices + 1; i++)
|
||||
{
|
||||
//percent ends:
|
||||
float percent = i / (float)totalSlices;
|
||||
float previousPercent = (i - 1) / (float)totalSlices;
|
||||
|
||||
//position ends:
|
||||
Vector3 start = GetPosition(previousPercent, false);
|
||||
Vector3 end = GetPosition(percent, false);
|
||||
|
||||
//length:
|
||||
float distance = Vector3.Distance(start, end);
|
||||
Length += distance;
|
||||
|
||||
//reparameterization cache:
|
||||
_splineReparams.Add(new SplineReparam(Length, percent));
|
||||
}
|
||||
|
||||
_lengthDirty = false;
|
||||
return;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Get the up vector at a percentage along the spline.
|
||||
/// </summary>
|
||||
public Vector3 Up(float percentage, bool normalized = true)
|
||||
{
|
||||
Quaternion lookRotation = Quaternion.LookRotation(GetDirection(percentage, normalized));
|
||||
return lookRotation * Vector3.up;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Get the right vector at a percentage along the spline.
|
||||
/// </summary>
|
||||
public Vector3 Right(float percentage, bool normalized = true)
|
||||
{
|
||||
Quaternion lookRotation = Quaternion.LookRotation(GetDirection(percentage, normalized));
|
||||
return lookRotation * Vector3.right;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Get the forward vector at a percentage along the spline - this is simply a wrapper for the direction since they are the same thing.
|
||||
/// </summary>
|
||||
public Vector3 Forward(float percentage, bool normalized = true)
|
||||
{
|
||||
return GetDirection(percentage, normalized);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Returns a facing vector at the given percentage along the spline to allow content to properly orient along the spline.
|
||||
/// </summary>
|
||||
public Vector3 GetDirection(float percentage, bool normalized = true)
|
||||
{
|
||||
if (normalized) percentage = Reparam(percentage);
|
||||
|
||||
//get direction:
|
||||
CurveDetail curveDetail = GetCurve(percentage);
|
||||
|
||||
//avoid an error in editor usage where this index can be -1:
|
||||
if (curveDetail.currentCurve < 0) return Vector3.zero;
|
||||
|
||||
SplineAnchor startAnchor = Anchors[curveDetail.currentCurve];
|
||||
SplineAnchor endAnchor = Anchors[curveDetail.currentCurve + 1];
|
||||
return BezierCurves.GetFirstDerivative(startAnchor.Anchor.position, endAnchor.Anchor.position, startAnchor.OutTangent.position, endAnchor.InTangent.position, curveDetail.currentCurvePercentage).normalized;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Returns a position on the spline at the given percentage.
|
||||
/// </summary>
|
||||
public Vector3 GetPosition(float percentage, bool normalized = true)
|
||||
{
|
||||
if (normalized) percentage = Reparam(percentage);
|
||||
|
||||
//evaluate curve:
|
||||
CurveDetail curveDetail = GetCurve(percentage);
|
||||
|
||||
//avoid an error in editor usage where this index can be -1:
|
||||
if (curveDetail.currentCurve < 0) return Vector3.zero;
|
||||
|
||||
SplineAnchor startAnchor = Anchors[curveDetail.currentCurve];
|
||||
SplineAnchor endAnchor = Anchors[curveDetail.currentCurve + 1];
|
||||
return BezierCurves.GetPoint(startAnchor.Anchor.position, endAnchor.Anchor.position, startAnchor.OutTangent.position, endAnchor.InTangent.position, curveDetail.currentCurvePercentage, true, 100);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Returns a position on the spline at the given percentage with a relative offset.
|
||||
/// </summary>
|
||||
public Vector3 GetPosition(float percentage, Vector3 relativeOffset, bool normalized = true)
|
||||
{
|
||||
if (normalized) percentage = Reparam(percentage);
|
||||
|
||||
//get position and look rotation:
|
||||
Vector3 position = GetPosition(percentage);
|
||||
Quaternion lookRotation = Quaternion.LookRotation(GetDirection(percentage));
|
||||
|
||||
//get each axis at the current position:
|
||||
Vector3 up = lookRotation * Vector3.up;
|
||||
Vector3 right = lookRotation * Vector3.right;
|
||||
Vector3 forward = lookRotation * Vector3.forward;
|
||||
|
||||
//translate position:
|
||||
Vector3 offset = position + right * relativeOffset.x;
|
||||
offset += up * relativeOffset.y;
|
||||
offset += forward * relativeOffset.z;
|
||||
|
||||
return offset;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Given a world point and a number of divisions (think resolution) this returns the closest point on the spline.
|
||||
/// </summary>
|
||||
public float ClosestPoint(Vector3 point, int divisions = 100)
|
||||
{
|
||||
//make sure we have at least one division:
|
||||
if (divisions <= 0) divisions = 1;
|
||||
|
||||
//variables:
|
||||
float shortestDistance = float.MaxValue;
|
||||
Vector3 position = Vector3.zero;
|
||||
Vector3 offset = Vector3.zero;
|
||||
float closestPercentage = 0;
|
||||
float percentage = 0;
|
||||
float distance = 0;
|
||||
|
||||
//iterate spline and find the closest point on the spline to the provided point:
|
||||
for (float i = 0; i < divisions + 1; i++)
|
||||
{
|
||||
percentage = i / divisions;
|
||||
position = GetPosition(percentage);
|
||||
offset = position - point;
|
||||
distance = offset.sqrMagnitude;
|
||||
|
||||
//if this point is closer than any others so far:
|
||||
if (distance < shortestDistance)
|
||||
{
|
||||
shortestDistance = distance;
|
||||
closestPercentage = percentage;
|
||||
}
|
||||
}
|
||||
|
||||
return closestPercentage;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Makes a spline longer.
|
||||
/// </summary>
|
||||
public GameObject[] AddAnchors(int count)
|
||||
{
|
||||
//refs:
|
||||
GameObject anchorTemplate = Resources.Load("Anchor") as GameObject;
|
||||
|
||||
//create return array:
|
||||
GameObject[] returnObjects = new GameObject[count];
|
||||
|
||||
for (int i = 0; i < count; i++)
|
||||
{
|
||||
//previous anchor refs:
|
||||
Transform previousPreviousAnchor = null;
|
||||
Transform previousAnchor = null;
|
||||
if (Anchors.Length == 1)
|
||||
{
|
||||
previousPreviousAnchor = transform;
|
||||
previousAnchor = Anchors[0].transform;
|
||||
}
|
||||
else if (Anchors.Length > 1)
|
||||
{
|
||||
previousPreviousAnchor = Anchors[Anchors.Length - 2].transform;
|
||||
previousAnchor = Anchors[Anchors.Length - 1].transform;
|
||||
}
|
||||
|
||||
//create a new anchor:
|
||||
GameObject newAnchor = Instantiate<GameObject>(anchorTemplate);
|
||||
newAnchor.name = newAnchor.name.Replace("(Clone)", "");
|
||||
SplineAnchor anchor = newAnchor.GetComponent<SplineAnchor>();
|
||||
anchor.tangentMode = defaultTangentMode;
|
||||
newAnchor.transform.parent = transform;
|
||||
newAnchor.transform.rotation = Quaternion.LookRotation(transform.forward);
|
||||
|
||||
//tilt tangents for variety as we add new anchors:
|
||||
//anchor.Tilt (new Vector3 (0, 0, 0));
|
||||
anchor.InTangent.Translate(Vector3.up * .5f);
|
||||
anchor.OutTangent.Translate(Vector3.up * -.5f);
|
||||
|
||||
//position new anchor:
|
||||
if (previousPreviousAnchor != null && previousAnchor != null)
|
||||
{
|
||||
//determine direction for next placement:
|
||||
Vector3 direction = (previousAnchor.position - previousPreviousAnchor.position).normalized;
|
||||
if (direction == Vector3.zero) direction = transform.forward;
|
||||
|
||||
//place from the previous anchor in the correct direction:
|
||||
newAnchor.transform.position = previousAnchor.transform.position + (direction * 1.5f);
|
||||
}
|
||||
else
|
||||
{
|
||||
newAnchor.transform.localPosition = Vector3.zero;
|
||||
}
|
||||
|
||||
//catalog this new anchor for return:
|
||||
returnObjects[i] = newAnchor;
|
||||
}
|
||||
|
||||
return returnObjects;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Gets the current curve at the percentage.
|
||||
/// </summary>
|
||||
public CurveDetail GetCurve(float percentage)
|
||||
{
|
||||
//clamp or loop percentage:
|
||||
if (loop)
|
||||
{
|
||||
percentage = Mathf.Repeat(percentage, 1);
|
||||
}
|
||||
else
|
||||
{
|
||||
percentage = Mathf.Clamp01(percentage);
|
||||
}
|
||||
|
||||
//curve identification and evaluation:
|
||||
if (Anchors.Length == 2)
|
||||
{
|
||||
//direction reversed?
|
||||
if (direction == SplineDirection.Backwards)
|
||||
{
|
||||
percentage = 1 - percentage;
|
||||
}
|
||||
|
||||
//simply evaluate the curve since there is only one:
|
||||
return new CurveDetail(0, percentage);
|
||||
}
|
||||
else
|
||||
{
|
||||
//figure out which curve we are operating on from the spline and a percentage along it:
|
||||
_curveCount = Anchors.Length - 1;
|
||||
_currentCurve = _curveCount * percentage;
|
||||
|
||||
if ((int)_currentCurve == _curveCount)
|
||||
{
|
||||
_currentCurve = _curveCount - 1;
|
||||
_curvePercentage = 1;
|
||||
}
|
||||
else
|
||||
{
|
||||
_curvePercentage = _currentCurve - (int)_currentCurve;
|
||||
}
|
||||
|
||||
_currentCurve = (int)_currentCurve;
|
||||
_operatingCurve = (int)_currentCurve;
|
||||
|
||||
//direction reversed?
|
||||
if (direction == SplineDirection.Backwards)
|
||||
{
|
||||
_curvePercentage = 1 - _curvePercentage;
|
||||
_operatingCurve = (_curveCount - 1) - _operatingCurve;
|
||||
}
|
||||
|
||||
return new CurveDetail(_operatingCurve, _curvePercentage);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
19
Assets/External/Pixelplacement/Surge/Spline/Objects/Spline.cs.meta
vendored
Normal file
19
Assets/External/Pixelplacement/Surge/Spline/Objects/Spline.cs.meta
vendored
Normal file
@@ -0,0 +1,19 @@
|
||||
fileFormatVersion: 2
|
||||
guid: f1ec11ed173ba4d8d99e75c4bf174d82
|
||||
timeCreated: 1483123464
|
||||
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/Spline/Objects/Spline.cs
|
||||
uploadId: 467433
|
||||
268
Assets/External/Pixelplacement/Surge/Spline/Objects/SplineAnchor.cs
vendored
Normal file
268
Assets/External/Pixelplacement/Surge/Spline/Objects/SplineAnchor.cs
vendored
Normal file
@@ -0,0 +1,268 @@
|
||||
/// <summary>
|
||||
/// SURGE FRAMEWORK
|
||||
/// Author: Bob Berkebile
|
||||
/// Email: bobb@pixelplacement.com
|
||||
///
|
||||
/// Interface for a spline's anchor and tangents.
|
||||
///
|
||||
/// </summary>
|
||||
|
||||
using UnityEngine;
|
||||
using System.Collections;
|
||||
|
||||
namespace Pixelplacement
|
||||
{
|
||||
public enum TangentMode {Mirrored, Aligned, Free}
|
||||
|
||||
[ExecuteInEditMode]
|
||||
public class SplineAnchor : MonoBehaviour
|
||||
{
|
||||
//Public Variables:
|
||||
public TangentMode tangentMode;
|
||||
|
||||
//Public Properties:
|
||||
public bool RenderingChange
|
||||
{
|
||||
get; set;
|
||||
}
|
||||
|
||||
public bool Changed
|
||||
{
|
||||
get; set;
|
||||
}
|
||||
|
||||
public Transform Anchor
|
||||
{
|
||||
get
|
||||
{
|
||||
if (!_initialized) Initialize();
|
||||
return _anchor;
|
||||
}
|
||||
|
||||
private set
|
||||
{
|
||||
_anchor = value;
|
||||
}
|
||||
}
|
||||
|
||||
public Transform InTangent
|
||||
{
|
||||
get
|
||||
{
|
||||
if (!_initialized) Initialize();
|
||||
return _inTangent;
|
||||
}
|
||||
|
||||
private set
|
||||
{
|
||||
_inTangent = value;
|
||||
}
|
||||
}
|
||||
|
||||
public Transform OutTangent
|
||||
{
|
||||
get
|
||||
{
|
||||
if (!_initialized) Initialize();
|
||||
return _outTangent;
|
||||
}
|
||||
|
||||
private set
|
||||
{
|
||||
_outTangent = value;
|
||||
}
|
||||
}
|
||||
|
||||
//Private Variables:
|
||||
bool _initialized;
|
||||
[SerializeField][HideInInspector] Transform _masterTangent;
|
||||
[SerializeField][HideInInspector] Transform _slaveTangent;
|
||||
TangentMode _previousTangentMode;
|
||||
Vector3 _previousInPosition;
|
||||
Vector3 _previousOutPosition;
|
||||
Vector3 _previousAnchorPosition;
|
||||
Bounds _skinnedBounds;
|
||||
Transform _anchor;
|
||||
Transform _inTangent;
|
||||
Transform _outTangent;
|
||||
|
||||
//Init:
|
||||
void Awake ()
|
||||
{
|
||||
Initialize ();
|
||||
}
|
||||
|
||||
//Loop:
|
||||
void Update ()
|
||||
{
|
||||
//don't let an anchor scale:
|
||||
transform.localScale = Vector3.one;
|
||||
|
||||
//initialization:
|
||||
if (!_initialized)
|
||||
{
|
||||
Initialize ();
|
||||
}
|
||||
|
||||
//override any skinned mesh bounds changes:
|
||||
Anchor.localPosition = Vector3.zero;
|
||||
|
||||
//has the anchor moved?
|
||||
if (_previousAnchorPosition != transform.position)
|
||||
{
|
||||
Changed = true;
|
||||
RenderingChange = true;
|
||||
_previousAnchorPosition = transform.position;
|
||||
}
|
||||
|
||||
//run a tangent operation if mode has changed:
|
||||
if (_previousTangentMode != tangentMode)
|
||||
{
|
||||
Changed = true;
|
||||
RenderingChange = true;
|
||||
TangentChanged ();
|
||||
_previousTangentMode = tangentMode;
|
||||
}
|
||||
|
||||
//detect tangent movements:
|
||||
if (InTangent.localPosition != _previousInPosition)
|
||||
{
|
||||
Changed = true;
|
||||
RenderingChange = true;
|
||||
_previousInPosition = InTangent.localPosition;
|
||||
_masterTangent = InTangent;
|
||||
_slaveTangent = OutTangent;
|
||||
TangentChanged ();
|
||||
return;
|
||||
}
|
||||
|
||||
if (OutTangent.localPosition != _previousOutPosition)
|
||||
{
|
||||
Changed = true;
|
||||
RenderingChange = true;
|
||||
_previousOutPosition = OutTangent.localPosition;
|
||||
_masterTangent = OutTangent;
|
||||
_slaveTangent = InTangent;
|
||||
TangentChanged ();
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
||||
//Private Methods:
|
||||
void TangentChanged ()
|
||||
{
|
||||
//calculate tangent positions:
|
||||
switch (tangentMode)
|
||||
{
|
||||
case TangentMode.Free:
|
||||
break;
|
||||
|
||||
case TangentMode.Mirrored:
|
||||
Vector3 mirroredOffset = _masterTangent.position - transform.position;
|
||||
_slaveTangent.position = transform.position - mirroredOffset;
|
||||
break;
|
||||
|
||||
case TangentMode.Aligned:
|
||||
float distance = Vector3.Distance (_slaveTangent.position, transform.position);
|
||||
Vector3 alignedOffset = (_masterTangent.position - transform.position).normalized;
|
||||
_slaveTangent.position = transform.position - (alignedOffset * distance);
|
||||
break;
|
||||
}
|
||||
|
||||
//cache tangent positions:
|
||||
_previousInPosition = InTangent.localPosition;
|
||||
_previousOutPosition = OutTangent.localPosition;
|
||||
}
|
||||
|
||||
//Private Methods:
|
||||
void Initialize ()
|
||||
{
|
||||
_initialized = true;
|
||||
|
||||
//grabs references:
|
||||
InTangent = transform.GetChild (0);
|
||||
OutTangent = transform.GetChild (1);
|
||||
Anchor = transform.GetChild (2);
|
||||
|
||||
//prepopulate master and slave tangents:
|
||||
_masterTangent = InTangent;
|
||||
_slaveTangent = OutTangent;
|
||||
|
||||
//hide some things to reduce clutter:
|
||||
Anchor.hideFlags = HideFlags.HideInHierarchy;
|
||||
|
||||
foreach (var item in GetComponentsInChildren<Renderer>())
|
||||
{
|
||||
if (Application.isEditor)
|
||||
{
|
||||
item.sharedMaterial.hideFlags = HideFlags.HideInInspector;
|
||||
}
|
||||
else
|
||||
{
|
||||
Destroy(item);
|
||||
}
|
||||
}
|
||||
|
||||
foreach (var item in GetComponentsInChildren<MeshFilter>())
|
||||
{
|
||||
if (Application.isEditor)
|
||||
{
|
||||
item.hideFlags = HideFlags.HideInInspector;
|
||||
}
|
||||
else
|
||||
{
|
||||
Destroy(item);
|
||||
}
|
||||
}
|
||||
|
||||
foreach (var item in GetComponentsInChildren<MeshRenderer>())
|
||||
{
|
||||
if (Application.isEditor)
|
||||
{
|
||||
item.hideFlags = HideFlags.HideInInspector;
|
||||
}
|
||||
else
|
||||
{
|
||||
Destroy(item);
|
||||
}
|
||||
}
|
||||
|
||||
foreach (var item in GetComponentsInChildren<SkinnedMeshRenderer>())
|
||||
{
|
||||
if (Application.isEditor)
|
||||
{
|
||||
item.hideFlags = HideFlags.HideInInspector;
|
||||
}
|
||||
}
|
||||
|
||||
//synchronize status variables:
|
||||
_previousTangentMode = tangentMode;
|
||||
_previousInPosition = InTangent.localPosition;
|
||||
_previousOutPosition = OutTangent.localPosition;
|
||||
_previousAnchorPosition = transform.position;
|
||||
}
|
||||
|
||||
//Public Methods:
|
||||
public void SetTangentStatus (bool inStatus, bool outStatus)
|
||||
{
|
||||
InTangent.gameObject.SetActive (inStatus);
|
||||
OutTangent.gameObject.SetActive (outStatus);
|
||||
}
|
||||
|
||||
public void Tilt (Vector3 angles)
|
||||
{
|
||||
//save current rotation and rotate as requested:
|
||||
Quaternion rotation = transform.localRotation;
|
||||
transform.Rotate (angles);
|
||||
|
||||
//get world position of tangents:
|
||||
Vector3 inPosition = InTangent.position;
|
||||
Vector3 outPosition = OutTangent.position;
|
||||
|
||||
//reverse rotation and set tangent positions:
|
||||
//transform.localRotation = rotation;
|
||||
InTangent.position = inPosition;
|
||||
OutTangent.position = outPosition;
|
||||
}
|
||||
}
|
||||
}
|
||||
19
Assets/External/Pixelplacement/Surge/Spline/Objects/SplineAnchor.cs.meta
vendored
Normal file
19
Assets/External/Pixelplacement/Surge/Spline/Objects/SplineAnchor.cs.meta
vendored
Normal file
@@ -0,0 +1,19 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 486ab05eb713a42cbb73a3d0cadf09ed
|
||||
timeCreated: 1483118697
|
||||
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/Spline/Objects/SplineAnchor.cs
|
||||
uploadId: 467433
|
||||
65
Assets/External/Pixelplacement/Surge/Spline/Objects/SplineFollower.cs
vendored
Normal file
65
Assets/External/Pixelplacement/Surge/Spline/Objects/SplineFollower.cs
vendored
Normal file
@@ -0,0 +1,65 @@
|
||||
/// <summary>
|
||||
/// SURGE FRAMEWORK
|
||||
/// Author: Bob Berkebile
|
||||
/// Email: bobb@pixelplacement.com
|
||||
///
|
||||
/// Used for easily attaching objects to a spline for inspector usage.
|
||||
///
|
||||
/// </summary>
|
||||
|
||||
using UnityEngine;
|
||||
using System.Collections;
|
||||
|
||||
namespace Pixelplacement
|
||||
{
|
||||
[System.Serializable]
|
||||
public class SplineFollower
|
||||
{
|
||||
//Public Variables:
|
||||
public Transform target;
|
||||
public float percentage = -1;
|
||||
public bool faceDirection;
|
||||
|
||||
//Public Properties:
|
||||
public bool WasMoved
|
||||
{
|
||||
get
|
||||
{
|
||||
if (percentage != _previousPercentage || faceDirection != _previousFaceDirection) {
|
||||
_previousPercentage = percentage;
|
||||
_previousFaceDirection = faceDirection;
|
||||
return true;
|
||||
} else {
|
||||
return false;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
//Private Variables:
|
||||
float _previousPercentage;
|
||||
bool _previousFaceDirection;
|
||||
bool _detached;
|
||||
|
||||
//Public Methods:
|
||||
public void UpdateOrientation (Spline spline)
|
||||
{
|
||||
if (target == null) return;
|
||||
|
||||
//clamp percentage:
|
||||
if (!spline.loop) percentage = Mathf.Clamp01 (percentage);
|
||||
|
||||
//look in direction of spline?
|
||||
if (faceDirection)
|
||||
{
|
||||
if (spline.direction == SplineDirection.Forward)
|
||||
{
|
||||
target.LookAt (target.position + spline.GetDirection (percentage));
|
||||
}else{
|
||||
target.LookAt (target.position - spline.GetDirection (percentage));
|
||||
}
|
||||
}
|
||||
|
||||
target.position = spline.GetPosition (percentage);
|
||||
}
|
||||
}
|
||||
}
|
||||
19
Assets/External/Pixelplacement/Surge/Spline/Objects/SplineFollower.cs.meta
vendored
Normal file
19
Assets/External/Pixelplacement/Surge/Spline/Objects/SplineFollower.cs.meta
vendored
Normal file
@@ -0,0 +1,19 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 484db4cb0f8e7f24b8e7012ba84c9e47
|
||||
timeCreated: 1485806915
|
||||
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/Spline/Objects/SplineFollower.cs
|
||||
uploadId: 467433
|
||||
19
Assets/External/Pixelplacement/Surge/Spline/Objects/SplineTangent.cs
vendored
Normal file
19
Assets/External/Pixelplacement/Surge/Spline/Objects/SplineTangent.cs
vendored
Normal file
@@ -0,0 +1,19 @@
|
||||
/// <summary>
|
||||
/// SURGE FRAMEWORK
|
||||
/// Author: Bob Berkebile
|
||||
/// Email: bobb@pixelplacement.com
|
||||
///
|
||||
/// A helper for allowing correct selection in the scene view instead of choosing the prefab root which is normal Unity operation.
|
||||
///
|
||||
/// </summary>
|
||||
|
||||
using UnityEngine;
|
||||
using System.Collections;
|
||||
|
||||
namespace Pixelplacement
|
||||
{
|
||||
[SelectionBase]
|
||||
public class SplineTangent : MonoBehaviour
|
||||
{
|
||||
}
|
||||
}
|
||||
19
Assets/External/Pixelplacement/Surge/Spline/Objects/SplineTangent.cs.meta
vendored
Normal file
19
Assets/External/Pixelplacement/Surge/Spline/Objects/SplineTangent.cs.meta
vendored
Normal file
@@ -0,0 +1,19 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 5980d28f81eb545d78e1d84e1449a10f
|
||||
timeCreated: 1483149639
|
||||
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/Spline/Objects/SplineTangent.cs
|
||||
uploadId: 467433
|
||||
9
Assets/External/Pixelplacement/Surge/Spline/Resources.meta
vendored
Normal file
9
Assets/External/Pixelplacement/Surge/Spline/Resources.meta
vendored
Normal file
@@ -0,0 +1,9 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 7c8d4f0ed438f4034b2a58cd18d03486
|
||||
folderAsset: yes
|
||||
timeCreated: 1500598979
|
||||
licenseType: Store
|
||||
DefaultImporter:
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
299
Assets/External/Pixelplacement/Surge/Spline/Resources/Anchor.prefab
vendored
Normal file
299
Assets/External/Pixelplacement/Surge/Spline/Resources/Anchor.prefab
vendored
Normal file
@@ -0,0 +1,299 @@
|
||||
%YAML 1.1
|
||||
%TAG !u! tag:unity3d.com,2011:
|
||||
--- !u!1001 &100100000
|
||||
Prefab:
|
||||
m_ObjectHideFlags: 1
|
||||
serializedVersion: 2
|
||||
m_Modification:
|
||||
m_TransformParent: {fileID: 0}
|
||||
m_Modifications: []
|
||||
m_RemovedComponents: []
|
||||
m_ParentPrefab: {fileID: 0}
|
||||
m_RootGameObject: {fileID: 1000013506235850}
|
||||
m_IsPrefabParent: 1
|
||||
--- !u!1 &1000010923298536
|
||||
GameObject:
|
||||
m_ObjectHideFlags: 0
|
||||
m_PrefabParentObject: {fileID: 0}
|
||||
m_PrefabInternal: {fileID: 100100000}
|
||||
serializedVersion: 5
|
||||
m_Component:
|
||||
- component: {fileID: 4000012482932774}
|
||||
- component: {fileID: 33000014224897370}
|
||||
- component: {fileID: 23000013987882740}
|
||||
- component: {fileID: 114000010166402902}
|
||||
m_Layer: 0
|
||||
m_Name: OutTangent
|
||||
m_TagString: Untagged
|
||||
m_Icon: {fileID: 0}
|
||||
m_NavMeshLayer: 0
|
||||
m_StaticEditorFlags: 0
|
||||
m_IsActive: 1
|
||||
--- !u!1 &1000013118930838
|
||||
GameObject:
|
||||
m_ObjectHideFlags: 0
|
||||
m_PrefabParentObject: {fileID: 0}
|
||||
m_PrefabInternal: {fileID: 100100000}
|
||||
serializedVersion: 5
|
||||
m_Component:
|
||||
- component: {fileID: 4000012704102164}
|
||||
m_Layer: 0
|
||||
m_Name: ScaleJoint
|
||||
m_TagString: Untagged
|
||||
m_Icon: {fileID: 0}
|
||||
m_NavMeshLayer: 0
|
||||
m_StaticEditorFlags: 0
|
||||
m_IsActive: 1
|
||||
--- !u!1 &1000013281444082
|
||||
GameObject:
|
||||
m_ObjectHideFlags: 0
|
||||
m_PrefabParentObject: {fileID: 0}
|
||||
m_PrefabInternal: {fileID: 100100000}
|
||||
serializedVersion: 5
|
||||
m_Component:
|
||||
- component: {fileID: 4000012395411742}
|
||||
- component: {fileID: 33000012835484144}
|
||||
- component: {fileID: 23000011320280670}
|
||||
- component: {fileID: 114000013738431472}
|
||||
m_Layer: 0
|
||||
m_Name: InTangent
|
||||
m_TagString: Untagged
|
||||
m_Icon: {fileID: 0}
|
||||
m_NavMeshLayer: 0
|
||||
m_StaticEditorFlags: 0
|
||||
m_IsActive: 1
|
||||
--- !u!1 &1000013506235850
|
||||
GameObject:
|
||||
m_ObjectHideFlags: 0
|
||||
m_PrefabParentObject: {fileID: 0}
|
||||
m_PrefabInternal: {fileID: 100100000}
|
||||
serializedVersion: 5
|
||||
m_Component:
|
||||
- component: {fileID: 4000011036911136}
|
||||
- component: {fileID: 33000010540804998}
|
||||
- component: {fileID: 137000011316136332}
|
||||
- component: {fileID: 114000013814947972}
|
||||
m_Layer: 0
|
||||
m_Name: Anchor
|
||||
m_TagString: Untagged
|
||||
m_Icon: {fileID: 0}
|
||||
m_NavMeshLayer: 0
|
||||
m_StaticEditorFlags: 0
|
||||
m_IsActive: 1
|
||||
--- !u!4 &4000011036911136
|
||||
Transform:
|
||||
m_ObjectHideFlags: 1
|
||||
m_PrefabParentObject: {fileID: 0}
|
||||
m_PrefabInternal: {fileID: 100100000}
|
||||
m_GameObject: {fileID: 1000013506235850}
|
||||
m_LocalRotation: {x: -0, y: -0, z: -0, w: 1}
|
||||
m_LocalPosition: {x: 0, y: 0, z: 0}
|
||||
m_LocalScale: {x: 1, y: 1, z: 1}
|
||||
m_Children:
|
||||
- {fileID: 4000012395411742}
|
||||
- {fileID: 4000012482932774}
|
||||
- {fileID: 4000012704102164}
|
||||
m_Father: {fileID: 0}
|
||||
m_RootOrder: 0
|
||||
m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0}
|
||||
--- !u!4 &4000012395411742
|
||||
Transform:
|
||||
m_ObjectHideFlags: 1
|
||||
m_PrefabParentObject: {fileID: 0}
|
||||
m_PrefabInternal: {fileID: 100100000}
|
||||
m_GameObject: {fileID: 1000013281444082}
|
||||
m_LocalRotation: {x: 0, y: -0, z: -0, w: 1}
|
||||
m_LocalPosition: {x: 0, y: 0, z: -0.5}
|
||||
m_LocalScale: {x: 0.22958507, y: 0.22958507, z: 0.22958507}
|
||||
m_Children: []
|
||||
m_Father: {fileID: 4000011036911136}
|
||||
m_RootOrder: 0
|
||||
m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0}
|
||||
--- !u!4 &4000012482932774
|
||||
Transform:
|
||||
m_ObjectHideFlags: 1
|
||||
m_PrefabParentObject: {fileID: 0}
|
||||
m_PrefabInternal: {fileID: 100100000}
|
||||
m_GameObject: {fileID: 1000010923298536}
|
||||
m_LocalRotation: {x: -0, y: -0, z: -0, w: 1}
|
||||
m_LocalPosition: {x: 0, y: 0, z: 0.5}
|
||||
m_LocalScale: {x: 0.22958507, y: 0.22958507, z: 0.22958507}
|
||||
m_Children: []
|
||||
m_Father: {fileID: 4000011036911136}
|
||||
m_RootOrder: 1
|
||||
m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0}
|
||||
--- !u!4 &4000012704102164
|
||||
Transform:
|
||||
m_ObjectHideFlags: 1
|
||||
m_PrefabParentObject: {fileID: 0}
|
||||
m_PrefabInternal: {fileID: 100100000}
|
||||
m_GameObject: {fileID: 1000013118930838}
|
||||
m_LocalRotation: {x: 0, y: -0, z: -0, w: 1}
|
||||
m_LocalPosition: {x: 0, y: 0, z: 0}
|
||||
m_LocalScale: {x: 0.22958507, y: 0.22958507, z: 0.22958507}
|
||||
m_Children: []
|
||||
m_Father: {fileID: 4000011036911136}
|
||||
m_RootOrder: 2
|
||||
m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0}
|
||||
--- !u!23 &23000011320280670
|
||||
MeshRenderer:
|
||||
m_ObjectHideFlags: 1
|
||||
m_PrefabParentObject: {fileID: 0}
|
||||
m_PrefabInternal: {fileID: 100100000}
|
||||
m_GameObject: {fileID: 1000013281444082}
|
||||
m_Enabled: 1
|
||||
m_CastShadows: 0
|
||||
m_ReceiveShadows: 0
|
||||
m_MotionVectors: 0
|
||||
m_LightProbeUsage: 0
|
||||
m_ReflectionProbeUsage: 0
|
||||
m_Materials:
|
||||
- {fileID: 2100000, guid: 1642fbcacc9dc42ed934b98457781f23, type: 2}
|
||||
m_StaticBatchInfo:
|
||||
firstSubMesh: 0
|
||||
subMeshCount: 0
|
||||
m_StaticBatchRoot: {fileID: 0}
|
||||
m_ProbeAnchor: {fileID: 0}
|
||||
m_LightProbeVolumeOverride: {fileID: 0}
|
||||
m_ScaleInLightmap: 1
|
||||
m_PreserveUVs: 0
|
||||
m_IgnoreNormalsForChartDetection: 0
|
||||
m_ImportantGI: 0
|
||||
m_SelectedEditorRenderState: 3
|
||||
m_MinimumChartSize: 4
|
||||
m_AutoUVMaxDistance: 0.5
|
||||
m_AutoUVMaxAngle: 89
|
||||
m_LightmapParameters: {fileID: 0}
|
||||
m_SortingLayerID: 0
|
||||
m_SortingOrder: 0
|
||||
--- !u!23 &23000013987882740
|
||||
MeshRenderer:
|
||||
m_ObjectHideFlags: 1
|
||||
m_PrefabParentObject: {fileID: 0}
|
||||
m_PrefabInternal: {fileID: 100100000}
|
||||
m_GameObject: {fileID: 1000010923298536}
|
||||
m_Enabled: 1
|
||||
m_CastShadows: 0
|
||||
m_ReceiveShadows: 0
|
||||
m_MotionVectors: 0
|
||||
m_LightProbeUsage: 0
|
||||
m_ReflectionProbeUsage: 0
|
||||
m_Materials:
|
||||
- {fileID: 2100000, guid: 1642fbcacc9dc42ed934b98457781f23, type: 2}
|
||||
m_StaticBatchInfo:
|
||||
firstSubMesh: 0
|
||||
subMeshCount: 0
|
||||
m_StaticBatchRoot: {fileID: 0}
|
||||
m_ProbeAnchor: {fileID: 0}
|
||||
m_LightProbeVolumeOverride: {fileID: 0}
|
||||
m_ScaleInLightmap: 1
|
||||
m_PreserveUVs: 0
|
||||
m_IgnoreNormalsForChartDetection: 0
|
||||
m_ImportantGI: 0
|
||||
m_SelectedEditorRenderState: 3
|
||||
m_MinimumChartSize: 4
|
||||
m_AutoUVMaxDistance: 0.5
|
||||
m_AutoUVMaxAngle: 89
|
||||
m_LightmapParameters: {fileID: 0}
|
||||
m_SortingLayerID: 0
|
||||
m_SortingOrder: 0
|
||||
--- !u!33 &33000010540804998
|
||||
MeshFilter:
|
||||
m_ObjectHideFlags: 1
|
||||
m_PrefabParentObject: {fileID: 0}
|
||||
m_PrefabInternal: {fileID: 100100000}
|
||||
m_GameObject: {fileID: 1000013506235850}
|
||||
m_Mesh: {fileID: 4300000, guid: c0de5c847168f47b48791e9f1912e7c0, type: 3}
|
||||
--- !u!33 &33000012835484144
|
||||
MeshFilter:
|
||||
m_ObjectHideFlags: 1
|
||||
m_PrefabParentObject: {fileID: 0}
|
||||
m_PrefabInternal: {fileID: 100100000}
|
||||
m_GameObject: {fileID: 1000013281444082}
|
||||
m_Mesh: {fileID: 4300000, guid: eae229cde7c374059a09c8052360682c, type: 3}
|
||||
--- !u!33 &33000014224897370
|
||||
MeshFilter:
|
||||
m_ObjectHideFlags: 1
|
||||
m_PrefabParentObject: {fileID: 0}
|
||||
m_PrefabInternal: {fileID: 100100000}
|
||||
m_GameObject: {fileID: 1000010923298536}
|
||||
m_Mesh: {fileID: 4300000, guid: eae229cde7c374059a09c8052360682c, type: 3}
|
||||
--- !u!114 &114000010166402902
|
||||
MonoBehaviour:
|
||||
m_ObjectHideFlags: 1
|
||||
m_PrefabParentObject: {fileID: 0}
|
||||
m_PrefabInternal: {fileID: 100100000}
|
||||
m_GameObject: {fileID: 1000010923298536}
|
||||
m_Enabled: 1
|
||||
m_EditorHideFlags: 0
|
||||
m_Script: {fileID: 11500000, guid: 5980d28f81eb545d78e1d84e1449a10f, type: 3}
|
||||
m_Name:
|
||||
m_EditorClassIdentifier:
|
||||
--- !u!114 &114000013738431472
|
||||
MonoBehaviour:
|
||||
m_ObjectHideFlags: 1
|
||||
m_PrefabParentObject: {fileID: 0}
|
||||
m_PrefabInternal: {fileID: 100100000}
|
||||
m_GameObject: {fileID: 1000013281444082}
|
||||
m_Enabled: 1
|
||||
m_EditorHideFlags: 0
|
||||
m_Script: {fileID: 11500000, guid: 5980d28f81eb545d78e1d84e1449a10f, type: 3}
|
||||
m_Name:
|
||||
m_EditorClassIdentifier:
|
||||
--- !u!114 &114000013814947972
|
||||
MonoBehaviour:
|
||||
m_ObjectHideFlags: 1
|
||||
m_PrefabParentObject: {fileID: 0}
|
||||
m_PrefabInternal: {fileID: 100100000}
|
||||
m_GameObject: {fileID: 1000013506235850}
|
||||
m_Enabled: 1
|
||||
m_EditorHideFlags: 0
|
||||
m_Script: {fileID: 11500000, guid: 486ab05eb713a42cbb73a3d0cadf09ed, type: 3}
|
||||
m_Name:
|
||||
m_EditorClassIdentifier:
|
||||
tangentMode: 0
|
||||
m_masterTangent: {fileID: 0}
|
||||
m_slaveTangent: {fileID: 0}
|
||||
--- !u!137 &137000011316136332
|
||||
SkinnedMeshRenderer:
|
||||
m_ObjectHideFlags: 1
|
||||
m_PrefabParentObject: {fileID: 0}
|
||||
m_PrefabInternal: {fileID: 100100000}
|
||||
m_GameObject: {fileID: 1000013506235850}
|
||||
m_Enabled: 1
|
||||
m_CastShadows: 0
|
||||
m_ReceiveShadows: 0
|
||||
m_MotionVectors: 0
|
||||
m_LightProbeUsage: 0
|
||||
m_ReflectionProbeUsage: 0
|
||||
m_Materials:
|
||||
- {fileID: 2100000, guid: 1642fbcacc9dc42ed934b98457781f23, type: 2}
|
||||
m_StaticBatchInfo:
|
||||
firstSubMesh: 0
|
||||
subMeshCount: 0
|
||||
m_StaticBatchRoot: {fileID: 0}
|
||||
m_ProbeAnchor: {fileID: 0}
|
||||
m_LightProbeVolumeOverride: {fileID: 0}
|
||||
m_ScaleInLightmap: 1
|
||||
m_PreserveUVs: 0
|
||||
m_IgnoreNormalsForChartDetection: 0
|
||||
m_ImportantGI: 0
|
||||
m_SelectedEditorRenderState: 3
|
||||
m_MinimumChartSize: 4
|
||||
m_AutoUVMaxDistance: 0.5
|
||||
m_AutoUVMaxAngle: 89
|
||||
m_LightmapParameters: {fileID: 0}
|
||||
m_SortingLayerID: 0
|
||||
m_SortingOrder: 0
|
||||
serializedVersion: 2
|
||||
m_Quality: 0
|
||||
m_UpdateWhenOffscreen: 0
|
||||
m_SkinnedMotionVectors: 0
|
||||
m_Mesh: {fileID: 4300000, guid: c0de5c847168f47b48791e9f1912e7c0, type: 3}
|
||||
m_Bones: []
|
||||
m_BlendShapeWeights: []
|
||||
m_RootBone: {fileID: 4000012704102164}
|
||||
m_AABB:
|
||||
m_Center: {x: 0, y: 0, z: 0}
|
||||
m_Extent: {x: 0, y: 0, z: 0}
|
||||
m_DirtyAABB: 0
|
||||
15
Assets/External/Pixelplacement/Surge/Spline/Resources/Anchor.prefab.meta
vendored
Normal file
15
Assets/External/Pixelplacement/Surge/Spline/Resources/Anchor.prefab.meta
vendored
Normal file
@@ -0,0 +1,15 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 547111b175c2e4cb2a897b91a214e96a
|
||||
timeCreated: 1483163090
|
||||
licenseType: Store
|
||||
NativeFormatImporter:
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
AssetOrigin:
|
||||
serializedVersion: 1
|
||||
productId: 107312
|
||||
packageName: Surge
|
||||
packageVersion: 1.0.48
|
||||
assetPath: Assets/Pixelplacement/Surge/Spline/Resources/Anchor.prefab
|
||||
uploadId: 467433
|
||||
133
Assets/External/Pixelplacement/Surge/Spline/Resources/SplineRenderer.mat
vendored
Normal file
133
Assets/External/Pixelplacement/Surge/Spline/Resources/SplineRenderer.mat
vendored
Normal file
@@ -0,0 +1,133 @@
|
||||
%YAML 1.1
|
||||
%TAG !u! tag:unity3d.com,2011:
|
||||
--- !u!21 &2100000
|
||||
Material:
|
||||
serializedVersion: 6
|
||||
m_ObjectHideFlags: 0
|
||||
m_PrefabParentObject: {fileID: 0}
|
||||
m_PrefabInternal: {fileID: 0}
|
||||
m_Name: SplineRenderer
|
||||
m_Shader: {fileID: 200, guid: 0000000000000000f000000000000000, type: 0}
|
||||
m_ShaderKeywords: _EMISSION
|
||||
m_LightmapFlags: 1
|
||||
m_CustomRenderQueue: -1
|
||||
stringTagMap: {}
|
||||
m_SavedProperties:
|
||||
serializedVersion: 2
|
||||
m_TexEnvs:
|
||||
- first:
|
||||
name: _BumpMap
|
||||
second:
|
||||
m_Texture: {fileID: 0}
|
||||
m_Scale: {x: 1, y: 1}
|
||||
m_Offset: {x: 0, y: 0}
|
||||
- first:
|
||||
name: _DetailAlbedoMap
|
||||
second:
|
||||
m_Texture: {fileID: 0}
|
||||
m_Scale: {x: 1, y: 1}
|
||||
m_Offset: {x: 0, y: 0}
|
||||
- first:
|
||||
name: _DetailMask
|
||||
second:
|
||||
m_Texture: {fileID: 0}
|
||||
m_Scale: {x: 1, y: 1}
|
||||
m_Offset: {x: 0, y: 0}
|
||||
- first:
|
||||
name: _DetailNormalMap
|
||||
second:
|
||||
m_Texture: {fileID: 0}
|
||||
m_Scale: {x: 1, y: 1}
|
||||
m_Offset: {x: 0, y: 0}
|
||||
- first:
|
||||
name: _EmissionMap
|
||||
second:
|
||||
m_Texture: {fileID: 0}
|
||||
m_Scale: {x: 1, y: 1}
|
||||
m_Offset: {x: 0, y: 0}
|
||||
- first:
|
||||
name: _MainTex
|
||||
second:
|
||||
m_Texture: {fileID: 0}
|
||||
m_Scale: {x: 1, y: 1}
|
||||
m_Offset: {x: 0, y: 0}
|
||||
- first:
|
||||
name: _MetallicGlossMap
|
||||
second:
|
||||
m_Texture: {fileID: 0}
|
||||
m_Scale: {x: 1, y: 1}
|
||||
m_Offset: {x: 0, y: 0}
|
||||
- first:
|
||||
name: _OcclusionMap
|
||||
second:
|
||||
m_Texture: {fileID: 0}
|
||||
m_Scale: {x: 1, y: 1}
|
||||
m_Offset: {x: 0, y: 0}
|
||||
- first:
|
||||
name: _ParallaxMap
|
||||
second:
|
||||
m_Texture: {fileID: 0}
|
||||
m_Scale: {x: 1, y: 1}
|
||||
m_Offset: {x: 0, y: 0}
|
||||
m_Floats:
|
||||
- first:
|
||||
name: _BumpScale
|
||||
second: 1
|
||||
- first:
|
||||
name: _Cutoff
|
||||
second: 0.5
|
||||
- first:
|
||||
name: _DetailNormalMapScale
|
||||
second: 1
|
||||
- first:
|
||||
name: _DstBlend
|
||||
second: 0
|
||||
- first:
|
||||
name: _GlossMapScale
|
||||
second: 1
|
||||
- first:
|
||||
name: _Glossiness
|
||||
second: 0.5
|
||||
- first:
|
||||
name: _GlossyReflections
|
||||
second: 1
|
||||
- first:
|
||||
name: _InvFade
|
||||
second: 1
|
||||
- first:
|
||||
name: _Metallic
|
||||
second: 0
|
||||
- first:
|
||||
name: _Mode
|
||||
second: 0
|
||||
- first:
|
||||
name: _OcclusionStrength
|
||||
second: 1
|
||||
- first:
|
||||
name: _Parallax
|
||||
second: 0.02
|
||||
- first:
|
||||
name: _SmoothnessTextureChannel
|
||||
second: 0
|
||||
- first:
|
||||
name: _SpecularHighlights
|
||||
second: 1
|
||||
- first:
|
||||
name: _SrcBlend
|
||||
second: 1
|
||||
- first:
|
||||
name: _UVSec
|
||||
second: 0
|
||||
- first:
|
||||
name: _ZWrite
|
||||
second: 1
|
||||
m_Colors:
|
||||
- first:
|
||||
name: _Color
|
||||
second: {r: 1, g: 1, b: 1, a: 1}
|
||||
- first:
|
||||
name: _EmissionColor
|
||||
second: {r: 0, g: 0, b: 0, a: 1}
|
||||
- first:
|
||||
name: _TintColor
|
||||
second: {r: 0.5, g: 0.5, b: 0.5, a: 0.5}
|
||||
15
Assets/External/Pixelplacement/Surge/Spline/Resources/SplineRenderer.mat.meta
vendored
Normal file
15
Assets/External/Pixelplacement/Surge/Spline/Resources/SplineRenderer.mat.meta
vendored
Normal file
@@ -0,0 +1,15 @@
|
||||
fileFormatVersion: 2
|
||||
guid: c492a9eeac69b435ba250b40e3c07897
|
||||
timeCreated: 1483511030
|
||||
licenseType: Store
|
||||
NativeFormatImporter:
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
AssetOrigin:
|
||||
serializedVersion: 1
|
||||
productId: 107312
|
||||
packageName: Surge
|
||||
packageVersion: 1.0.48
|
||||
assetPath: Assets/Pixelplacement/Surge/Spline/Resources/SplineRenderer.mat
|
||||
uploadId: 467433
|
||||
9
Assets/External/Pixelplacement/Surge/Spline/Utilities.meta
vendored
Normal file
9
Assets/External/Pixelplacement/Surge/Spline/Utilities.meta
vendored
Normal file
@@ -0,0 +1,9 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 98ae5ed9b5e8c42128c33270aeed0053
|
||||
folderAsset: yes
|
||||
timeCreated: 1500598980
|
||||
licenseType: Store
|
||||
DefaultImporter:
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
96
Assets/External/Pixelplacement/Surge/Spline/Utilities/SplineControlledParticleSystem.cs
vendored
Normal file
96
Assets/External/Pixelplacement/Surge/Spline/Utilities/SplineControlledParticleSystem.cs
vendored
Normal file
@@ -0,0 +1,96 @@
|
||||
/// <summary>
|
||||
/// SURGE FRAMEWORK
|
||||
/// Author: Bob Berkebile
|
||||
/// Email: bobb@pixelplacement.com
|
||||
///
|
||||
/// Forces a referenced particle system to flow along this spline. To optimize performance limit Max Particles to just what is necessary. Particle speed along the path is determined by Start Lifetime.
|
||||
///
|
||||
/// </summary>
|
||||
|
||||
using System.Collections;
|
||||
using System.Collections.Generic;
|
||||
using UnityEngine;
|
||||
using Pixelplacement;
|
||||
|
||||
[ExecuteInEditMode]
|
||||
[RequireComponent (typeof (Spline))]
|
||||
public class SplineControlledParticleSystem : MonoBehaviour
|
||||
{
|
||||
//Public Variables:
|
||||
public float startRadius;
|
||||
public float endRadius;
|
||||
|
||||
//Private Variables:
|
||||
[SerializeField] ParticleSystem _particleSystem = null;
|
||||
Spline _spline;
|
||||
ParticleSystem.Particle[] _particles;
|
||||
const float _previousDiff = .01f;
|
||||
|
||||
//Init:
|
||||
void Awake ()
|
||||
{
|
||||
_spline = GetComponent<Spline> ();
|
||||
}
|
||||
|
||||
//Loops:
|
||||
void LateUpdate ()
|
||||
{
|
||||
if (_particleSystem == null) return;
|
||||
|
||||
if (_particles == null) _particles = new ParticleSystem.Particle[_particleSystem.main.maxParticles];
|
||||
|
||||
int aliveParticlesCount = _particleSystem.GetParticles (_particles);
|
||||
|
||||
for (int i = 0; i < aliveParticlesCount; i++)
|
||||
{
|
||||
//get calculation pieces:
|
||||
float seedMax = Mathf.Pow(10, _particles[i].randomSeed.ToString().Length);
|
||||
float seedAsPercent = _particles[i].randomSeed / seedMax;
|
||||
float travelPercentage = 1 - (_particles[i].remainingLifetime / _particles[i].startLifetime);
|
||||
|
||||
//bypass issue while running at edit time when particles haven't reached the spline end:
|
||||
if (_spline.GetDirection(travelPercentage, false) == Vector3.zero) continue;
|
||||
|
||||
//get a direction off our current point on the path - rotating by 1080 results in better distribution since Unity's randomSeed for particles favors lower numbers:
|
||||
Vector3 offshootDirection = Quaternion.AngleAxis(1080 * seedAsPercent, -_spline.GetDirection(travelPercentage, false)) * _spline.Up(travelPercentage);
|
||||
Vector3 previousOffshootDirection = Quaternion.AngleAxis(1080 * seedAsPercent, -_spline.GetDirection(travelPercentage - _previousDiff, false)) * _spline.Up(travelPercentage - _previousDiff, false);
|
||||
|
||||
//cache our positions:
|
||||
Vector3 position = _spline.GetPosition(travelPercentage, false);
|
||||
|
||||
//cache a previous position for velocity if possible:
|
||||
Vector3 lastPosition = position;
|
||||
if (travelPercentage - .01f >= 0) lastPosition = _spline.GetPosition(travelPercentage - _previousDiff, false);
|
||||
|
||||
//decide how far to offshoot from the spline based on where we are between the start and end radius:
|
||||
float offset = Mathf.Lerp(startRadius, endRadius, travelPercentage);
|
||||
float previousOffset = Mathf.Lerp(startRadius, endRadius, travelPercentage - _previousDiff);
|
||||
|
||||
//place particles depending on simulation space:
|
||||
Vector3 currentPosition = Vector3.zero;
|
||||
Vector3 previousPosition = Vector3.zero;
|
||||
|
||||
switch (_particleSystem.main.simulationSpace)
|
||||
{
|
||||
case ParticleSystemSimulationSpace.Local:
|
||||
|
||||
currentPosition = _particleSystem.transform.InverseTransformPoint(position + offshootDirection * offset);
|
||||
previousPosition = _particleSystem.transform.InverseTransformPoint(lastPosition + previousOffshootDirection * previousOffset);
|
||||
break;
|
||||
|
||||
case ParticleSystemSimulationSpace.World:
|
||||
case ParticleSystemSimulationSpace.Custom:
|
||||
currentPosition = position + offshootDirection * offset;
|
||||
previousPosition = position + previousOffshootDirection * previousOffset;
|
||||
break;
|
||||
}
|
||||
|
||||
//apply:
|
||||
_particles[i].position = currentPosition;
|
||||
_particles[i].velocity = currentPosition - previousPosition;
|
||||
}
|
||||
|
||||
//apply the particle changes back to the system:
|
||||
_particleSystem.SetParticles (_particles, _particles.Length);
|
||||
}
|
||||
}
|
||||
19
Assets/External/Pixelplacement/Surge/Spline/Utilities/SplineControlledParticleSystem.cs.meta
vendored
Normal file
19
Assets/External/Pixelplacement/Surge/Spline/Utilities/SplineControlledParticleSystem.cs.meta
vendored
Normal file
@@ -0,0 +1,19 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 390cd5d7e4c3ca3459339daddc886b38
|
||||
timeCreated: 1505006763
|
||||
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/Spline/Utilities/SplineControlledParticleSystem.cs
|
||||
uploadId: 467433
|
||||
122
Assets/External/Pixelplacement/Surge/Spline/Utilities/SplineRenderer.cs
vendored
Normal file
122
Assets/External/Pixelplacement/Surge/Spline/Utilities/SplineRenderer.cs
vendored
Normal file
@@ -0,0 +1,122 @@
|
||||
/// <summary>
|
||||
/// SURGE FRAMEWORK
|
||||
/// Author: Bob Berkebile
|
||||
/// Email: bobb@pixelplacement.com
|
||||
///
|
||||
/// Renders a spline by interfacing with an attached LineRenderer.
|
||||
///
|
||||
/// </summary>
|
||||
|
||||
using UnityEngine;
|
||||
using System.Collections;
|
||||
|
||||
namespace Pixelplacement
|
||||
{
|
||||
[ExecuteInEditMode]
|
||||
[RequireComponent (typeof (LineRenderer))]
|
||||
[RequireComponent (typeof (Spline))]
|
||||
public class SplineRenderer : MonoBehaviour
|
||||
{
|
||||
//Public Variables:
|
||||
public int segmentsPerCurve = 25;
|
||||
[Range (0,1)] public float startPercentage;
|
||||
[Range (0,1)] public float endPercentage = 1;
|
||||
|
||||
//Private Variables:
|
||||
LineRenderer _lineRenderer;
|
||||
Spline _spline;
|
||||
bool _initialized;
|
||||
int _previousAnchorsLength;
|
||||
int _previousSegmentsPerCurve;
|
||||
int _vertexCount;
|
||||
float _previousStart;
|
||||
float _previousEnd;
|
||||
|
||||
//Init:
|
||||
void Reset ()
|
||||
{
|
||||
_lineRenderer = GetComponent<LineRenderer> ();
|
||||
|
||||
_initialized = false;
|
||||
|
||||
_lineRenderer.startWidth = .03f;
|
||||
_lineRenderer.endWidth = .03f;
|
||||
_lineRenderer.startColor = Color.white;
|
||||
_lineRenderer.endColor = Color.yellow;
|
||||
|
||||
_lineRenderer.material = Resources.Load("SplineRenderer") as Material;
|
||||
}
|
||||
|
||||
//Loop:
|
||||
void Update ()
|
||||
{
|
||||
//initialize:
|
||||
if (!_initialized)
|
||||
{
|
||||
//refs:
|
||||
_lineRenderer = GetComponent<LineRenderer> ();
|
||||
_spline = GetComponent<Spline> ();
|
||||
|
||||
//initial setup:
|
||||
ConfigureLineRenderer ();
|
||||
UpdateLineRenderer ();
|
||||
|
||||
_initialized = true;
|
||||
}
|
||||
|
||||
//configure line renderer:
|
||||
if (segmentsPerCurve != _previousSegmentsPerCurve || _previousAnchorsLength != _spline.Anchors.Length)
|
||||
{
|
||||
ConfigureLineRenderer ();
|
||||
UpdateLineRenderer ();
|
||||
}
|
||||
|
||||
if (_spline.Anchors.Length <= 1)
|
||||
{
|
||||
_lineRenderer.positionCount = 0;
|
||||
return;
|
||||
}
|
||||
|
||||
//if any part of the spline is changed update line renderer:
|
||||
foreach (var item in _spline.Anchors)
|
||||
{
|
||||
if (item.RenderingChange)
|
||||
{
|
||||
item.RenderingChange = false;
|
||||
UpdateLineRenderer ();
|
||||
}
|
||||
}
|
||||
|
||||
//if the range has changed, update:
|
||||
if (startPercentage != _previousStart || endPercentage != _previousEnd)
|
||||
{
|
||||
UpdateLineRenderer ();
|
||||
|
||||
//reset:
|
||||
_previousStart = startPercentage;
|
||||
_previousEnd = endPercentage;
|
||||
}
|
||||
}
|
||||
|
||||
//Private Methods:
|
||||
void UpdateLineRenderer ()
|
||||
{
|
||||
if (_spline.Anchors.Length < 2) return;
|
||||
for (int i = 0; i < _vertexCount; i++)
|
||||
{
|
||||
float percentage = i/(float)(_vertexCount - 1);
|
||||
float sample = Mathf.Lerp (startPercentage, endPercentage, percentage);
|
||||
_lineRenderer.SetPosition (i, _spline.GetPosition(sample, false));
|
||||
}
|
||||
}
|
||||
|
||||
void ConfigureLineRenderer ()
|
||||
{
|
||||
segmentsPerCurve = Mathf.Max (0, segmentsPerCurve);
|
||||
_vertexCount = (segmentsPerCurve * (_spline.Anchors.Length - 1)) + 2;
|
||||
if (Mathf.Sign (_vertexCount) == 1) _lineRenderer.positionCount = _vertexCount;
|
||||
_previousSegmentsPerCurve = segmentsPerCurve;
|
||||
_previousAnchorsLength = _spline.Anchors.Length;
|
||||
}
|
||||
}
|
||||
}
|
||||
19
Assets/External/Pixelplacement/Surge/Spline/Utilities/SplineRenderer.cs.meta
vendored
Normal file
19
Assets/External/Pixelplacement/Surge/Spline/Utilities/SplineRenderer.cs.meta
vendored
Normal file
@@ -0,0 +1,19 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 59d7ebe8a03344a7a869c5061d6607a0
|
||||
timeCreated: 1483504895
|
||||
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/Spline/Utilities/SplineRenderer.cs
|
||||
uploadId: 467433
|
||||
9
Assets/External/Pixelplacement/Surge/StateMachine.meta
vendored
Normal file
9
Assets/External/Pixelplacement/Surge/StateMachine.meta
vendored
Normal file
@@ -0,0 +1,9 @@
|
||||
fileFormatVersion: 2
|
||||
guid: f7fa5ceca28d24b96832673798515a67
|
||||
folderAsset: yes
|
||||
timeCreated: 1500598979
|
||||
licenseType: Store
|
||||
DefaultImporter:
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
9
Assets/External/Pixelplacement/Surge/StateMachine/Editor.meta
vendored
Normal file
9
Assets/External/Pixelplacement/Surge/StateMachine/Editor.meta
vendored
Normal file
@@ -0,0 +1,9 @@
|
||||
fileFormatVersion: 2
|
||||
guid: f588a5a76c3094128955cddb5540e896
|
||||
folderAsset: yes
|
||||
timeCreated: 1500598980
|
||||
licenseType: Store
|
||||
DefaultImporter:
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
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
|
||||
125
Assets/External/Pixelplacement/Surge/StateMachine/State.cs
vendored
Normal file
125
Assets/External/Pixelplacement/Surge/StateMachine/State.cs
vendored
Normal file
@@ -0,0 +1,125 @@
|
||||
/// <summary>
|
||||
/// SURGE FRAMEWORK
|
||||
/// Author: Bob Berkebile
|
||||
/// Email: bobb@pixelplacement.com
|
||||
///
|
||||
/// Base class for States to be used as children of StateMachines.
|
||||
///
|
||||
/// </summary>
|
||||
|
||||
using UnityEngine;
|
||||
using System.Collections;
|
||||
|
||||
namespace Pixelplacement
|
||||
{
|
||||
public class State : MonoBehaviour
|
||||
{
|
||||
//Public Properties:
|
||||
/// <summary>
|
||||
/// Gets a value indicating whether this instance is the first state in this state machine.
|
||||
/// </summary>
|
||||
public bool IsFirst
|
||||
{
|
||||
get
|
||||
{
|
||||
return transform.GetSiblingIndex () == 0;
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Gets a value indicating whether this instance is the last state in this state machine.
|
||||
/// </summary>
|
||||
public bool IsLast
|
||||
{
|
||||
get
|
||||
{
|
||||
return transform.GetSiblingIndex () == transform.parent.childCount - 1;
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Gets or sets the state machine.
|
||||
/// </summary>
|
||||
public StateMachine StateMachine
|
||||
{
|
||||
get
|
||||
{
|
||||
if (_stateMachine == null)
|
||||
{
|
||||
_stateMachine = transform.parent.GetComponent<StateMachine>();
|
||||
if (_stateMachine == null)
|
||||
{
|
||||
Debug.LogError("States must be the child of a StateMachine to operate.");
|
||||
return null;
|
||||
}
|
||||
}
|
||||
|
||||
return _stateMachine;
|
||||
}
|
||||
}
|
||||
|
||||
//Private Variables:
|
||||
StateMachine _stateMachine;
|
||||
|
||||
//Public Methods
|
||||
/// <summary>
|
||||
/// Changes the state.
|
||||
/// </summary>
|
||||
public void ChangeState(int childIndex)
|
||||
{
|
||||
StateMachine.ChangeState(childIndex);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Changes the state.
|
||||
/// </summary>
|
||||
public void ChangeState (GameObject state)
|
||||
{
|
||||
StateMachine.ChangeState (state.name);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Changes the state.
|
||||
/// </summary>
|
||||
public void ChangeState (string state)
|
||||
{
|
||||
StateMachine.ChangeState (state);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Change to the next state if possible.
|
||||
/// </summary>
|
||||
public GameObject Next (bool exitIfLast = false)
|
||||
{
|
||||
return StateMachine.Next (exitIfLast);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Change to the previous state if possible.
|
||||
/// </summary>
|
||||
public GameObject Previous (bool exitIfFirst = false)
|
||||
{
|
||||
return StateMachine.Previous (exitIfFirst);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Exit the current state.
|
||||
/// </summary>
|
||||
public void Exit ()
|
||||
{
|
||||
StateMachine.Exit ();
|
||||
}
|
||||
|
||||
protected Coroutine StartCoroutineIfActive(IEnumerator coroutine)
|
||||
{
|
||||
if (gameObject.activeInHierarchy)
|
||||
{
|
||||
return StartCoroutine(coroutine);
|
||||
}
|
||||
else
|
||||
{
|
||||
return null;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
19
Assets/External/Pixelplacement/Surge/StateMachine/State.cs.meta
vendored
Normal file
19
Assets/External/Pixelplacement/Surge/StateMachine/State.cs.meta
vendored
Normal file
@@ -0,0 +1,19 @@
|
||||
fileFormatVersion: 2
|
||||
guid: eaefd3d5a2a864ca5b5d9ec5f2a7040f
|
||||
timeCreated: 1444835219
|
||||
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/State.cs
|
||||
uploadId: 467433
|
||||
289
Assets/External/Pixelplacement/Surge/StateMachine/StateMachine.cs
vendored
Normal file
289
Assets/External/Pixelplacement/Surge/StateMachine/StateMachine.cs
vendored
Normal file
@@ -0,0 +1,289 @@
|
||||
/// <summary>
|
||||
/// SURGE FRAMEWORK
|
||||
/// Author: Bob Berkebile
|
||||
/// Email: bobb@pixelplacement.com
|
||||
///
|
||||
/// StateMachine main class.
|
||||
///
|
||||
/// </summary>
|
||||
|
||||
// Used to disable the lack of usage of the exception in a try/catch:
|
||||
#pragma warning disable 168
|
||||
|
||||
using UnityEngine;
|
||||
using System.Collections;
|
||||
using System.Collections.Generic;
|
||||
using System;
|
||||
using UnityEngine.Events;
|
||||
|
||||
namespace Pixelplacement
|
||||
{
|
||||
[RequireComponent (typeof (Initialization))]
|
||||
public class StateMachine : MonoBehaviour
|
||||
{
|
||||
//Public Variables:
|
||||
public GameObject defaultState;
|
||||
public GameObject currentState;
|
||||
public bool _unityEventsFolded;
|
||||
|
||||
/// <summary>
|
||||
/// Should log messages be thrown during usage?
|
||||
/// </summary>
|
||||
[Tooltip("Should log messages be thrown during usage?")]
|
||||
public bool verbose;
|
||||
|
||||
/// <summary>
|
||||
/// Can States within this StateMachine be reentered?
|
||||
/// </summary>
|
||||
[Tooltip("Can States within this StateMachine be reentered?")]
|
||||
public bool allowReentry = false;
|
||||
|
||||
/// <summary>
|
||||
/// Return to default state on disable?
|
||||
/// </summary>
|
||||
[Tooltip("Return to default state on disable?")]
|
||||
public bool returnToDefaultOnDisable = true;
|
||||
|
||||
//Publice Events:
|
||||
public GameObjectEvent OnStateExited;
|
||||
public GameObjectEvent OnStateEntered;
|
||||
public UnityEvent OnFirstStateEntered;
|
||||
public UnityEvent OnFirstStateExited;
|
||||
public UnityEvent OnLastStateEntered;
|
||||
public UnityEvent OnLastStateExited;
|
||||
|
||||
//Public Properties:
|
||||
/// <summary>
|
||||
/// Internal flag used to determine if the StateMachine is set up properly.
|
||||
/// </summary>
|
||||
public bool CleanSetup
|
||||
{
|
||||
get;
|
||||
private set;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Are we at the first state in this state machine.
|
||||
/// </summary>
|
||||
public bool AtFirst
|
||||
{
|
||||
get
|
||||
{
|
||||
return _atFirst;
|
||||
}
|
||||
|
||||
private set
|
||||
{
|
||||
if (_atFirst)
|
||||
{
|
||||
_atFirst = false;
|
||||
if (OnFirstStateExited != null) OnFirstStateExited.Invoke ();
|
||||
} else {
|
||||
_atFirst = true;
|
||||
if (OnFirstStateEntered != null) OnFirstStateEntered.Invoke ();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Are we at the last state in this state machine.
|
||||
/// </summary>
|
||||
public bool AtLast
|
||||
{
|
||||
get
|
||||
{
|
||||
return _atLast;
|
||||
}
|
||||
|
||||
private set
|
||||
{
|
||||
if (_atLast)
|
||||
{
|
||||
_atLast = false;
|
||||
if (OnLastStateExited != null) OnLastStateExited.Invoke ();
|
||||
} else {
|
||||
_atLast = true;
|
||||
if (OnLastStateEntered != null) OnLastStateEntered.Invoke ();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
//Private Variables:
|
||||
bool _initialized;
|
||||
bool _atFirst;
|
||||
bool _atLast;
|
||||
|
||||
//Public Methods:
|
||||
/// <summary>
|
||||
/// Change to the next state if possible.
|
||||
/// </summary>
|
||||
public GameObject Next (bool exitIfLast = false)
|
||||
{
|
||||
if (currentState == null) return ChangeState (0);
|
||||
int currentIndex = currentState.transform.GetSiblingIndex();
|
||||
if (currentIndex == transform.childCount - 1)
|
||||
{
|
||||
if (exitIfLast)
|
||||
{
|
||||
Exit();
|
||||
return null;
|
||||
}
|
||||
else
|
||||
{
|
||||
return currentState;
|
||||
}
|
||||
}else{
|
||||
return ChangeState (++currentIndex);
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Change to the previous state if possible.
|
||||
/// </summary>
|
||||
public GameObject Previous (bool exitIfFirst = false)
|
||||
{
|
||||
if (currentState == null) return ChangeState(0);
|
||||
int currentIndex = currentState.transform.GetSiblingIndex();
|
||||
if (currentIndex == 0)
|
||||
{
|
||||
if (exitIfFirst)
|
||||
{
|
||||
Exit();
|
||||
return null;
|
||||
}
|
||||
else
|
||||
{
|
||||
return currentState;
|
||||
}
|
||||
}
|
||||
else{
|
||||
return ChangeState(--currentIndex);
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Exit the current state.
|
||||
/// </summary>
|
||||
public void Exit ()
|
||||
{
|
||||
if (currentState == null) return;
|
||||
Log ("(-) " + name + " EXITED state: " + currentState.name);
|
||||
int currentIndex = currentState.transform.GetSiblingIndex ();
|
||||
|
||||
//no longer at first:
|
||||
if (currentIndex == 0) AtFirst = false;
|
||||
|
||||
//no longer at last:
|
||||
if (currentIndex == transform.childCount - 1) AtLast = false;
|
||||
|
||||
if (OnStateExited != null) OnStateExited.Invoke (currentState);
|
||||
currentState.SetActive (false);
|
||||
currentState = null;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Changes the state.
|
||||
/// </summary>
|
||||
public GameObject ChangeState (int childIndex)
|
||||
{
|
||||
if (childIndex > transform.childCount-1)
|
||||
{
|
||||
Log("Index is greater than the amount of states in the StateMachine \"" + gameObject.name + "\" please verify the index you are trying to change to.");
|
||||
return null;
|
||||
}
|
||||
|
||||
return ChangeState(transform.GetChild(childIndex).gameObject);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Changes the state.
|
||||
/// </summary>
|
||||
public GameObject ChangeState (GameObject state)
|
||||
{
|
||||
if (currentState != null)
|
||||
{
|
||||
if (!allowReentry && state == currentState)
|
||||
{
|
||||
Log("State change ignored. State machine \"" + name + "\" already in \"" + state.name + "\" state.");
|
||||
return null;
|
||||
}
|
||||
}
|
||||
|
||||
if (state.transform.parent != transform)
|
||||
{
|
||||
Log("State \"" + state.name + "\" is not a child of \"" + name + "\" StateMachine state change canceled.");
|
||||
return null;
|
||||
}
|
||||
|
||||
Exit();
|
||||
Enter(state);
|
||||
|
||||
return currentState;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Changes the state.
|
||||
/// </summary>
|
||||
public GameObject ChangeState (string state)
|
||||
{
|
||||
Transform found = transform.Find(state);
|
||||
if (!found)
|
||||
{
|
||||
Log("\"" + name + "\" does not contain a state by the name of \"" + state + "\" please verify the name of the state you are trying to reach.");
|
||||
return null;
|
||||
}
|
||||
|
||||
return ChangeState(found.gameObject);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Internally used within the framework to auto start the state machine.
|
||||
/// </summary>
|
||||
public void Initialize()
|
||||
{
|
||||
//turn off all states:
|
||||
for (int i = 0; i < transform.childCount; i++)
|
||||
{
|
||||
transform.GetChild(i).gameObject.SetActive(false);
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Internally used within the framework to auto start the state machine.
|
||||
/// </summary>
|
||||
public void StartMachine ()
|
||||
{
|
||||
//start the machine:
|
||||
if (Application.isPlaying && defaultState != null) ChangeState (defaultState.name);
|
||||
}
|
||||
|
||||
//Private Methods:
|
||||
void Enter (GameObject state)
|
||||
{
|
||||
currentState = state;
|
||||
int index = currentState.transform.GetSiblingIndex ();
|
||||
|
||||
//entering first:
|
||||
if (index == 0)
|
||||
{
|
||||
AtFirst = true;
|
||||
}
|
||||
|
||||
//entering last:
|
||||
if (index == transform.childCount - 1)
|
||||
{
|
||||
AtLast = true;
|
||||
}
|
||||
|
||||
Log( "(+) " + name + " ENTERED state: " + state.name);
|
||||
if (OnStateEntered != null) OnStateEntered.Invoke (currentState);
|
||||
currentState.SetActive (true);
|
||||
}
|
||||
|
||||
void Log (string message)
|
||||
{
|
||||
if (!verbose) return;
|
||||
Debug.Log (message, gameObject);
|
||||
}
|
||||
}
|
||||
}
|
||||
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user