Merge branch 'master' of http://172.16.1.12/yulong/NewN_UAVPlane
This commit is contained in:
commit
5dd955ec30
|
@ -12,7 +12,7 @@ GameObject:
|
|||
- component: {fileID: 5180839583983594084}
|
||||
- component: {fileID: 1550731372138684840}
|
||||
- component: {fileID: 8476325289806523627}
|
||||
m_Layer: 5
|
||||
m_Layer: 0
|
||||
m_Name: Sphere
|
||||
m_TagString: Untagged
|
||||
m_Icon: {fileID: 0}
|
||||
|
@ -102,8 +102,8 @@ GameObject:
|
|||
serializedVersion: 6
|
||||
m_Component:
|
||||
- component: {fileID: 1547420170257315258}
|
||||
m_Layer: 5
|
||||
m_Name: Point
|
||||
m_Layer: 0
|
||||
m_Name: LinePoint
|
||||
m_TagString: Untagged
|
||||
m_Icon: {fileID: 0}
|
||||
m_NavMeshLayer: 0
|
||||
|
|
|
@ -135,6 +135,8 @@ GameObject:
|
|||
- component: {fileID: 6865737300552731159}
|
||||
- component: {fileID: 6865737300552731156}
|
||||
- component: {fileID: 41106886}
|
||||
- component: {fileID: 1432105532577387308}
|
||||
- component: {fileID: 3231389817124393935}
|
||||
m_Layer: 9
|
||||
m_Name: "\u65E0\u4EBA\u673AList"
|
||||
m_TagString: Untagged
|
||||
|
@ -191,6 +193,7 @@ MonoBehaviour:
|
|||
index1: 0
|
||||
speed: 100
|
||||
huoPaoControllerList: []
|
||||
attackTarget: []
|
||||
isMove: 0
|
||||
dis: 0
|
||||
limitDis: 0
|
||||
|
@ -198,6 +201,8 @@ MonoBehaviour:
|
|||
firePrefab: {fileID: 3257275699554257525, guid: deb8a70a5ca26dd41b3c33876785f507,
|
||||
type: 3}
|
||||
isGoToPlace: 0
|
||||
isAuto: 0
|
||||
fireCount: 30
|
||||
currentHuoPaoIndex: 0
|
||||
--- !u!65 &41106886
|
||||
BoxCollider:
|
||||
|
@ -212,6 +217,81 @@ BoxCollider:
|
|||
serializedVersion: 2
|
||||
m_Size: {x: 6.96, y: 2.32, z: 4.92}
|
||||
m_Center: {x: 0, y: 1.5, z: 0.19}
|
||||
--- !u!114 &1432105532577387308
|
||||
MonoBehaviour:
|
||||
m_ObjectHideFlags: 0
|
||||
m_CorrespondingSourceObject: {fileID: 0}
|
||||
m_PrefabInstance: {fileID: 0}
|
||||
m_PrefabAsset: {fileID: 0}
|
||||
m_GameObject: {fileID: 6865737300552731157}
|
||||
m_Enabled: 1
|
||||
m_EditorHideFlags: 0
|
||||
m_Script: {fileID: 11500000, guid: 67d4de287b46eb34e83a61e4f9115070, type: 3}
|
||||
m_Name:
|
||||
m_EditorClassIdentifier:
|
||||
mode: 0
|
||||
forceRender: 0
|
||||
color: {r: 1, g: 1, b: 1, a: 1}
|
||||
_overlay: 0
|
||||
_occluder: 0
|
||||
_tween: 0
|
||||
_tweenGradient:
|
||||
serializedVersion: 2
|
||||
key0: {r: 0, g: 1, b: 1, a: 0}
|
||||
key1: {r: 0, g: 1, b: 1, a: 1}
|
||||
key2: {r: 0, g: 0, b: 0, a: 0}
|
||||
key3: {r: 0, g: 0, b: 0, a: 0}
|
||||
key4: {r: 0, g: 0, b: 0, a: 0}
|
||||
key5: {r: 0, g: 0, b: 0, a: 0}
|
||||
key6: {r: 0, g: 0, b: 0, a: 0}
|
||||
key7: {r: 0, g: 0, b: 0, a: 0}
|
||||
ctime0: 0
|
||||
ctime1: 65535
|
||||
ctime2: 0
|
||||
ctime3: 0
|
||||
ctime4: 0
|
||||
ctime5: 0
|
||||
ctime6: 0
|
||||
ctime7: 0
|
||||
atime0: 0
|
||||
atime1: 65535
|
||||
atime2: 0
|
||||
atime3: 0
|
||||
atime4: 0
|
||||
atime5: 0
|
||||
atime6: 0
|
||||
atime7: 0
|
||||
m_Mode: 0
|
||||
m_NumColorKeys: 2
|
||||
m_NumAlphaKeys: 2
|
||||
_tweenDuration: 1
|
||||
_tweenReverse: 0
|
||||
_tweenLoop: 2
|
||||
_tweenEasing: 0
|
||||
_tweenDelay: 0
|
||||
_tweenRepeatCount: -1
|
||||
_tweenUseUnscaledTime: 0
|
||||
_constant: 0
|
||||
_constantColor: {r: 1, g: 0.92156863, b: 0.015686275, a: 1}
|
||||
_constantFadeInTime: 0.1
|
||||
_constantFadeOutTime: 0.25
|
||||
_constantEasing: 0
|
||||
_constantUseUnscaledTime: 0
|
||||
_filterMode: 0
|
||||
_filterList: []
|
||||
--- !u!114 &3231389817124393935
|
||||
MonoBehaviour:
|
||||
m_ObjectHideFlags: 0
|
||||
m_CorrespondingSourceObject: {fileID: 0}
|
||||
m_PrefabInstance: {fileID: 0}
|
||||
m_PrefabAsset: {fileID: 0}
|
||||
m_GameObject: {fileID: 6865737300552731157}
|
||||
m_Enabled: 1
|
||||
m_EditorHideFlags: 0
|
||||
m_Script: {fileID: 11500000, guid: e7de33601c65ad84eac6d63477030d3d, type: 3}
|
||||
m_Name:
|
||||
m_EditorClassIdentifier:
|
||||
selfHighlight: {fileID: 0}
|
||||
--- !u!1001 &6865737299184050514
|
||||
PrefabInstance:
|
||||
m_ObjectHideFlags: 0
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
fileFormatVersion: 2
|
||||
guid: 2867c644cac2f7b488d4acbc11bd2ea4
|
||||
guid: 0610fddf11f98ba419a3c3dc100496ee
|
||||
folderAsset: yes
|
||||
DefaultImporter:
|
||||
externalObjects: {}
|
|
@ -0,0 +1,5 @@
|
|||
fileFormatVersion: 2
|
||||
guid: 4de23785d38293b47b1aa97aef36ef95
|
||||
folderAsset: yes
|
||||
DefaultImporter:
|
||||
userData:
|
|
@ -0,0 +1,260 @@
|
|||
using System;
|
||||
using System.Collections;
|
||||
using System.Collections.Generic;
|
||||
using UnityEngine;
|
||||
using UnityEditor;
|
||||
using UnityEditorInternal;
|
||||
|
||||
namespace HighlightingSystem
|
||||
{
|
||||
[CustomEditor(typeof(Highlighter)), CanEditMultipleObjects]
|
||||
public class HighlighterEditor : Editor
|
||||
{
|
||||
private const string kShowTweenKey = "HighlightingSystem.Highlighter.ShowTween";
|
||||
private const string kShowConstantKey = "HighlightingSystem.Highlighter.ShowConstant";
|
||||
private const string kShowFilterKey = "HighlightingSystem.Highlighter.ShowFilter";
|
||||
|
||||
static private readonly GUIContent labelOverlay = new GUIContent("Overlay");
|
||||
static private readonly GUIContent labelOccluder = new GUIContent("Occluder");
|
||||
static private readonly GUIContent labelColor = new GUIContent("Color (Current)");
|
||||
static private readonly GUIContent labelForceRender = new GUIContent("Force Render");
|
||||
|
||||
static private readonly GUIContent labelTween = new GUIContent("Tween");
|
||||
static private readonly GUIContent labelGradient = new GUIContent("Gradient");
|
||||
static private readonly GUIContent labelDuration = new GUIContent("Duration");
|
||||
static private readonly GUIContent labelUseUnscaledTime = new GUIContent("Use Unscaled Time");
|
||||
static private readonly GUIContent labelDelay = new GUIContent("Delay");
|
||||
static private readonly GUIContent labelLoopMode = new GUIContent("Loop Mode");
|
||||
static private readonly GUIContent labelEasing = new GUIContent("Easing");
|
||||
static private readonly GUIContent labelReverse = new GUIContent("Reverse");
|
||||
static private readonly GUIContent labelRepeatCount = new GUIContent("Repeat Count");
|
||||
|
||||
static private readonly GUIContent labelConstant = new GUIContent("Constant");
|
||||
static private readonly GUIContent labelConstantColor = new GUIContent("Constant Color");
|
||||
static private readonly GUIContent labelFadeInTime = new GUIContent("Fade In Time");
|
||||
static private readonly GUIContent labelFadeOutTime = new GUIContent("Fade Out Time");
|
||||
|
||||
static private readonly GUIContent labelFilterMode = new GUIContent("Mode");
|
||||
static private readonly GUIContent labelFilterList = new GUIContent("Transform Filtering List");
|
||||
|
||||
static private readonly GUIContent labelGroupTween = new GUIContent("Tween");
|
||||
static private readonly GUIContent labelGroupConstant = new GUIContent("Constant");
|
||||
static private readonly GUIContent labelGroupFilter = new GUIContent("Filter");
|
||||
|
||||
private Dictionary<string, SerializedProperty> fieldCache = new Dictionary<string, SerializedProperty>();
|
||||
private Highlighter highlighter;
|
||||
private SerializedProperty propertyFilterList;
|
||||
|
||||
private ReorderableList listFilter;
|
||||
|
||||
private bool showTween;
|
||||
private bool showConstant;
|
||||
private bool showFilter;
|
||||
|
||||
//
|
||||
void OnEnable()
|
||||
{
|
||||
highlighter = target as Highlighter;
|
||||
|
||||
propertyFilterList = serializedObject.FindProperty("_filterList");
|
||||
|
||||
showTween = EditorPrefs.GetBool(kShowTweenKey, false);
|
||||
showConstant = EditorPrefs.GetBool(kShowConstantKey, false);
|
||||
showFilter = EditorPrefs.GetBool(kShowFilterKey, false);
|
||||
|
||||
listFilter = new ReorderableList(serializedObject, propertyFilterList, true, true, true, true);
|
||||
listFilter.drawHeaderCallback = new ReorderableList.HeaderCallbackDelegate(FilterListDrawHeader);
|
||||
listFilter.onAddCallback = new ReorderableList.AddCallbackDelegate(FilterListAdd);
|
||||
listFilter.onRemoveCallback = new ReorderableList.RemoveCallbackDelegate(FilterListRemove);
|
||||
listFilter.drawElementCallback = new ReorderableList.ElementCallbackDelegate(FilterListDrawElement);
|
||||
listFilter.elementHeight = EditorGUIUtility.singleLineHeight + 2f;
|
||||
}
|
||||
|
||||
//
|
||||
public override void OnInspectorGUI()
|
||||
{
|
||||
serializedObject.Update();
|
||||
|
||||
EditorGUI.BeginChangeCheck();
|
||||
|
||||
DoGeneralGUI();
|
||||
DoHighlighterGUI();
|
||||
|
||||
if (EditorGUI.EndChangeCheck())
|
||||
{
|
||||
serializedObject.ApplyModifiedProperties();
|
||||
}
|
||||
}
|
||||
|
||||
//
|
||||
private void DoGeneralGUI()
|
||||
{
|
||||
// General
|
||||
EditorGUILayout.PropertyField(FindField("_overlay"), labelOverlay);
|
||||
EditorGUILayout.PropertyField(FindField("_occluder"), labelOccluder);
|
||||
EditorGUILayout.PropertyField(FindField("forceRender"), labelForceRender);
|
||||
|
||||
// Current color (readonly, since Highlighter component overrides it's value every frame)
|
||||
using (new EditorGUI.DisabledScope(true))
|
||||
{
|
||||
EditorGUILayout.PropertyField(FindField("color"), labelColor);
|
||||
}
|
||||
}
|
||||
|
||||
//
|
||||
private void DoHighlighterGUI()
|
||||
{
|
||||
// Tween
|
||||
if (Foldout(labelGroupTween, ref showTween, kShowTweenKey))
|
||||
{
|
||||
using (new EditorGUI.IndentLevelScope())
|
||||
{
|
||||
EditorGUILayout.PropertyField(FindField("_tween"), labelTween);
|
||||
EditorGUILayout.PropertyField(FindField("_tweenGradient"), labelGradient);
|
||||
//DoSpectrumButtonGUI();
|
||||
EditorGUILayout.PropertyField(FindField("_tweenDuration"), labelDuration);
|
||||
EditorGUILayout.PropertyField(FindField("_tweenReverse"), labelReverse);
|
||||
EditorGUILayout.PropertyField(FindField("_tweenLoop"), labelLoopMode);
|
||||
EditorGUILayout.PropertyField(FindField("_tweenEasing"), labelEasing);
|
||||
EditorGUILayout.PropertyField(FindField("_tweenDelay"), labelDelay);
|
||||
EditorGUILayout.PropertyField(FindField("_tweenRepeatCount"), labelRepeatCount);
|
||||
EditorGUILayout.PropertyField(FindField("_tweenUseUnscaledTime"), labelUseUnscaledTime);
|
||||
}
|
||||
}
|
||||
|
||||
// Constant
|
||||
if (Foldout(labelGroupConstant, ref showConstant, kShowConstantKey))
|
||||
{
|
||||
using (new EditorGUI.IndentLevelScope())
|
||||
{
|
||||
EditorGUILayout.PropertyField(FindField("_constant"), labelConstant);
|
||||
EditorGUILayout.PropertyField(FindField("_constantColor"), labelConstantColor);
|
||||
EditorGUILayout.PropertyField(FindField("_constantFadeInTime"), labelFadeInTime);
|
||||
EditorGUILayout.PropertyField(FindField("_constantFadeOutTime"), labelFadeOutTime);
|
||||
EditorGUILayout.PropertyField(FindField("_constantEasing"), labelEasing);
|
||||
EditorGUILayout.PropertyField(FindField("_constantUseUnscaledTime"), labelUseUnscaledTime);
|
||||
}
|
||||
}
|
||||
|
||||
if (Foldout(labelGroupFilter, ref showFilter, kShowFilterKey))
|
||||
{
|
||||
using (new EditorGUI.IndentLevelScope())
|
||||
{
|
||||
// filterMode
|
||||
SerializedProperty fieldFilterMode = FindField("_filterMode");
|
||||
EditorGUILayout.PropertyField(fieldFilterMode, labelFilterMode);
|
||||
|
||||
if (!fieldFilterMode.hasMultipleDifferentValues)
|
||||
{
|
||||
RendererFilterMode filterMode = (RendererFilterMode)fieldFilterMode.enumValueIndex;
|
||||
|
||||
if (highlighter.rendererFilter != null)
|
||||
{
|
||||
EditorGUILayout.HelpBox("Custom RendererFilter assigned to this Highlighter. Filtering list disabled.", MessageType.Warning);
|
||||
}
|
||||
else
|
||||
{
|
||||
switch (filterMode)
|
||||
{
|
||||
case RendererFilterMode.None:
|
||||
EditorGUILayout.HelpBox("All Renderers found in child GameObjects will be highlighted.", MessageType.Info);
|
||||
break;
|
||||
case RendererFilterMode.Include:
|
||||
EditorGUILayout.HelpBox("Renderers only on specified Transforms (and any of their children) will be highlighted.", MessageType.Info);
|
||||
break;
|
||||
case RendererFilterMode.Exclude:
|
||||
EditorGUILayout.HelpBox("Renderers on specified Transforms (and any of their children) will be excluded from highlighting.", MessageType.Info);
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// filterList
|
||||
Rect rect = EditorGUI.IndentedRect(GUILayoutUtility.GetRect(0f, listFilter.GetHeight()));
|
||||
listFilter.DoList(rect);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
//
|
||||
private SerializedProperty FindField(string fieldPath)
|
||||
{
|
||||
SerializedProperty field;
|
||||
if (!fieldCache.TryGetValue(fieldPath, out field))
|
||||
{
|
||||
field = serializedObject.FindProperty(fieldPath);
|
||||
fieldCache.Add(fieldPath, field);
|
||||
}
|
||||
return field;
|
||||
}
|
||||
|
||||
//
|
||||
private bool Foldout(GUIContent content, ref bool isExpanded, string key)
|
||||
{
|
||||
Rect rect = GUILayoutUtility.GetRect(content, EditorStyles.foldout);
|
||||
bool expanded = EditorGUI.Foldout(rect, isExpanded, content, true, EditorStyles.foldout);
|
||||
if (expanded != isExpanded && !string.IsNullOrEmpty(key))
|
||||
{
|
||||
isExpanded = expanded;
|
||||
EditorPrefs.SetBool(key, isExpanded);
|
||||
}
|
||||
return isExpanded;
|
||||
}
|
||||
|
||||
//
|
||||
private void DoSpectrumButtonGUI()
|
||||
{
|
||||
// Spectrum
|
||||
if (GUILayout.Button("Spectrum"))
|
||||
{
|
||||
highlighter.tweenGradient = new Gradient()
|
||||
{
|
||||
colorKeys = new GradientColorKey[]
|
||||
{
|
||||
new GradientColorKey(new Color(1f, 0f, 0f, 1f), 0f / 6f),
|
||||
new GradientColorKey(new Color(1f, 1f, 0f, 1f), 1f / 6f),
|
||||
new GradientColorKey(new Color(0f, 1f, 0f, 1f), 2f / 6f),
|
||||
new GradientColorKey(new Color(0f, 1f, 1f, 1f), 3f / 6f),
|
||||
new GradientColorKey(new Color(0f, 0f, 1f, 1f), 4f / 6f),
|
||||
new GradientColorKey(new Color(1f, 0f, 1f, 1f), 5f / 6f),
|
||||
new GradientColorKey(new Color(1f, 0f, 0f, 1f), 6f / 6f),
|
||||
},
|
||||
alphaKeys = new GradientAlphaKey[]
|
||||
{
|
||||
new GradientAlphaKey(1f, 0f),
|
||||
new GradientAlphaKey(1f, 1f),
|
||||
}
|
||||
};
|
||||
GUI.changed = true;
|
||||
}
|
||||
}
|
||||
|
||||
//
|
||||
private void FilterListDrawHeader(Rect rect)
|
||||
{
|
||||
EditorGUI.LabelField(rect, labelFilterList);
|
||||
}
|
||||
|
||||
//
|
||||
private void FilterListAdd(ReorderableList list)
|
||||
{
|
||||
ReorderableList.defaultBehaviours.DoAddButton(list);
|
||||
}
|
||||
|
||||
//
|
||||
private void FilterListRemove(ReorderableList list)
|
||||
{
|
||||
ReorderableList.defaultBehaviours.DoRemoveButton(list);
|
||||
}
|
||||
|
||||
//
|
||||
private void FilterListDrawElement(Rect rect, int index, bool selected, bool focused)
|
||||
{
|
||||
rect.height -= 2f;
|
||||
var propertyElement = propertyFilterList.GetArrayElementAtIndex(index);
|
||||
EditorGUI.ObjectField(rect, propertyElement);
|
||||
//EditorGUIUtility.ShowObjectPicker;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
@ -0,0 +1,13 @@
|
|||
fileFormatVersion: 2
|
||||
guid: eaf65e4acd958f242864d8748239d7c0
|
||||
timeCreated: 1516708826
|
||||
licenseType: Store
|
||||
MonoImporter:
|
||||
externalObjects: {}
|
||||
serializedVersion: 2
|
||||
defaultReferences: []
|
||||
executionOrder: 0
|
||||
icon: {instanceID: 0}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
|
@ -0,0 +1,15 @@
|
|||
using UnityEngine;
|
||||
using UnityEditor;
|
||||
|
||||
namespace HighlightingSystem
|
||||
{
|
||||
[CustomEditor(typeof(HighlightingBlitter), true)]
|
||||
public class HighlightingBlitterEditor : Editor
|
||||
{
|
||||
//
|
||||
public override void OnInspectorGUI()
|
||||
{
|
||||
EditorGUILayout.HelpBox("Use order of this component (relatively to other Image Effects on this camera) to control the point at which highlighting will be applied to the framebuffer (click on a little gear icon to the right and choose Move Up / Move Down).", MessageType.Info);
|
||||
}
|
||||
}
|
||||
}
|
|
@ -0,0 +1,12 @@
|
|||
fileFormatVersion: 2
|
||||
guid: f2c076edfe3724942afcb2b87d77e050
|
||||
timeCreated: 1454882223
|
||||
licenseType: Store
|
||||
MonoImporter:
|
||||
serializedVersion: 2
|
||||
defaultReferences: []
|
||||
executionOrder: 0
|
||||
icon: {instanceID: 0}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
|
@ -0,0 +1,79 @@
|
|||
using UnityEditor;
|
||||
using UnityEngine;
|
||||
|
||||
namespace HighlightingSystem
|
||||
{
|
||||
[CustomPropertyDrawer(typeof(HighlightingPreset), true)]
|
||||
public class HighlightingPresetEditor : PropertyDrawer
|
||||
{
|
||||
#region Static Fields and Constants
|
||||
static public readonly GUIContent labelFillAlpha = new GUIContent("Fill Alpha", "Inner fill alpha value.");
|
||||
static public readonly GUIContent labelDownsampling = new GUIContent("Downsampling:", "Downsampling factor.");
|
||||
static public readonly GUIContent labelIterations = new GUIContent("Iterations:", "Blur iterations. Number of blur iterations performed. Larger number means more blur.");
|
||||
static public readonly GUIContent labelBlurMinSpread = new GUIContent("Min Spread:", "Blur Min Spread. Lower values give better looking blur, but require more iterations to get large blurs. Pixel offset for each blur iteration is calculated as 'Min Spread + Spread * Iteration Index'. Usually 'Min Spread + Spread' value is between 0.5 and 1.0.");
|
||||
static public readonly GUIContent labelBlurSpread = new GUIContent("Spread:", "Blur Spread. Lower values give better looking blur, but require more iterations to get large blurs. Pixel offset for each blur iteration is calculated as 'Min Spread + Spread * Iteration Index'. Usually 'Min Spread + Spread' value is between 0.5 and 1.0.");
|
||||
static public readonly GUIContent labelBlurIntensity = new GUIContent("Intensity:", "Highlighting Intensity. Internally defines the value by which highlighting buffer alpha channel will be multiplied after each blur iteration.");
|
||||
static public readonly GUIContent labelBlurDirections = new GUIContent("Blur Directions:", "Blur directions.");
|
||||
|
||||
static public readonly GUIContent[] downsampleOptions = new GUIContent[] { new GUIContent("None"), new GUIContent("Half"), new GUIContent("Quarter") };
|
||||
static public readonly int[] downsampleGet = new int[] { -1, 0, 1, -1, 2 }; // maps downsampleFactor to the downsampleOptions index
|
||||
static public readonly int[] downsampleSet = new int[] { 1, 2, 4 }; // maps downsampleOptions index to the downsampleFactor
|
||||
static public readonly GUIContent[] blurDirections = new GUIContent[] { new GUIContent("Diagonal"), new GUIContent("Straight"), new GUIContent("All") };
|
||||
|
||||
private const float rowSpace = 2f;
|
||||
#endregion
|
||||
|
||||
#region Private Fields
|
||||
private Rect[] rects = new Rect[8];
|
||||
#endregion
|
||||
|
||||
#region PropertyDrawer
|
||||
//
|
||||
public override float GetPropertyHeight(SerializedProperty property, GUIContent label)
|
||||
{
|
||||
int l = rects.Length;
|
||||
return 16f * l + rowSpace * (l - 1);
|
||||
}
|
||||
|
||||
//
|
||||
public override void OnGUI(Rect position, SerializedProperty property, GUIContent label)
|
||||
{
|
||||
EditorGUI.BeginProperty(position, label, property);
|
||||
|
||||
// Draw label
|
||||
position = EditorGUI.PrefixLabel(position, GUIUtility.GetControlID(FocusType.Passive), label);
|
||||
|
||||
int indent = EditorGUI.indentLevel;
|
||||
EditorGUI.indentLevel = 0;
|
||||
|
||||
// Calculate rects
|
||||
HighlightingRendererEditor.GetRowRects(position, rowSpace, rects);
|
||||
|
||||
// Find properties
|
||||
SerializedProperty propertyName = property.FindPropertyRelative("_name");
|
||||
SerializedProperty propertyFillAlpha = property.FindPropertyRelative("_fillAlpha");
|
||||
SerializedProperty propertyDownsampleFactor = property.FindPropertyRelative("_downsampleFactor");
|
||||
SerializedProperty propertyIterations = property.FindPropertyRelative("_iterations");
|
||||
SerializedProperty propertyBlurMinSpread = property.FindPropertyRelative("_blurMinSpread");
|
||||
SerializedProperty propertyBlurSpread = property.FindPropertyRelative("_blurSpread");
|
||||
SerializedProperty propertyBlurIntensty = property.FindPropertyRelative("_blurIntensity");
|
||||
SerializedProperty propertyBlurDirections = property.FindPropertyRelative("_blurDirections");
|
||||
|
||||
// Draw properties
|
||||
int index = 0;
|
||||
propertyName.stringValue = EditorGUI.TextField(rects[index], propertyName.stringValue); index++;
|
||||
propertyFillAlpha.floatValue = EditorGUI.Slider(rects[index], labelFillAlpha, propertyFillAlpha.floatValue, 0f, 1f); index++;
|
||||
propertyDownsampleFactor.intValue = downsampleSet[EditorGUI.Popup(rects[index], labelDownsampling, downsampleGet[propertyDownsampleFactor.intValue], downsampleOptions)]; index++;
|
||||
propertyIterations.intValue = Mathf.Clamp(EditorGUI.IntField(rects[index], labelIterations, propertyIterations.intValue), 0, 50); index++;
|
||||
propertyBlurMinSpread.floatValue = EditorGUI.Slider(rects[index], labelBlurMinSpread, propertyBlurMinSpread.floatValue, 0f, 3f); index++;
|
||||
propertyBlurSpread.floatValue = EditorGUI.Slider(rects[index], labelBlurSpread, propertyBlurSpread.floatValue, 0f, 3f); index++;
|
||||
propertyBlurIntensty.floatValue = EditorGUI.Slider(rects[index], labelBlurIntensity, propertyBlurIntensty.floatValue, 0f, 1f); index++;
|
||||
propertyBlurDirections.enumValueIndex = (int)EditorGUI.Popup(rects[index], labelBlurDirections, propertyBlurDirections.enumValueIndex, blurDirections); index++;
|
||||
|
||||
EditorGUI.indentLevel = indent;
|
||||
|
||||
EditorGUI.EndProperty();
|
||||
}
|
||||
#endregion
|
||||
}
|
||||
}
|
|
@ -0,0 +1,12 @@
|
|||
fileFormatVersion: 2
|
||||
guid: f38067eff9f5f884cbbc58b840c98311
|
||||
timeCreated: 1480274718
|
||||
licenseType: Store
|
||||
MonoImporter:
|
||||
serializedVersion: 2
|
||||
defaultReferences: []
|
||||
executionOrder: 0
|
||||
icon: {instanceID: 0}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
|
@ -0,0 +1,369 @@
|
|||
using UnityEngine;
|
||||
using UnityEditor;
|
||||
using System.Collections;
|
||||
using System.Collections.ObjectModel;
|
||||
using System.Collections.Generic;
|
||||
using System.Reflection;
|
||||
|
||||
namespace HighlightingSystem
|
||||
{
|
||||
[CustomEditor(typeof(HighlightingRenderer), true)]
|
||||
public class HighlightingRendererEditor : Editor
|
||||
{
|
||||
#region Static Fields and Constants
|
||||
static protected readonly GUIContent labelButtonRemove = new GUIContent("Remove Preset");
|
||||
static protected readonly GUIContent labelAntiAliasing = new GUIContent("Anti Aliasing");
|
||||
static protected readonly GUIContent[] antiAliasingOptions = new GUIContent[] { new GUIContent("Use Value From Quality Settings"), new GUIContent("Disabled"), new GUIContent("2x Multi Sampling"), new GUIContent("4x Multi Sampling"), new GUIContent("8x Multi Sampling") };
|
||||
#endregion
|
||||
|
||||
#region Protected Fields
|
||||
protected HighlightingRenderer hr;
|
||||
protected SavePresetWindow window;
|
||||
protected MethodInfo boldFontMethodInfo;
|
||||
protected Rect[] buttonRects = new Rect[2];
|
||||
protected GUIContent[] presetNames;
|
||||
#endregion
|
||||
|
||||
#region Editor
|
||||
//
|
||||
protected virtual void OnEnable()
|
||||
{
|
||||
hr = target as HighlightingRenderer;
|
||||
}
|
||||
|
||||
//
|
||||
public override void OnInspectorGUI()
|
||||
{
|
||||
#if UNITY_IPHONE || UNITY_ANDROID || UNITY_WP8 || UNITY_BLACKBERRY
|
||||
if (!PlayerSettings.use32BitDisplayBuffer)
|
||||
{
|
||||
EditorGUILayout.HelpBox("Highlighting System requires 32-bit display buffer. Set the 'Use 32-bit Display Buffer' checkbox under the 'Resolution and Presentation' section of Player Settings.", MessageType.Error);
|
||||
}
|
||||
#endif
|
||||
|
||||
EditorGUILayout.Space();
|
||||
|
||||
// HighlightingBlitter field
|
||||
if (hr.blitter == null)
|
||||
{
|
||||
EditorGUILayout.HelpBox("Use order of this component (relatively to other Image Effects on this camera) to control the point at which highlighting will be applied to the framebuffer (click on a little gear icon to the right and choose Move Up / Move Down) or assign HighlightingBlitter component from another camera.", MessageType.Info);
|
||||
}
|
||||
else if (hr.GetComponent<Camera>() == hr.blitter.GetComponent<Camera>())
|
||||
{
|
||||
EditorGUILayout.HelpBox("Assigned HighlightingBlitter component exists on the same camera. This is not really necessary in most situations and affects rendering performance! Please make sure this is intended.", MessageType.Warning);
|
||||
}
|
||||
hr.blitter = EditorGUILayout.ObjectField("Blitter (Optional)", hr.blitter, typeof(HighlightingBlitter), true) as HighlightingBlitter;
|
||||
|
||||
hr.antiAliasing = (AntiAliasing)EditorGUILayout.Popup(labelAntiAliasing, (int)hr.antiAliasing, antiAliasingOptions);
|
||||
|
||||
InitializePresetNames();
|
||||
int presetIndex = IdentifyCurrentPreset();
|
||||
|
||||
EditorGUILayout.Space();
|
||||
|
||||
// Preset fields start
|
||||
EditorGUILayout.LabelField("Preset:", EditorStyles.boldLabel);
|
||||
|
||||
// Preset selection popup
|
||||
int oldIndex = presetIndex;
|
||||
int newIndex = EditorGUILayout.Popup(oldIndex, presetNames);
|
||||
if (oldIndex != newIndex)
|
||||
{
|
||||
hr.LoadPreset(presetNames[newIndex].text);
|
||||
presetIndex = newIndex;
|
||||
}
|
||||
|
||||
HighlightingPreset currentPreset = new HighlightingPreset();
|
||||
if (presetIndex >= 0)
|
||||
{
|
||||
hr.GetPreset(presetNames[presetIndex].text, out currentPreset);
|
||||
}
|
||||
|
||||
EditorGUI.BeginChangeCheck();
|
||||
|
||||
// Fill Alpha
|
||||
SetBoldDefaultFont(presetIndex < 0 || hr.fillAlpha != currentPreset.fillAlpha);
|
||||
hr.fillAlpha = EditorGUILayout.Slider(HighlightingPresetEditor.labelFillAlpha, hr.fillAlpha, 0f, 1f);
|
||||
|
||||
// Downsample factor
|
||||
SetBoldDefaultFont(presetIndex < 0 || hr.downsampleFactor != currentPreset.downsampleFactor);
|
||||
hr.downsampleFactor = HighlightingPresetEditor.downsampleSet[EditorGUILayout.Popup(HighlightingPresetEditor.labelDownsampling, HighlightingPresetEditor.downsampleGet[hr.downsampleFactor], HighlightingPresetEditor.downsampleOptions)];
|
||||
|
||||
// Iterations
|
||||
SetBoldDefaultFont(presetIndex < 0 || hr.iterations != currentPreset.iterations);
|
||||
hr.iterations = Mathf.Clamp(EditorGUILayout.IntField(HighlightingPresetEditor.labelIterations, hr.iterations), 0, 50);
|
||||
|
||||
// Blur min spread
|
||||
SetBoldDefaultFont(presetIndex < 0 || hr.blurMinSpread != currentPreset.blurMinSpread);
|
||||
hr.blurMinSpread = EditorGUILayout.Slider(HighlightingPresetEditor.labelBlurMinSpread, hr.blurMinSpread, 0f, 3f);
|
||||
|
||||
// Blur spread
|
||||
SetBoldDefaultFont(presetIndex < 0 || hr.blurSpread != currentPreset.blurSpread);
|
||||
hr.blurSpread = EditorGUILayout.Slider(HighlightingPresetEditor.labelBlurSpread, hr.blurSpread, 0f, 3f);
|
||||
|
||||
// Blur intensity
|
||||
SetBoldDefaultFont(presetIndex < 0 || hr.blurIntensity != currentPreset.blurIntensity);
|
||||
hr.blurIntensity = EditorGUILayout.Slider(HighlightingPresetEditor.labelBlurIntensity, hr.blurIntensity, 0f, 1f);
|
||||
|
||||
// Blur straight directions
|
||||
SetBoldDefaultFont(presetIndex < 0 || hr.blurDirections != currentPreset.blurDirections);
|
||||
hr.blurDirections = (BlurDirections)EditorGUILayout.Popup(HighlightingPresetEditor.labelBlurDirections, (int)hr.blurDirections, HighlightingPresetEditor.blurDirections);
|
||||
|
||||
SetBoldDefaultFont(false);
|
||||
|
||||
if (EditorGUI.EndChangeCheck())
|
||||
{
|
||||
EditorUtility.SetDirty(hr);
|
||||
}
|
||||
|
||||
// Define button rects
|
||||
Rect position = GUILayoutUtility.GetRect(0f, 16f, GUILayout.ExpandWidth(true));
|
||||
HighlightingRendererEditor.GetColumnRects(position, 2f, buttonRects);
|
||||
|
||||
// Save preset button
|
||||
|
||||
using (new EditorGUI.DisabledScope(Application.isPlaying ||
|
||||
(hr.downsampleFactor == currentPreset.downsampleFactor &&
|
||||
hr.iterations == currentPreset.iterations &&
|
||||
hr.blurMinSpread == currentPreset.blurMinSpread &&
|
||||
hr.blurSpread == currentPreset.blurSpread &&
|
||||
hr.blurIntensity == currentPreset.blurIntensity &&
|
||||
hr.blurDirections == currentPreset.blurDirections)))
|
||||
{
|
||||
if (GUI.Button(buttonRects[0], "Save Preset"))
|
||||
{
|
||||
window = SavePresetWindow.Init(presetIndex < 0 ? "My Preset" : presetNames[presetIndex].text, SavePresetAs);
|
||||
}
|
||||
}
|
||||
|
||||
// Remove preset button
|
||||
using (new EditorGUI.DisabledScope(Application.isPlaying || presetIndex < 0))
|
||||
{
|
||||
if (GUI.Button(buttonRects[1], labelButtonRemove) && presetIndex >= 0)
|
||||
{
|
||||
string presetName = presetNames[presetIndex].text;
|
||||
if (EditorUtility.DisplayDialog("Removing Preset", "Are you sure you want to remove Preset '" + presetName + "'?", "Yes", "No"))
|
||||
{
|
||||
hr.RemovePreset(presetName);
|
||||
EditorUtility.SetDirty(hr);
|
||||
ReadOnlyCollection<HighlightingPreset> presets = hr.presets;
|
||||
if (presets.Count > 0)
|
||||
{
|
||||
presetIndex = 0;
|
||||
hr.ApplyPreset(presets[presetIndex]);
|
||||
}
|
||||
InitializePresetNames();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
EditorGUILayout.Space();
|
||||
}
|
||||
#endregion
|
||||
|
||||
#region Protected Methods
|
||||
//
|
||||
protected virtual void InitializePresetNames()
|
||||
{
|
||||
ReadOnlyCollection<HighlightingPreset> presets = hr.presets;
|
||||
int presetCount = presets.Count;
|
||||
if (presetNames == null || presetNames.Length != presetCount)
|
||||
{
|
||||
presetNames = new GUIContent[presetCount];
|
||||
}
|
||||
|
||||
for (int i = 0; i < presetCount; i++)
|
||||
{
|
||||
HighlightingPreset preset = presets[i];
|
||||
GUIContent presetName = presetNames[i];
|
||||
if (presetName == null)
|
||||
{
|
||||
presetName = new GUIContent();
|
||||
presetNames[i] = presetName;
|
||||
}
|
||||
presetName.text = preset.name;
|
||||
}
|
||||
}
|
||||
|
||||
// Returns current preset index
|
||||
protected virtual int IdentifyCurrentPreset()
|
||||
{
|
||||
ReadOnlyCollection<HighlightingPreset> presets = hr.presets;
|
||||
for (int i = presets.Count - 1; i >= 0; i--)
|
||||
{
|
||||
HighlightingPreset p = presets[i];
|
||||
if (hr.downsampleFactor == p.downsampleFactor &&
|
||||
hr.iterations == p.iterations &&
|
||||
hr.blurMinSpread == p.blurMinSpread &&
|
||||
hr.blurSpread == p.blurSpread &&
|
||||
hr.blurIntensity == p.blurIntensity &&
|
||||
hr.blurDirections == p.blurDirections)
|
||||
{
|
||||
return i;
|
||||
}
|
||||
}
|
||||
return -1;
|
||||
}
|
||||
|
||||
//
|
||||
protected virtual bool SavePresetAs(string name)
|
||||
{
|
||||
name = name.Trim();
|
||||
|
||||
window = null;
|
||||
|
||||
if (string.IsNullOrEmpty(name))
|
||||
{
|
||||
EditorUtility.DisplayDialog("Unable to save Preset", "Please specify valid Preset name.", "Close");
|
||||
return false;
|
||||
}
|
||||
|
||||
// Preset with this name exists?
|
||||
HighlightingPreset preset;
|
||||
if (hr.GetPreset(name, out preset))
|
||||
{
|
||||
// Overwrite?
|
||||
if (!EditorUtility.DisplayDialog("Overwriting Preset", "Preset '" + name + "' already exists. Overwrite?", "Yes", "No"))
|
||||
{
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
// Add or overwrite preset
|
||||
preset.name = name;
|
||||
preset.downsampleFactor = hr.downsampleFactor;
|
||||
preset.iterations = hr.iterations;
|
||||
preset.blurMinSpread = hr.blurMinSpread;
|
||||
preset.blurSpread = hr.blurSpread;
|
||||
preset.blurIntensity = hr.blurIntensity;
|
||||
preset.blurDirections = hr.blurDirections;
|
||||
|
||||
hr.AddPreset(preset, true);
|
||||
EditorUtility.SetDirty(hr);
|
||||
InitializePresetNames();
|
||||
IdentifyCurrentPreset();
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
//
|
||||
protected void SetBoldDefaultFont(bool value)
|
||||
{
|
||||
if (boldFontMethodInfo == null)
|
||||
{
|
||||
boldFontMethodInfo = typeof(EditorGUIUtility).GetMethod("SetBoldDefaultFont", BindingFlags.Static | BindingFlags.NonPublic);
|
||||
}
|
||||
boldFontMethodInfo.Invoke(null, new[] { value as object });
|
||||
}
|
||||
#endregion
|
||||
|
||||
#region Helpers
|
||||
//
|
||||
static public void GetRowRects(Rect rect, float space, Rect[] rects)
|
||||
{
|
||||
int l = rects.Length;
|
||||
for (int i = 0; i < l; i++)
|
||||
{
|
||||
float h = (rect.height - space * (l - 1)) / l;
|
||||
if (h < 0f) { h = 0f; }
|
||||
|
||||
Rect r = rects[i];
|
||||
|
||||
r.x = rect.x;
|
||||
r.y = rect.y + i * (h + space);
|
||||
r.width = rect.width;
|
||||
r.height = h;
|
||||
|
||||
rects[i] = r;
|
||||
}
|
||||
}
|
||||
|
||||
//
|
||||
static public void GetColumnRects(Rect rect, float space, Rect[] rects)
|
||||
{
|
||||
int l = rects.Length;
|
||||
for (int i = 0; i < l; i++)
|
||||
{
|
||||
float w = (rect.width - space * (l - 1)) / l;
|
||||
if (w < 0f) { w = 0f; }
|
||||
|
||||
Rect r = rects[i];
|
||||
|
||||
r.x = rect.x + i * (w + space);
|
||||
r.y = rect.y;
|
||||
r.width = w;
|
||||
r.height = rect.height;
|
||||
|
||||
rects[i] = r;
|
||||
}
|
||||
}
|
||||
#endregion
|
||||
|
||||
#region Documentation
|
||||
[MenuItem("Tools/Highlighting System/Documentation", priority = 0)]
|
||||
static private void OnlineDocumentation()
|
||||
{
|
||||
Application.OpenURL("http://docs.deepdream.games/HighlightingSystem/5.0/");
|
||||
}
|
||||
#endregion
|
||||
}
|
||||
|
||||
#region SavePresetWindow
|
||||
public class SavePresetWindow : EditorWindow
|
||||
{
|
||||
static private readonly string presetTextFieldName = "PresetTextFieldName";
|
||||
public delegate bool InputResult(string input);
|
||||
private event InputResult callback;
|
||||
private string presetName;
|
||||
|
||||
//
|
||||
public static SavePresetWindow Init(string name, InputResult callback)
|
||||
{
|
||||
Rect rect = new Rect(Screen.width * 0.5f, Screen.height * 0.5f, 300f, 60f);
|
||||
SavePresetWindow window = GetWindowWithRect<SavePresetWindow>(rect, true, "Specify Preset Name", true);
|
||||
window.callback = callback;
|
||||
window.presetName = name;
|
||||
return window;
|
||||
}
|
||||
|
||||
//
|
||||
void OnGUI()
|
||||
{
|
||||
GUI.SetNextControlName(presetTextFieldName);
|
||||
presetName = EditorGUILayout.TextField("Preset Name", presetName);
|
||||
|
||||
EditorGUI.FocusTextInControl(presetTextFieldName);
|
||||
|
||||
bool pressed = GUILayout.Button("Save Preset", GUILayout.ExpandHeight(true));
|
||||
Event e = Event.current;
|
||||
bool submitted = e.type == EventType.KeyUp && GUI.GetNameOfFocusedControl() == presetTextFieldName && (e.keyCode == KeyCode.Return || e.keyCode == KeyCode.KeypadEnter);
|
||||
|
||||
if (pressed || submitted)
|
||||
{
|
||||
OnSavePreset();
|
||||
GUIUtility.ExitGUI();
|
||||
}
|
||||
}
|
||||
|
||||
//
|
||||
void OnLostFocus() { Quit(); }
|
||||
void OnSelectionChange() { Quit(); }
|
||||
void OnProjectChange() { Quit(); }
|
||||
|
||||
//
|
||||
private void OnSavePreset()
|
||||
{
|
||||
if (callback(presetName))
|
||||
{
|
||||
Close();
|
||||
}
|
||||
}
|
||||
|
||||
//
|
||||
private void Quit()
|
||||
{
|
||||
Close();
|
||||
}
|
||||
}
|
||||
#endregion
|
||||
}
|
|
@ -0,0 +1,8 @@
|
|||
fileFormatVersion: 2
|
||||
guid: 183043fd0398e0148aefaae999f3c9f3
|
||||
MonoImporter:
|
||||
serializedVersion: 2
|
||||
defaultReferences: []
|
||||
executionOrder: 0
|
||||
icon: {instanceID: 0}
|
||||
userData:
|
|
@ -0,0 +1,5 @@
|
|||
fileFormatVersion: 2
|
||||
guid: 2e2dd921d0779af4dad3fbd326388e14
|
||||
folderAsset: yes
|
||||
DefaultImporter:
|
||||
userData:
|
|
@ -0,0 +1,172 @@
|
|||
Shader "Hidden/Highlighted/Blur"
|
||||
{
|
||||
Properties
|
||||
{
|
||||
[HideInInspector] _MainTex ("", 2D) = "" {}
|
||||
[HideInInspector] _HighlightingIntensity ("", Range (0.25,0.5)) = 0.3
|
||||
}
|
||||
|
||||
SubShader
|
||||
{
|
||||
Pass
|
||||
{
|
||||
ZTest Always
|
||||
Cull Off
|
||||
ZWrite Off
|
||||
Lighting Off
|
||||
Fog { Mode Off }
|
||||
|
||||
CGPROGRAM
|
||||
#pragma vertex vert
|
||||
#pragma fragment frag
|
||||
#pragma fragmentoption ARB_precision_hint_fastest
|
||||
#pragma target 2.0
|
||||
#pragma multi_compile DIAGONAL_DIRECTIONS STRAIGHT_DIRECTIONS ALL_DIRECTIONS
|
||||
|
||||
#include "UnityCG.cginc"
|
||||
|
||||
uniform sampler2D _MainTex;
|
||||
uniform float4 _MainTex_ST;
|
||||
uniform float4 _MainTex_TexelSize;
|
||||
|
||||
uniform float _HighlightingBlurOffset;
|
||||
uniform half _HighlightingIntensity;
|
||||
|
||||
struct vs_input
|
||||
{
|
||||
float4 vertex : POSITION;
|
||||
float2 texcoord : TEXCOORD0;
|
||||
};
|
||||
|
||||
struct ps_input
|
||||
{
|
||||
float4 pos : SV_POSITION;
|
||||
|
||||
#if defined(ALL_DIRECTIONS)
|
||||
float4 uv0 : TEXCOORD0;
|
||||
float4 uv1 : TEXCOORD1;
|
||||
float4 uv2 : TEXCOORD2;
|
||||
float4 uv3 : TEXCOORD3;
|
||||
#else
|
||||
float4 uv0 : TEXCOORD0;
|
||||
float4 uv1 : TEXCOORD1;
|
||||
#endif
|
||||
};
|
||||
|
||||
ps_input vert(vs_input v)
|
||||
{
|
||||
ps_input o;
|
||||
o.pos = UnityObjectToClipPos(v.vertex);
|
||||
|
||||
float2 uv = UnityStereoScreenSpaceUVAdjust(v.texcoord, _MainTex_ST);
|
||||
float2 offs = _HighlightingBlurOffset * _MainTex_TexelSize.xy;
|
||||
|
||||
#if defined(ALL_DIRECTIONS)
|
||||
|
||||
// Diagonal
|
||||
o.uv0.x = uv.x - offs.x;
|
||||
o.uv0.y = uv.y - offs.y;
|
||||
|
||||
o.uv0.z = uv.x + offs.x;
|
||||
o.uv0.w = uv.y - offs.y;
|
||||
|
||||
o.uv1.x = uv.x + offs.x;
|
||||
o.uv1.y = uv.y + offs.y;
|
||||
|
||||
o.uv1.z = uv.x - offs.x;
|
||||
o.uv1.w = uv.y + offs.y;
|
||||
|
||||
// Straight
|
||||
o.uv2.x = uv.x - offs.x;
|
||||
o.uv2.y = uv.y;
|
||||
|
||||
o.uv2.z = uv.x + offs.x;
|
||||
o.uv2.w = uv.y;
|
||||
|
||||
o.uv3.x = uv.x;
|
||||
o.uv3.y = uv.y - offs.y;
|
||||
|
||||
o.uv3.z = uv.x;
|
||||
o.uv3.w = uv.y + offs.y;
|
||||
|
||||
#elif defined(STRAIGHT_DIRECTIONS)
|
||||
|
||||
// Straight
|
||||
o.uv0.x = uv.x - offs.x;
|
||||
o.uv0.y = uv.y;
|
||||
|
||||
o.uv0.z = uv.x + offs.x;
|
||||
o.uv0.w = uv.y;
|
||||
|
||||
o.uv1.x = uv.x;
|
||||
o.uv1.y = uv.y - offs.y;
|
||||
|
||||
o.uv1.z = uv.x;
|
||||
o.uv1.w = uv.y + offs.y;
|
||||
|
||||
#else
|
||||
|
||||
// Diagonal
|
||||
o.uv0.x = uv.x - offs.x;
|
||||
o.uv0.y = uv.y - offs.y;
|
||||
|
||||
o.uv0.z = uv.x + offs.x;
|
||||
o.uv0.w = uv.y - offs.y;
|
||||
|
||||
o.uv1.x = uv.x + offs.x;
|
||||
o.uv1.y = uv.y + offs.y;
|
||||
|
||||
o.uv1.z = uv.x - offs.x;
|
||||
o.uv1.w = uv.y + offs.y;
|
||||
|
||||
#endif
|
||||
|
||||
return o;
|
||||
}
|
||||
|
||||
half4 frag(ps_input i) : SV_Target
|
||||
{
|
||||
half4 color1 = tex2D(_MainTex, i.uv0.xy);
|
||||
fixed4 color2;
|
||||
|
||||
// For straight or diagonal directions
|
||||
color2 = tex2D(_MainTex, i.uv0.zw);
|
||||
color1.rgb = max(color1.rgb, color2.rgb);
|
||||
color1.a += color2.a;
|
||||
|
||||
color2 = tex2D(_MainTex, i.uv1.xy);
|
||||
color1.rgb = max(color1.rgb, color2.rgb);
|
||||
color1.a += color2.a;
|
||||
|
||||
color2 = tex2D(_MainTex, i.uv1.zw);
|
||||
color1.rgb = max(color1.rgb, color2.rgb);
|
||||
color1.a += color2.a;
|
||||
|
||||
// For all directions
|
||||
#if defined(ALL_DIRECTIONS)
|
||||
color2 = tex2D(_MainTex, i.uv2.xy);
|
||||
color1.rgb = max(color1.rgb, color2.rgb);
|
||||
color1.a += color2.a;
|
||||
|
||||
color2 = tex2D(_MainTex, i.uv2.zw);
|
||||
color1.rgb = max(color1.rgb, color2.rgb);
|
||||
color1.a += color2.a;
|
||||
|
||||
color2 = tex2D(_MainTex, i.uv3.xy);
|
||||
color1.rgb = max(color1.rgb, color2.rgb);
|
||||
color1.a += color2.a;
|
||||
|
||||
color2 = tex2D(_MainTex, i.uv3.zw);
|
||||
color1.rgb = max(color1.rgb, color2.rgb);
|
||||
color1.a += color2.a;
|
||||
#endif
|
||||
|
||||
color1.a *= _HighlightingIntensity;
|
||||
return color1;
|
||||
}
|
||||
ENDCG
|
||||
}
|
||||
}
|
||||
|
||||
Fallback off
|
||||
}
|
|
@ -0,0 +1,5 @@
|
|||
fileFormatVersion: 2
|
||||
guid: 3070218404d1de94c9d081d248597046
|
||||
ShaderImporter:
|
||||
defaultTextures: []
|
||||
userData:
|
|
@ -0,0 +1,72 @@
|
|||
Shader "Hidden/Highlighted/Composite"
|
||||
{
|
||||
Properties
|
||||
{
|
||||
[HideInInspector] _MainTex ("", 2D) = "" {}
|
||||
[HideInInspector] _HighlightingBuffer ("", 2D) = "" {}
|
||||
}
|
||||
|
||||
SubShader
|
||||
{
|
||||
Pass
|
||||
{
|
||||
Lighting Off
|
||||
Fog { Mode off }
|
||||
ZWrite Off
|
||||
ZTest Always
|
||||
Cull Off
|
||||
|
||||
CGPROGRAM
|
||||
#pragma vertex vert
|
||||
#pragma fragment frag
|
||||
#pragma fragmentoption ARB_precision_hint_fastest
|
||||
#pragma target 2.0
|
||||
#include "UnityCG.cginc"
|
||||
|
||||
struct vs_input
|
||||
{
|
||||
float4 vertex : POSITION;
|
||||
float2 texcoord : TEXCOORD0;
|
||||
};
|
||||
|
||||
struct ps_input
|
||||
{
|
||||
float4 pos : SV_POSITION;
|
||||
half2 uv0 : TEXCOORD0;
|
||||
half2 uv1 : TEXCOORD1;
|
||||
};
|
||||
|
||||
uniform sampler2D _MainTex;
|
||||
uniform float4 _MainTex_ST;
|
||||
uniform float4 _MainTex_TexelSize;
|
||||
uniform sampler2D _HighlightingBuffer;
|
||||
|
||||
ps_input vert(vs_input v)
|
||||
{
|
||||
ps_input o;
|
||||
o.pos = UnityObjectToClipPos(v.vertex);
|
||||
o.uv0 = UnityStereoScreenSpaceUVAdjust(v.texcoord, _MainTex_ST);
|
||||
o.uv1 = o.uv0;
|
||||
|
||||
#if UNITY_UV_STARTS_AT_TOP
|
||||
if (_MainTex_TexelSize.y < 0)
|
||||
{
|
||||
o.uv1.y = 1-o.uv1.y;
|
||||
}
|
||||
#endif
|
||||
|
||||
return o;
|
||||
}
|
||||
|
||||
fixed4 frag(ps_input i) : SV_Target
|
||||
{
|
||||
fixed4 c1 = tex2D(_MainTex, i.uv0);
|
||||
fixed4 c2 = tex2D(_HighlightingBuffer, i.uv1);
|
||||
c1.rgb = lerp(c1.rgb, c2.rgb, c2.a);
|
||||
return c1;
|
||||
}
|
||||
ENDCG
|
||||
}
|
||||
}
|
||||
FallBack Off
|
||||
}
|
|
@ -0,0 +1,5 @@
|
|||
fileFormatVersion: 2
|
||||
guid: b0bd9de6a4f20954f9704e56568224a6
|
||||
ShaderImporter:
|
||||
defaultTextures: []
|
||||
userData:
|
|
@ -0,0 +1,111 @@
|
|||
Shader "Hidden/Highlighted/Cut"
|
||||
{
|
||||
Properties
|
||||
{
|
||||
[HideInInspector] _MainTex ("", 2D) = "" {}
|
||||
[HideInInspector] _HighlightingFillAlpha ("", Range(0.0, 1.0)) = 1.0
|
||||
}
|
||||
|
||||
SubShader
|
||||
{
|
||||
Lighting Off
|
||||
Fog { Mode off }
|
||||
ZWrite Off
|
||||
ZTest Always
|
||||
Cull Back
|
||||
|
||||
Pass
|
||||
{
|
||||
Stencil
|
||||
{
|
||||
Ref 1
|
||||
Comp NotEqual
|
||||
Pass Keep
|
||||
ZFail Keep
|
||||
}
|
||||
|
||||
CGPROGRAM
|
||||
#pragma vertex vert
|
||||
#pragma fragment frag
|
||||
#pragma fragmentoption ARB_precision_hint_fastest
|
||||
#pragma target 2.0
|
||||
|
||||
#include "UnityCG.cginc"
|
||||
|
||||
struct vs_input
|
||||
{
|
||||
float4 vertex : POSITION;
|
||||
half2 texcoord : TEXCOORD0;
|
||||
};
|
||||
|
||||
struct ps_input
|
||||
{
|
||||
float4 pos : SV_POSITION;
|
||||
half2 uv : TEXCOORD0;
|
||||
};
|
||||
|
||||
uniform sampler2D _MainTex;
|
||||
uniform float4 _MainTex_ST;
|
||||
|
||||
ps_input vert(vs_input v)
|
||||
{
|
||||
ps_input o;
|
||||
o.pos = UnityObjectToClipPos(v.vertex);
|
||||
o.uv = UnityStereoScreenSpaceUVAdjust(v.texcoord, _MainTex_ST);
|
||||
return o;
|
||||
}
|
||||
|
||||
fixed4 frag(ps_input i) : SV_Target
|
||||
{
|
||||
return tex2D(_MainTex, i.uv);
|
||||
}
|
||||
ENDCG
|
||||
}
|
||||
|
||||
Pass
|
||||
{
|
||||
Stencil
|
||||
{
|
||||
Ref 1
|
||||
Comp Equal
|
||||
Pass Keep
|
||||
ZFail Keep
|
||||
}
|
||||
ColorMask A
|
||||
|
||||
CGPROGRAM
|
||||
#pragma vertex vert
|
||||
#pragma fragment frag
|
||||
#pragma fragmentoption ARB_precision_hint_fastest
|
||||
#pragma target 2.0
|
||||
|
||||
#include "UnityCG.cginc"
|
||||
|
||||
struct vs_input
|
||||
{
|
||||
float4 vertex : POSITION;
|
||||
};
|
||||
|
||||
struct ps_input
|
||||
{
|
||||
float4 pos : SV_POSITION;
|
||||
};
|
||||
|
||||
uniform float _HighlightingFillAlpha;
|
||||
|
||||
ps_input vert(vs_input v)
|
||||
{
|
||||
ps_input o;
|
||||
o.pos = UnityObjectToClipPos(v.vertex);
|
||||
return o;
|
||||
}
|
||||
|
||||
fixed4 frag() : SV_Target
|
||||
{
|
||||
return fixed4(0, 0, 0, _HighlightingFillAlpha);
|
||||
}
|
||||
ENDCG
|
||||
}
|
||||
}
|
||||
FallBack Off
|
||||
}
|
|
@ -0,0 +1,5 @@
|
|||
fileFormatVersion: 2
|
||||
guid: 376af14ed82e64793b326012b8591fa9
|
||||
ShaderImporter:
|
||||
defaultTextures: []
|
||||
userData:
|
|
@ -0,0 +1,88 @@
|
|||
Shader "Hidden/Highlighted/Opaque"
|
||||
{
|
||||
Properties
|
||||
{
|
||||
[HideInInspector] _HighlightingColor ("", Color) = (1, 1, 1, 1)
|
||||
}
|
||||
|
||||
SubShader
|
||||
{
|
||||
Lighting Off
|
||||
Fog { Mode Off }
|
||||
ZWrite Off // Manual depth test
|
||||
ZTest Always // Manual depth test
|
||||
|
||||
Pass
|
||||
{
|
||||
Stencil
|
||||
{
|
||||
Ref 1
|
||||
Comp Always
|
||||
Pass Replace
|
||||
ZFail Keep
|
||||
}
|
||||
|
||||
CGPROGRAM
|
||||
#pragma vertex vert
|
||||
#pragma fragment frag
|
||||
#pragma fragmentoption ARB_precision_hint_fastest
|
||||
#pragma target 2.0
|
||||
#pragma multi_compile __ HIGHLIGHTING_OVERLAY
|
||||
#include "UnityCG.cginc"
|
||||
|
||||
uniform fixed4 _HighlightingColor;
|
||||
|
||||
#ifndef HIGHLIGHTING_OVERLAY
|
||||
UNITY_DECLARE_DEPTH_TEXTURE(_CameraDepthTexture);
|
||||
#endif
|
||||
|
||||
struct vs_input
|
||||
{
|
||||
float4 vertex : POSITION;
|
||||
UNITY_VERTEX_INPUT_INSTANCE_ID
|
||||
};
|
||||
|
||||
struct ps_input
|
||||
{
|
||||
float4 pos : SV_POSITION;
|
||||
|
||||
#ifndef HIGHLIGHTING_OVERLAY
|
||||
float4 screen : TEXCOORD0;
|
||||
#endif
|
||||
};
|
||||
|
||||
ps_input vert(vs_input v)
|
||||
{
|
||||
ps_input o;
|
||||
|
||||
UNITY_SETUP_INSTANCE_ID(v);
|
||||
o.pos = UnityObjectToClipPos(v.vertex);
|
||||
|
||||
#ifndef HIGHLIGHTING_OVERLAY
|
||||
o.screen = ComputeScreenPos(o.pos);
|
||||
COMPUTE_EYEDEPTH(o.screen.z);
|
||||
#endif
|
||||
|
||||
return o;
|
||||
}
|
||||
|
||||
fixed4 frag(ps_input i) : SV_Target
|
||||
{
|
||||
#ifndef HIGHLIGHTING_OVERLAY
|
||||
float z = SAMPLE_DEPTH_TEXTURE_PROJ(_CameraDepthTexture, UNITY_PROJ_COORD(i.screen));
|
||||
float perspZ = LinearEyeDepth(z); // LinearEyeDepth automatically handles UNITY_REVERSED_Z case
|
||||
#if defined(UNITY_REVERSED_Z)
|
||||
z = 1 - z;
|
||||
#endif
|
||||
float orthoZ = _ProjectionParams.y + z * (_ProjectionParams.z - _ProjectionParams.y); // near + z * (far - near)
|
||||
float sceneZ = lerp(perspZ, orthoZ, unity_OrthoParams.w);
|
||||
clip(sceneZ - i.screen.z + 0.01);
|
||||
#endif
|
||||
|
||||
return _HighlightingColor;
|
||||
}
|
||||
ENDCG
|
||||
}
|
||||
}
|
||||
Fallback Off
|
||||
}
|
|
@ -0,0 +1,5 @@
|
|||
fileFormatVersion: 2
|
||||
guid: ce3b12ca636563c48afb814d9aeb5b90
|
||||
ShaderImporter:
|
||||
defaultTextures: []
|
||||
userData:
|
|
@ -0,0 +1,108 @@
|
|||
Shader "Hidden/Highlighted/Transparent"
|
||||
{
|
||||
Properties
|
||||
{
|
||||
[HideInInspector] _MainTex ("", 2D) = "" {}
|
||||
[HideInInspector] _HighlightingColor ("", Color) = (1, 1, 1, 1)
|
||||
[HideInInspector] _Cutoff ("", Float) = 0.5
|
||||
[HideInInspector] _HighlightingCull ("", Int) = 2 // UnityEngine.Rendering.CullMode.Back
|
||||
}
|
||||
|
||||
SubShader
|
||||
{
|
||||
Lighting Off
|
||||
Fog { Mode Off }
|
||||
ZWrite Off // Manual depth test
|
||||
ZTest Always // Manual depth test
|
||||
Cull [_HighlightingCull] // For rendering both sides of the Sprite
|
||||
|
||||
Pass
|
||||
{
|
||||
Stencil
|
||||
{
|
||||
Ref 1
|
||||
Comp Always
|
||||
Pass Replace
|
||||
ZFail Keep
|
||||
}
|
||||
|
||||
CGPROGRAM
|
||||
#pragma vertex vert
|
||||
#pragma fragment frag
|
||||
#pragma fragmentoption ARB_precision_hint_fastest
|
||||
#pragma target 2.0
|
||||
#pragma multi_compile __ HIGHLIGHTING_OVERLAY
|
||||
#include "UnityCG.cginc"
|
||||
|
||||
uniform fixed4 _HighlightingColor;
|
||||
uniform sampler2D _MainTex;
|
||||
uniform float4 _MainTex_ST;
|
||||
uniform fixed _Cutoff;
|
||||
|
||||
#ifndef HIGHLIGHTING_OVERLAY
|
||||
UNITY_DECLARE_DEPTH_TEXTURE(_CameraDepthTexture);
|
||||
#endif
|
||||
|
||||
struct vs_input
|
||||
{
|
||||
float4 vertex : POSITION;
|
||||
float2 texcoord : TEXCOORD0;
|
||||
fixed4 color : COLOR;
|
||||
UNITY_VERTEX_INPUT_INSTANCE_ID
|
||||
};
|
||||
|
||||
struct ps_input
|
||||
{
|
||||
float4 pos : SV_POSITION;
|
||||
float2 texcoord : TEXCOORD0;
|
||||
fixed alpha : TEXCOORD1;
|
||||
|
||||
#ifndef HIGHLIGHTING_OVERLAY
|
||||
float4 screen : TEXCOORD2;
|
||||
#endif
|
||||
};
|
||||
|
||||
ps_input vert(vs_input v)
|
||||
{
|
||||
ps_input o;
|
||||
|
||||
UNITY_SETUP_INSTANCE_ID(v);
|
||||
o.pos = UnityObjectToClipPos(v.vertex);
|
||||
|
||||
#ifndef HIGHLIGHTING_OVERLAY
|
||||
o.screen = ComputeScreenPos(o.pos);
|
||||
COMPUTE_EYEDEPTH(o.screen.z);
|
||||
#endif
|
||||
|
||||
o.texcoord = TRANSFORM_TEX(v.texcoord, _MainTex);
|
||||
o.alpha = v.color.a;
|
||||
return o;
|
||||
}
|
||||
|
||||
fixed4 frag(ps_input i) : SV_Target
|
||||
{
|
||||
fixed a = tex2D(_MainTex, i.texcoord).a;
|
||||
clip(a - _Cutoff);
|
||||
|
||||
#ifndef HIGHLIGHTING_OVERLAY
|
||||
float z = SAMPLE_DEPTH_TEXTURE_PROJ(_CameraDepthTexture, UNITY_PROJ_COORD(i.screen));
|
||||
float perspZ = LinearEyeDepth(z); // LinearEyeDepth automatically handles UNITY_REVERSED_Z case
|
||||
#if defined(UNITY_REVERSED_Z)
|
||||
z = 1 - z;
|
||||
#endif
|
||||
float orthoZ = _ProjectionParams.y + z * (_ProjectionParams.z - _ProjectionParams.y); // near + z * (far - near)
|
||||
float sceneZ = lerp(perspZ, orthoZ, unity_OrthoParams.w);
|
||||
clip(sceneZ - i.screen.z + 0.01);
|
||||
#endif
|
||||
|
||||
fixed4 c = _HighlightingColor;
|
||||
c.a *= i.alpha;
|
||||
|
||||
return c;
|
||||
}
|
||||
ENDCG
|
||||
}
|
||||
}
|
||||
|
||||
Fallback Off
|
||||
}
|
|
@ -0,0 +1,5 @@
|
|||
fileFormatVersion: 2
|
||||
guid: 9fc04a058c8768648a6532aa07540ca5
|
||||
ShaderImporter:
|
||||
defaultTextures: []
|
||||
userData:
|
|
@ -0,0 +1,5 @@
|
|||
fileFormatVersion: 2
|
||||
guid: 4b92650ecd71b67409ab3aafea97bd7d
|
||||
folderAsset: yes
|
||||
DefaultImporter:
|
||||
userData:
|
|
@ -0,0 +1,899 @@
|
|||
using System;
|
||||
using System.Collections;
|
||||
using System.Collections.Generic;
|
||||
using UnityEngine;
|
||||
|
||||
namespace HighlightingSystem
|
||||
{
|
||||
public enum LoopMode
|
||||
{
|
||||
Once,
|
||||
Loop,
|
||||
PingPong,
|
||||
ClampForever,
|
||||
}
|
||||
|
||||
public enum Easing
|
||||
{
|
||||
Linear,
|
||||
|
||||
QuadIn,
|
||||
QuadOut,
|
||||
QuadInOut,
|
||||
|
||||
CubicIn,
|
||||
CubicOut,
|
||||
CubicInOut,
|
||||
|
||||
SineIn,
|
||||
SineOut,
|
||||
SineInOut,
|
||||
}
|
||||
|
||||
public enum RendererFilterMode
|
||||
{
|
||||
None,
|
||||
Include,
|
||||
Exclude,
|
||||
}
|
||||
|
||||
[AddComponentMenu("Highlighting System/Highlighter", 0)]
|
||||
public class Highlighter : HighlighterCore
|
||||
{
|
||||
#region Constants
|
||||
protected const float HALFPI = Mathf.PI * 0.5f;
|
||||
#endregion
|
||||
|
||||
#region Inspector Fields
|
||||
/* General */
|
||||
|
||||
/// <summary>
|
||||
/// When set to true - highlighting will be rendered on top of all other geometry.
|
||||
/// </summary>
|
||||
public bool overlay
|
||||
{
|
||||
get { return _overlay; }
|
||||
set { _overlay = value; }
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Controls occluder mode.
|
||||
/// </summary>
|
||||
public bool occluder
|
||||
{
|
||||
get { return _occluder; }
|
||||
set { _occluder = value; }
|
||||
}
|
||||
|
||||
/* Tween */
|
||||
|
||||
public bool tween
|
||||
{
|
||||
get { return _tween; }
|
||||
set { TweenSet(value); }
|
||||
}
|
||||
|
||||
public Gradient tweenGradient
|
||||
{
|
||||
get { return _tweenGradient; }
|
||||
set { _tweenGradient = value; }
|
||||
}
|
||||
|
||||
public float tweenDuration
|
||||
{
|
||||
get { return _tweenDuration; }
|
||||
set { _tweenDuration = value; ValidateRanges(); }
|
||||
}
|
||||
|
||||
public float tweenDelay
|
||||
{
|
||||
get { return _tweenDelay; }
|
||||
set { _tweenDelay = value; }
|
||||
}
|
||||
|
||||
public bool tweenUseUnscaledTime
|
||||
{
|
||||
get { return _tweenUseUnscaledTime; }
|
||||
set
|
||||
{
|
||||
if (_tweenUseUnscaledTime != value)
|
||||
{
|
||||
float delta = GetTweenTime() - _tweenStart;
|
||||
_tweenUseUnscaledTime = value;
|
||||
_tweenStart = GetTweenTime() - delta;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public LoopMode tweenLoop
|
||||
{
|
||||
get { return _tweenLoop; }
|
||||
set { _tweenLoop = value; }
|
||||
}
|
||||
|
||||
public Easing tweenEasing
|
||||
{
|
||||
get { return _tweenEasing; }
|
||||
set { _tweenEasing = value; }
|
||||
}
|
||||
|
||||
public bool tweenReverse
|
||||
{
|
||||
get { return _tweenReverse; }
|
||||
set { _tweenReverse = value; }
|
||||
}
|
||||
|
||||
public int tweenRepeatCount
|
||||
{
|
||||
get { return _tweenRepeatCount; }
|
||||
set { _tweenRepeatCount = value; }
|
||||
}
|
||||
|
||||
/* Constant */
|
||||
|
||||
public bool constant
|
||||
{
|
||||
get { return _constant; }
|
||||
set { ConstantSet(value); }
|
||||
}
|
||||
|
||||
public Color constantColor
|
||||
{
|
||||
get { return _constantColor; }
|
||||
set { _constantColor = value; }
|
||||
}
|
||||
|
||||
public float constantFadeTime
|
||||
{
|
||||
set
|
||||
{
|
||||
_constantFadeInTime = value;
|
||||
_constantFadeOutTime = value;
|
||||
ValidateRanges();
|
||||
ConstantSet();
|
||||
}
|
||||
}
|
||||
|
||||
public float constantFadeInTime
|
||||
{
|
||||
get { return _constantFadeInTime; }
|
||||
set
|
||||
{
|
||||
_constantFadeInTime = value;
|
||||
ValidateRanges();
|
||||
if (_constant) { ConstantSet(); }
|
||||
}
|
||||
}
|
||||
|
||||
public float constantFadeOutTime
|
||||
{
|
||||
get { return _constantFadeOutTime; }
|
||||
set
|
||||
{
|
||||
_constantFadeOutTime = value;
|
||||
ValidateRanges();
|
||||
if (!_constant) { ConstantSet(); }
|
||||
}
|
||||
}
|
||||
|
||||
public bool constantUseUnscaledTime
|
||||
{
|
||||
get { return _constantUseUnscaledTime; }
|
||||
set
|
||||
{
|
||||
if (_constantUseUnscaledTime != value)
|
||||
{
|
||||
float delta = GetConstantTime() - _constantStart;
|
||||
_constantUseUnscaledTime = value;
|
||||
_constantStart = GetConstantTime() - delta;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public Easing constantEasing
|
||||
{
|
||||
get { return _constantEasing; }
|
||||
set { _constantEasing = value; }
|
||||
}
|
||||
|
||||
public RendererFilterMode filterMode
|
||||
{
|
||||
get { return _filterMode; }
|
||||
set
|
||||
{
|
||||
if (_filterMode != value)
|
||||
{
|
||||
_filterMode = value;
|
||||
// Update highlighted Renderers
|
||||
SetDirty();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Make sure to trigger SetDirty() after modifying this list
|
||||
/// </summary>
|
||||
public List<Transform> filterList
|
||||
{
|
||||
get { return _filterList; }
|
||||
}
|
||||
|
||||
protected override RendererFilter rendererFilterToUse
|
||||
{
|
||||
get
|
||||
{
|
||||
if (rendererFilter != null)
|
||||
{
|
||||
return rendererFilter;
|
||||
}
|
||||
else if (_filterMode == RendererFilterMode.None)
|
||||
{
|
||||
return globalRendererFilter != null ? globalRendererFilter : DefaultRendererFilter;
|
||||
}
|
||||
else if (_filterMode == RendererFilterMode.Include)
|
||||
{
|
||||
return TransformFilterInclude;
|
||||
}
|
||||
else if (_filterMode == RendererFilterMode.Exclude)
|
||||
{
|
||||
return TransformFilterExclude;
|
||||
}
|
||||
|
||||
// Should never happen
|
||||
return DefaultRendererFilter;
|
||||
}
|
||||
}
|
||||
#endregion
|
||||
|
||||
#region Protected Fields
|
||||
// General
|
||||
[SerializeField] protected bool _overlay;
|
||||
[SerializeField] protected bool _occluder;
|
||||
|
||||
// Hover (do not serialize this!)
|
||||
protected Color _hoverColor = Color.red;
|
||||
protected int _hoverFrame = -1;
|
||||
|
||||
// Tween
|
||||
[SerializeField] protected bool _tween = false;
|
||||
[SerializeField] protected Gradient _tweenGradient = new Gradient()
|
||||
{
|
||||
colorKeys = new GradientColorKey[]
|
||||
{
|
||||
new GradientColorKey(new Color(0f, 1f, 1f, 1f), 0f),
|
||||
new GradientColorKey(new Color(0f, 1f, 1f, 1f), 1f),
|
||||
},
|
||||
alphaKeys = new GradientAlphaKey[]
|
||||
{
|
||||
new GradientAlphaKey(0f, 0f),
|
||||
new GradientAlphaKey(1f, 1f),
|
||||
}
|
||||
};
|
||||
[SerializeField] protected float _tweenDuration = 1f;
|
||||
[SerializeField] protected bool _tweenReverse = false;
|
||||
[SerializeField] protected LoopMode _tweenLoop = LoopMode.PingPong;
|
||||
[SerializeField] protected Easing _tweenEasing = Easing.Linear;
|
||||
[SerializeField] protected float _tweenDelay = 0f;
|
||||
[SerializeField] protected int _tweenRepeatCount = -1;
|
||||
[SerializeField] protected bool _tweenUseUnscaledTime = false;
|
||||
|
||||
// Constant highlighting mode (with optional fade in/out transition)
|
||||
[SerializeField] protected bool _constant = false;
|
||||
[SerializeField] protected Color _constantColor = Color.yellow;
|
||||
[SerializeField] protected float _constantFadeInTime = 0.1f;
|
||||
[SerializeField] protected float _constantFadeOutTime = 0.25f;
|
||||
[SerializeField] protected Easing _constantEasing = Easing.Linear;
|
||||
[SerializeField] protected bool _constantUseUnscaledTime = false;
|
||||
|
||||
[SerializeField] protected RendererFilterMode _filterMode = RendererFilterMode.None;
|
||||
[SerializeField] protected List<Transform> _filterList = new List<Transform>();
|
||||
|
||||
// Runtime only (do not serialize this!)
|
||||
protected bool _tweenEnabled;
|
||||
protected float _tweenStart; // Time when the tween has started
|
||||
protected bool _constantEnabled;
|
||||
protected float _constantStart;
|
||||
protected float _constantDuration;
|
||||
#endregion
|
||||
|
||||
#region Protected Accessors
|
||||
protected bool hover
|
||||
{
|
||||
get { return _hoverFrame == Time.frameCount; }
|
||||
set { _hoverFrame = value ? Time.frameCount : -1; }
|
||||
}
|
||||
|
||||
// constantValue is always increasing from 0 to 1 (for both fade in and out transitions)
|
||||
protected float constantValue
|
||||
{
|
||||
get { return _constantDuration > 0f ? Mathf.Clamp01((GetConstantTime() - _constantStart) / _constantDuration) : 1f; }
|
||||
}
|
||||
#endregion
|
||||
|
||||
#region MonoBehaviour
|
||||
//
|
||||
protected virtual void OnDidApplyAnimationProperties()
|
||||
{
|
||||
ValidateAll();
|
||||
}
|
||||
|
||||
#if UNITY_EDITOR
|
||||
//
|
||||
void OnValidate()
|
||||
{
|
||||
ValidateAll();
|
||||
}
|
||||
|
||||
//
|
||||
void Reset()
|
||||
{
|
||||
ValidateAll();
|
||||
}
|
||||
#endif
|
||||
#endregion
|
||||
|
||||
#region MonoBehaviour Overrides
|
||||
//
|
||||
protected override void OnEnableSafe()
|
||||
{
|
||||
ValidateAll();
|
||||
}
|
||||
|
||||
//
|
||||
protected override void OnDisableSafe()
|
||||
{
|
||||
// Make sure transition won't continue if component will be re-enabled
|
||||
_tweenEnabled = false;
|
||||
_constantEnabled = false;
|
||||
_constantStart = GetConstantTime() - _constantDuration;
|
||||
}
|
||||
#endregion
|
||||
|
||||
#region Validation
|
||||
//
|
||||
protected void ValidateAll()
|
||||
{
|
||||
ValidateRanges();
|
||||
TweenSet();
|
||||
ConstantSet();
|
||||
SetDirty();
|
||||
}
|
||||
|
||||
//
|
||||
protected void ValidateRanges()
|
||||
{
|
||||
if (_tweenDuration < 0f) { _tweenDuration = 0f; }
|
||||
if (_constantFadeInTime < 0f) { _constantFadeInTime = 0f; }
|
||||
if (_constantFadeOutTime < 0f) { _constantFadeInTime = 0f; }
|
||||
}
|
||||
#endregion
|
||||
|
||||
#region Public Methods
|
||||
/// <summary>
|
||||
/// Turn on one-frame highlighting with specified color.
|
||||
/// Can be called multiple times per update, color only from the latest call will be used.
|
||||
/// </summary>
|
||||
/// <param name='color'>
|
||||
/// Highlighting color.
|
||||
/// </param>
|
||||
public void Hover(Color color)
|
||||
{
|
||||
_hoverColor = color;
|
||||
hover = true;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Fade in constant highlighting using specified transition duration.
|
||||
/// </summary>
|
||||
/// <param name="time">
|
||||
/// Transition time.
|
||||
/// </param>
|
||||
public void ConstantOn(float fadeTime = 0.25f)
|
||||
{
|
||||
ConstantSet(fadeTime, true);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Fade in constant highlighting using specified color and transition duration.
|
||||
/// </summary>
|
||||
/// <param name="color">
|
||||
/// Constant highlighting color.
|
||||
/// </param>
|
||||
/// <param name="time">
|
||||
/// Transition duration.
|
||||
/// </param>
|
||||
public void ConstantOn(Color color, float fadeTime = 0.25f)
|
||||
{
|
||||
_constantColor = color;
|
||||
ConstantSet(fadeTime, true);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Fade out constant highlighting using specified transition duration.
|
||||
/// </summary>
|
||||
/// <param name="time">
|
||||
/// Transition time.
|
||||
/// </param>
|
||||
public void ConstantOff(float fadeTime = 0.25f)
|
||||
{
|
||||
ConstantSet(fadeTime, false);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Switch constant highlighting using specified transition duration.
|
||||
/// </summary>
|
||||
/// <param name="time">
|
||||
/// Transition time.
|
||||
/// </param>
|
||||
public void ConstantSwitch(float fadeTime = 0.25f)
|
||||
{
|
||||
ConstantSet(fadeTime, !_constant);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Turn on constant highlighting immediately (without fading in).
|
||||
/// </summary>
|
||||
public void ConstantOnImmediate()
|
||||
{
|
||||
ConstantSet(0f, true);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Turn on constant highlighting using specified color immediately (without fading in).
|
||||
/// </summary>
|
||||
/// <param name='color'>
|
||||
/// Constant highlighting color.
|
||||
/// </param>
|
||||
public void ConstantOnImmediate(Color color)
|
||||
{
|
||||
_constantColor = color;
|
||||
ConstantSet(0f, true);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Turn off constant highlighting immediately (without fading out).
|
||||
/// </summary>
|
||||
public void ConstantOffImmediate()
|
||||
{
|
||||
ConstantSet(0f, false);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Switch constant highlighting immediately (without fading in/out).
|
||||
/// </summary>
|
||||
public void ConstantSwitchImmediate()
|
||||
{
|
||||
ConstantSet(0f, !_constant);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Turn off all types of highlighting (occlusion mode remains intact).
|
||||
/// </summary>
|
||||
public void Off()
|
||||
{
|
||||
hover = false;
|
||||
TweenSet(false);
|
||||
ConstantSet(0f, false);
|
||||
}
|
||||
|
||||
//
|
||||
public void TweenStart()
|
||||
{
|
||||
TweenSet(true);
|
||||
}
|
||||
|
||||
//
|
||||
public void TweenStop()
|
||||
{
|
||||
TweenSet(false);
|
||||
}
|
||||
|
||||
// Updates tween state. (!) Sets _tween value.
|
||||
public void TweenSet(bool value)
|
||||
{
|
||||
_tween = value;
|
||||
if (_tweenEnabled != _tween)
|
||||
{
|
||||
_tweenEnabled = _tween;
|
||||
_tweenStart = GetTweenTime();
|
||||
}
|
||||
}
|
||||
|
||||
// Updates constant state. (!) Sets _constant value.
|
||||
public void ConstantSet(float fadeTime, bool value)
|
||||
{
|
||||
// Order matters. Should always set _constantDuration prior to _constantEnabled
|
||||
|
||||
// Transition duration
|
||||
if (fadeTime < 0f) { fadeTime = 0f; }
|
||||
if (_constantDuration != fadeTime)
|
||||
{
|
||||
float timeNow = GetConstantTime();
|
||||
// Recalculate start time if duration changed
|
||||
_constantStart = _constantDuration > 0f ? timeNow - (fadeTime / _constantDuration) * (timeNow - _constantStart) : timeNow - fadeTime;
|
||||
_constantDuration = fadeTime;
|
||||
}
|
||||
|
||||
// Transition target
|
||||
_constant = value;
|
||||
if (_constantEnabled != _constant)
|
||||
{
|
||||
_constantEnabled = _constant;
|
||||
// Recalculate start time if value changed
|
||||
_constantStart = GetConstantTime() - _constantDuration * (1f - constantValue);
|
||||
}
|
||||
}
|
||||
#endregion
|
||||
|
||||
#region Protected Methods
|
||||
// Helper
|
||||
protected void TweenSet()
|
||||
{
|
||||
TweenSet(_tween);
|
||||
}
|
||||
|
||||
// Helper
|
||||
protected void ConstantSet()
|
||||
{
|
||||
ConstantSet(_constant);
|
||||
}
|
||||
|
||||
// Helper
|
||||
protected void ConstantSet(bool value)
|
||||
{
|
||||
ConstantSet(value ? constantFadeInTime : _constantFadeOutTime, value);
|
||||
}
|
||||
|
||||
// Updates highlighting color
|
||||
protected override void UpdateHighlighting()
|
||||
{
|
||||
// Hover
|
||||
if (hover)
|
||||
{
|
||||
color = _hoverColor;
|
||||
mode = _overlay ? HighlighterMode.Overlay : HighlighterMode.Default;
|
||||
return;
|
||||
}
|
||||
|
||||
// Tween
|
||||
if (_tweenEnabled)
|
||||
{
|
||||
float delta = GetTweenTime() - (_tweenStart + _tweenDelay);
|
||||
if (delta >= 0f)
|
||||
{
|
||||
float t = _tweenDuration > 0f ? delta / _tweenDuration : 0f;
|
||||
t = Loop(t, _tweenLoop, _tweenReverse, _tweenRepeatCount);
|
||||
if (t >= 0f)
|
||||
{
|
||||
t = Ease(t, _tweenEasing);
|
||||
color = _tweenGradient.Evaluate(t);
|
||||
mode = _overlay ? HighlighterMode.Overlay : HighlighterMode.Default;
|
||||
return;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// Constant
|
||||
float c = _constantEnabled ? constantValue : 1f - constantValue;
|
||||
if (c > 0f)
|
||||
{
|
||||
c = Ease(c, _constantEasing);
|
||||
color = _constantColor;
|
||||
color.a *= c;
|
||||
mode = _overlay ? HighlighterMode.Overlay : HighlighterMode.Default;
|
||||
return;
|
||||
}
|
||||
|
||||
// Occluder
|
||||
if (_occluder)
|
||||
{
|
||||
mode = HighlighterMode.Occluder;
|
||||
return;
|
||||
}
|
||||
|
||||
// Disabled
|
||||
mode = HighlighterMode.Disabled;
|
||||
}
|
||||
#endregion
|
||||
|
||||
#region Protected Methods
|
||||
//
|
||||
protected bool TransformFilterInclude(Renderer renderer, List<int> submeshIndices)
|
||||
{
|
||||
Transform child = renderer.transform;
|
||||
|
||||
for (int i = 0; i < _filterList.Count; i++)
|
||||
{
|
||||
Transform parent = _filterList[i];
|
||||
if (parent == null) { continue; }
|
||||
|
||||
// Highlight if child of inclusion list transform
|
||||
if (child.IsChildOf(parent))
|
||||
{
|
||||
// Highlight all submeshes
|
||||
submeshIndices.Add(-1);
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
//
|
||||
protected bool TransformFilterExclude(Renderer renderer, List<int> submeshIndices)
|
||||
{
|
||||
Transform child = renderer.transform;
|
||||
|
||||
for (int i = 0; i < _filterList.Count; i++)
|
||||
{
|
||||
Transform parent = _filterList[i];
|
||||
if (parent == null) { continue; }
|
||||
|
||||
// Do not highlight if child of exclusion list transform
|
||||
if (child.IsChildOf(parent)) { return false; }
|
||||
}
|
||||
|
||||
// Highlight all submeshes
|
||||
submeshIndices.Add(-1);
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
//
|
||||
protected float Loop(float x, LoopMode loop, bool reverse = false, int repeatCount = -1)
|
||||
{
|
||||
float y = -1f;
|
||||
|
||||
switch (loop)
|
||||
{
|
||||
default:
|
||||
case LoopMode.Once:
|
||||
if (x >= 0f && x <= 1f) { y = x; }
|
||||
break;
|
||||
case LoopMode.Loop:
|
||||
int n1 = Mathf.FloorToInt(x);
|
||||
if (repeatCount < 0 || n1 < repeatCount)
|
||||
{
|
||||
y = x - n1;
|
||||
}
|
||||
break;
|
||||
case LoopMode.PingPong:
|
||||
// Performs 0-1-0 transition in tweenDuration time
|
||||
//int n2 = Mathf.FloorToInt(x);
|
||||
//if (repeatCount < 0 || n2 < repeatCount)
|
||||
//{
|
||||
// y = 1f - Mathf.Abs((x - n2) * 2f - 1f);
|
||||
//}
|
||||
|
||||
// Performs 0-1-0 transition in 2 * tweenDuration time,
|
||||
// so the 0-1 transition is performed with the same speed as in Loop mode.
|
||||
int n2 = Mathf.FloorToInt(x * 0.5f);
|
||||
if (repeatCount < 0 || n2 < repeatCount)
|
||||
{
|
||||
y = 1f - Mathf.Abs(x - n2 * 2f - 1f);
|
||||
}
|
||||
break;
|
||||
case LoopMode.ClampForever:
|
||||
y = Mathf.Clamp01(x);
|
||||
break;
|
||||
}
|
||||
|
||||
// Reverse. Check y for positive value since there is no loop if it's negative.
|
||||
if (y >= 0f && reverse) { y = 1f - y; }
|
||||
|
||||
return y;
|
||||
}
|
||||
|
||||
//
|
||||
protected float Ease(float x, Easing easing)
|
||||
{
|
||||
x = Mathf.Clamp01(x);
|
||||
float y;
|
||||
switch (easing)
|
||||
{
|
||||
// Linear
|
||||
default:
|
||||
case Easing.Linear:
|
||||
y = x;
|
||||
break;
|
||||
|
||||
// Quad
|
||||
case Easing.QuadIn:
|
||||
y = x * x;
|
||||
break;
|
||||
case Easing.QuadOut:
|
||||
y = -x * (x - 2f);
|
||||
break;
|
||||
case Easing.QuadInOut:
|
||||
y = x < 0.5f ? 2f * x * x : 2f * x * (2f - x) - 1f;
|
||||
break;
|
||||
|
||||
// Cubic
|
||||
case Easing.CubicIn:
|
||||
y = x * x * x;
|
||||
break;
|
||||
case Easing.CubicOut:
|
||||
x = x - 1f;
|
||||
y = x * x * x + 1f;
|
||||
break;
|
||||
case Easing.CubicInOut:
|
||||
if (x < 0.5f)
|
||||
{
|
||||
y = 4f * x * x * x;
|
||||
}
|
||||
else
|
||||
{
|
||||
x = 2f * x - 2f;
|
||||
y = 0.5f * (x * x * x + 2f);
|
||||
}
|
||||
break;
|
||||
|
||||
// Sine
|
||||
case Easing.SineIn:
|
||||
y = 1f - Mathf.Cos(x * HALFPI);
|
||||
break;
|
||||
case Easing.SineOut:
|
||||
y = Mathf.Sin(x * HALFPI);
|
||||
break;
|
||||
case Easing.SineInOut:
|
||||
y = -0.5f * (Mathf.Cos(x * Mathf.PI) - 1f);
|
||||
break;
|
||||
|
||||
//y = x * x * (3f - 2f * x);
|
||||
}
|
||||
return y;
|
||||
}
|
||||
|
||||
//
|
||||
protected float GetTweenTime()
|
||||
{
|
||||
return _tweenUseUnscaledTime ? Time.unscaledTime : Time.time;
|
||||
}
|
||||
|
||||
//
|
||||
protected float GetConstantTime()
|
||||
{
|
||||
return _constantUseUnscaledTime ? Time.unscaledTime : Time.time;
|
||||
}
|
||||
#endregion
|
||||
|
||||
#region Static Methods
|
||||
// Color helper
|
||||
static public Color HSVToRGB(float hue, float saturation, float value)
|
||||
{
|
||||
float x = 6f * Mathf.Clamp01(hue);
|
||||
saturation = Mathf.Clamp01(saturation);
|
||||
value = Mathf.Clamp01(value);
|
||||
return new Color
|
||||
(
|
||||
value * (1f + (Mathf.Clamp01(Mathf.Max(2f - x, x - 4f)) - 1f) * saturation),
|
||||
value * (1f + (Mathf.Clamp01(Mathf.Min(x, 4f - x)) - 1f) * saturation),
|
||||
value * (1f + (Mathf.Clamp01(Mathf.Min(x - 2f, 6f - x)) - 1f) * saturation)
|
||||
);
|
||||
}
|
||||
#endregion
|
||||
|
||||
#region DEPRECATED
|
||||
private GradientColorKey[] flashingColorKeys = new GradientColorKey[]
|
||||
{
|
||||
new GradientColorKey(new Color(0f, 1f, 1f, 0f), 0f),
|
||||
new GradientColorKey(new Color(0f, 1f, 1f, 1f), 1f)
|
||||
};
|
||||
private GradientAlphaKey[] flashingAlphaKeys = new GradientAlphaKey[]
|
||||
{
|
||||
new GradientAlphaKey(1f, 0f),
|
||||
new GradientAlphaKey(1f, 1f),
|
||||
};
|
||||
|
||||
/// <summary>
|
||||
/// DEPRECATED. Use hover = true; instead.
|
||||
/// </summary>
|
||||
[System.Obsolete]
|
||||
public void On()
|
||||
{
|
||||
hover = true;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// DEPRECATED. Use Hover(Color color) instead.
|
||||
/// </summary>
|
||||
[System.Obsolete]
|
||||
public void On(Color color)
|
||||
{
|
||||
Hover(color);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// DEPRECATED. Use Hover(new Color(1f, 0f, 0f, 1f)); instead.
|
||||
/// </summary>
|
||||
[System.Obsolete]
|
||||
public void OnParams(Color color)
|
||||
{
|
||||
_hoverColor = color;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// DEPRECATED. Use constantColor = new Color(0f, 1f, 1f, 1f); instead.
|
||||
/// </summary>
|
||||
[System.Obsolete]
|
||||
public void ConstantParams(Color color)
|
||||
{
|
||||
_constantColor = color;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// DEPRECATED. Use tweenGradient and tweenDuration instead.
|
||||
/// </summary>
|
||||
[System.Obsolete]
|
||||
public void FlashingParams(Color color1, Color color2, float freq)
|
||||
{
|
||||
flashingColorKeys[0].color = color1;
|
||||
flashingColorKeys[1].color = color2;
|
||||
_tweenGradient.SetKeys(flashingColorKeys, flashingAlphaKeys);
|
||||
_tweenDuration = 1f / freq;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// DEPRECATED. Use TweenStart() instead.
|
||||
/// </summary>
|
||||
[System.Obsolete]
|
||||
public void FlashingOn()
|
||||
{
|
||||
TweenSet(true);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// DEPRECATED. Use tweenGradient instead.
|
||||
/// </summary>
|
||||
[System.Obsolete]
|
||||
public void FlashingOn(Color color1, Color color2)
|
||||
{
|
||||
flashingColorKeys[0].color = color1;
|
||||
flashingColorKeys[1].color = color2;
|
||||
_tweenGradient.SetKeys(flashingColorKeys, flashingAlphaKeys);
|
||||
TweenSet(true);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// DEPRECATED. Use tweenGradient and tweenDuration instead.
|
||||
/// </summary>
|
||||
[System.Obsolete]
|
||||
public void FlashingOn(Color color1, Color color2, float freq)
|
||||
{
|
||||
flashingColorKeys[0].color = color1;
|
||||
flashingColorKeys[1].color = color2;
|
||||
_tweenGradient.SetKeys(flashingColorKeys, flashingAlphaKeys);
|
||||
_tweenDuration = 1f / freq;
|
||||
TweenSet(true);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// DEPRECATED. Use tweenDuration instead.
|
||||
/// </summary>
|
||||
[System.Obsolete]
|
||||
public void FlashingOn(float freq)
|
||||
{
|
||||
_tweenDuration = 1f / freq;
|
||||
TweenSet(true);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// DEPRECATED. Use TweenStop() instead.
|
||||
/// </summary>
|
||||
[System.Obsolete]
|
||||
public void FlashingOff()
|
||||
{
|
||||
TweenSet(false);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// DEPRECATED. Use TweenStart() and TweenStop() instead.
|
||||
/// </summary>
|
||||
[System.Obsolete]
|
||||
public void FlashingSwitch()
|
||||
{
|
||||
tween = !tween;
|
||||
}
|
||||
#endregion
|
||||
}
|
||||
}
|
|
@ -0,0 +1,8 @@
|
|||
fileFormatVersion: 2
|
||||
guid: 67d4de287b46eb34e83a61e4f9115070
|
||||
MonoImporter:
|
||||
serializedVersion: 2
|
||||
defaultReferences: []
|
||||
executionOrder: 0
|
||||
icon: {instanceID: 0}
|
||||
userData:
|
|
@ -0,0 +1,11 @@
|
|||
using UnityEngine;
|
||||
using System.Collections;
|
||||
|
||||
namespace HighlightingSystem
|
||||
{
|
||||
[AddComponentMenu("Highlighting System/Highlighter Blocker", 1)]
|
||||
public class HighlighterBlocker : MonoBehaviour
|
||||
{
|
||||
|
||||
}
|
||||
}
|
|
@ -0,0 +1,12 @@
|
|||
fileFormatVersion: 2
|
||||
guid: fa287908d1b1c094189eb8515f1387ef
|
||||
timeCreated: 1438594893
|
||||
licenseType: Store
|
||||
MonoImporter:
|
||||
serializedVersion: 2
|
||||
defaultReferences: []
|
||||
executionOrder: 0
|
||||
icon: {instanceID: 0}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
|
@ -0,0 +1,68 @@
|
|||
using UnityEngine;
|
||||
using System.Collections;
|
||||
using System.Collections.Generic;
|
||||
|
||||
namespace HighlightingSystem
|
||||
{
|
||||
[RequireComponent(typeof(Camera))]
|
||||
[AddComponentMenu("Highlighting System/Highlighting Blitter", 3)]
|
||||
public class HighlightingBlitter : MonoBehaviour
|
||||
{
|
||||
protected List<HighlightingBase> renderers = new List<HighlightingBase>();
|
||||
|
||||
#region MonoBehaviour
|
||||
//
|
||||
protected virtual void OnRenderImage(RenderTexture src, RenderTexture dst)
|
||||
{
|
||||
bool oddEven = true;
|
||||
for (int i = 0; i < renderers.Count; i++)
|
||||
{
|
||||
HighlightingBase renderer = renderers[i];
|
||||
if (oddEven)
|
||||
{
|
||||
renderer.Blit(src, dst);
|
||||
}
|
||||
else
|
||||
{
|
||||
renderer.Blit(dst, src);
|
||||
}
|
||||
|
||||
oddEven = !oddEven;
|
||||
}
|
||||
|
||||
// Additional blit because final result should be in dst RenderTexture
|
||||
if (oddEven)
|
||||
{
|
||||
Graphics.Blit(src, dst);
|
||||
}
|
||||
}
|
||||
#endregion
|
||||
|
||||
#region Public Methods
|
||||
//
|
||||
[UnityEngine.Internal.ExcludeFromDocs]
|
||||
public virtual void Register(HighlightingBase renderer)
|
||||
{
|
||||
if (!renderers.Contains(renderer))
|
||||
{
|
||||
renderers.Add(renderer);
|
||||
}
|
||||
|
||||
enabled = renderers.Count > 0;
|
||||
}
|
||||
|
||||
//
|
||||
[UnityEngine.Internal.ExcludeFromDocs]
|
||||
public virtual void Unregister(HighlightingBase renderer)
|
||||
{
|
||||
int index = renderers.IndexOf(renderer);
|
||||
if (index != -1)
|
||||
{
|
||||
renderers.RemoveAt(index);
|
||||
}
|
||||
|
||||
enabled = renderers.Count > 0;
|
||||
}
|
||||
#endregion
|
||||
}
|
||||
}
|
|
@ -0,0 +1,12 @@
|
|||
fileFormatVersion: 2
|
||||
guid: 278a95e6bd76df347879c9b2b9f887f9
|
||||
timeCreated: 1445810792
|
||||
licenseType: Store
|
||||
MonoImporter:
|
||||
serializedVersion: 2
|
||||
defaultReferences: []
|
||||
executionOrder: 0
|
||||
icon: {instanceID: 0}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
|
@ -0,0 +1,129 @@
|
|||
using UnityEngine;
|
||||
using System.Collections;
|
||||
using System.Collections.ObjectModel;
|
||||
using System.Collections.Generic;
|
||||
|
||||
namespace HighlightingSystem
|
||||
{
|
||||
[AddComponentMenu("Highlighting System/Highlighting Renderer", 2)]
|
||||
public class HighlightingRenderer : HighlightingBase
|
||||
{
|
||||
#region Static Fields
|
||||
static public readonly List<HighlightingPreset> defaultPresets = new List<HighlightingPreset>()
|
||||
{
|
||||
new HighlightingPreset() { name = "Default", fillAlpha = 0f, downsampleFactor = 4, iterations = 2, blurMinSpread = 0.65f, blurSpread = 0.25f, blurIntensity = 0.3f, blurDirections = BlurDirections.Diagonal },
|
||||
new HighlightingPreset() { name = "Wide", fillAlpha = 0f, downsampleFactor = 4, iterations = 4, blurMinSpread = 0.65f, blurSpread = 0.25f, blurIntensity = 0.3f, blurDirections = BlurDirections.Diagonal },
|
||||
new HighlightingPreset() { name = "Strong", fillAlpha = 0f, downsampleFactor = 4, iterations = 2, blurMinSpread = 0.5f, blurSpread = 0.15f, blurIntensity = 0.325f, blurDirections = BlurDirections.Diagonal },
|
||||
new HighlightingPreset() { name = "Speed", fillAlpha = 0f, downsampleFactor = 4, iterations = 1, blurMinSpread = 0.75f, blurSpread = 0f, blurIntensity = 0.35f, blurDirections = BlurDirections.Diagonal },
|
||||
new HighlightingPreset() { name = "Quality", fillAlpha = 0f, downsampleFactor = 2, iterations = 3, blurMinSpread = 0.5f, blurSpread = 0.5f, blurIntensity = 0.28f, blurDirections = BlurDirections.Diagonal },
|
||||
new HighlightingPreset() { name = "Solid 1px", fillAlpha = 0f, downsampleFactor = 1, iterations = 1, blurMinSpread = 1f, blurSpread = 0f, blurIntensity = 1f, blurDirections = BlurDirections.All },
|
||||
new HighlightingPreset() { name = "Solid 2px", fillAlpha = 0f, downsampleFactor = 1, iterations = 2, blurMinSpread = 1f, blurSpread = 0f, blurIntensity = 1f, blurDirections = BlurDirections.All }
|
||||
};
|
||||
#endregion
|
||||
|
||||
#region Public Fields
|
||||
public ReadOnlyCollection<HighlightingPreset> presets
|
||||
{
|
||||
get
|
||||
{
|
||||
if (_presetsReadonly == null)
|
||||
{
|
||||
_presetsReadonly = _presets.AsReadOnly();
|
||||
}
|
||||
return _presetsReadonly;
|
||||
}
|
||||
}
|
||||
#endregion
|
||||
|
||||
#region Private Fields
|
||||
[SerializeField]
|
||||
private List<HighlightingPreset> _presets = new List<HighlightingPreset>(defaultPresets);
|
||||
|
||||
private ReadOnlyCollection<HighlightingPreset> _presetsReadonly;
|
||||
#endregion
|
||||
|
||||
#region Public Methods
|
||||
// Get stored preset by name
|
||||
public bool GetPreset(string name, out HighlightingPreset preset)
|
||||
{
|
||||
for (int i = 0; i < _presets.Count; i++)
|
||||
{
|
||||
HighlightingPreset p = _presets[i];
|
||||
if (p.name == name)
|
||||
{
|
||||
preset = p;
|
||||
return true;
|
||||
}
|
||||
}
|
||||
preset = new HighlightingPreset();
|
||||
return false;
|
||||
}
|
||||
|
||||
// Add (store) preset
|
||||
public bool AddPreset(HighlightingPreset preset, bool overwrite)
|
||||
{
|
||||
for (int i = 0; i < _presets.Count; i++)
|
||||
{
|
||||
HighlightingPreset p = _presets[i];
|
||||
if (p.name == preset.name)
|
||||
{
|
||||
if (overwrite)
|
||||
{
|
||||
_presets[i] = preset;
|
||||
return true;
|
||||
}
|
||||
else
|
||||
{
|
||||
return false;
|
||||
}
|
||||
}
|
||||
}
|
||||
_presets.Add(preset);
|
||||
return true;
|
||||
}
|
||||
|
||||
// Find stored preset by name and remove it
|
||||
public bool RemovePreset(string name)
|
||||
{
|
||||
for (int i = 0; i < _presets.Count; i++)
|
||||
{
|
||||
HighlightingPreset p = _presets[i];
|
||||
if (p.name == name)
|
||||
{
|
||||
_presets.RemoveAt(i);
|
||||
return true;
|
||||
}
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
// Find stored preset by name and apply it's settings
|
||||
public bool LoadPreset(string name)
|
||||
{
|
||||
HighlightingPreset preset;
|
||||
if (GetPreset(name, out preset))
|
||||
{
|
||||
ApplyPreset(preset);
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
// Apply preset settings
|
||||
public void ApplyPreset(HighlightingPreset preset)
|
||||
{
|
||||
downsampleFactor = preset.downsampleFactor;
|
||||
iterations = preset.iterations;
|
||||
blurMinSpread = preset.blurMinSpread;
|
||||
blurSpread = preset.blurSpread;
|
||||
blurIntensity = preset.blurIntensity;
|
||||
blurDirections = preset.blurDirections;
|
||||
}
|
||||
|
||||
//
|
||||
public void ClearPresets()
|
||||
{
|
||||
_presets.Clear();
|
||||
}
|
||||
#endregion
|
||||
}
|
||||
}
|
|
@ -0,0 +1,15 @@
|
|||
fileFormatVersion: 2
|
||||
guid: 8b765e0b5af3bcf4a9deb5895e477da8
|
||||
labels:
|
||||
- Glow
|
||||
- Effect
|
||||
- Outline
|
||||
- Highlight
|
||||
- Selection
|
||||
- System
|
||||
MonoImporter:
|
||||
serializedVersion: 2
|
||||
defaultReferences: []
|
||||
executionOrder: 0
|
||||
icon: {instanceID: 0}
|
||||
userData:
|
|
@ -0,0 +1,5 @@
|
|||
fileFormatVersion: 2
|
||||
guid: 3e2a98eec43f4f04788ccf35d4ae8ec4
|
||||
folderAsset: yes
|
||||
DefaultImporter:
|
||||
userData:
|
|
@ -0,0 +1,96 @@
|
|||
using System;
|
||||
using System.Collections;
|
||||
using System.Collections.Generic;
|
||||
using UnityEngine;
|
||||
|
||||
namespace HighlightingSystem
|
||||
{
|
||||
[UnityEngine.Internal.ExcludeFromDocs]
|
||||
public class EndOfFrame : MonoBehaviour
|
||||
{
|
||||
[UnityEngine.Internal.ExcludeFromDocs]
|
||||
public delegate void OnEndOfFrame();
|
||||
|
||||
#region Static Fields
|
||||
static private EndOfFrame _singleton;
|
||||
static private EndOfFrame singleton
|
||||
{
|
||||
get
|
||||
{
|
||||
if (_singleton == null)
|
||||
{
|
||||
GameObject go = new GameObject("EndOfFrameHelper");
|
||||
go.hideFlags = HideFlags.HideAndDontSave;
|
||||
_singleton = go.AddComponent<EndOfFrame>();
|
||||
}
|
||||
return _singleton;
|
||||
}
|
||||
}
|
||||
#endregion
|
||||
|
||||
#region Private Fields
|
||||
private WaitForEndOfFrame waitForEndOfFrame = new WaitForEndOfFrame();
|
||||
private Coroutine coroutine;
|
||||
private List<OnEndOfFrame> listeners = new List<OnEndOfFrame>();
|
||||
#endregion
|
||||
|
||||
#region MonoBehaviour
|
||||
//
|
||||
void OnEnable()
|
||||
{
|
||||
coroutine = StartCoroutine(EndOfFrameRoutine());
|
||||
}
|
||||
|
||||
//
|
||||
void OnDisable()
|
||||
{
|
||||
if (coroutine != null)
|
||||
{
|
||||
StopCoroutine(coroutine);
|
||||
}
|
||||
}
|
||||
#endregion
|
||||
|
||||
#region Public Methods
|
||||
//
|
||||
static public void AddListener(OnEndOfFrame listener)
|
||||
{
|
||||
if (listener == null) { return; }
|
||||
|
||||
singleton.listeners.Add(listener);
|
||||
}
|
||||
|
||||
//
|
||||
static public void RemoveListener(OnEndOfFrame listener)
|
||||
{
|
||||
if (listener == null || _singleton == null) { return; }
|
||||
|
||||
singleton.listeners.Remove(listener);
|
||||
}
|
||||
#endregion
|
||||
|
||||
#region Private Methods
|
||||
//
|
||||
private IEnumerator EndOfFrameRoutine()
|
||||
{
|
||||
while (true)
|
||||
{
|
||||
yield return waitForEndOfFrame;
|
||||
|
||||
for (int i = listeners.Count - 1; i >= 0; i--)
|
||||
{
|
||||
OnEndOfFrame listener = listeners[i];
|
||||
if (listener != null)
|
||||
{
|
||||
listener();
|
||||
}
|
||||
else
|
||||
{
|
||||
listeners.RemoveAt(i);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
#endregion
|
||||
}
|
||||
}
|
|
@ -0,0 +1,12 @@
|
|||
fileFormatVersion: 2
|
||||
guid: 3116e6cc88ed97b4d8eb4053f451aaf7
|
||||
timeCreated: 1505081746
|
||||
licenseType: Store
|
||||
MonoImporter:
|
||||
serializedVersion: 2
|
||||
defaultReferences: []
|
||||
executionOrder: 0
|
||||
icon: {instanceID: 0}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
|
@ -0,0 +1,548 @@
|
|||
using UnityEngine;
|
||||
using UnityEngine.Rendering;
|
||||
using System.Collections;
|
||||
using System.Collections.Generic;
|
||||
using System.Collections.ObjectModel;
|
||||
|
||||
namespace HighlightingSystem
|
||||
{
|
||||
public enum HighlighterMode : int
|
||||
{
|
||||
Disabled = -1,
|
||||
Default = 0,
|
||||
Overlay = 1,
|
||||
Occluder = 2,
|
||||
}
|
||||
|
||||
[DisallowMultipleComponent]
|
||||
public class HighlighterCore : MonoBehaviour
|
||||
{
|
||||
[UnityEngine.Internal.ExcludeFromDocs]
|
||||
private class RendererData
|
||||
{
|
||||
public Renderer renderer;
|
||||
public List<int> submeshIndices = new List<int>();
|
||||
}
|
||||
|
||||
// Constants (don't touch this!)
|
||||
#region Constants
|
||||
//
|
||||
[UnityEngine.Internal.ExcludeFromDocs]
|
||||
public const string keywordOverlay = "HIGHLIGHTING_OVERLAY";
|
||||
|
||||
// Occlusion color
|
||||
private readonly Color occluderColor = new Color(0f, 0f, 0f, 0f);
|
||||
|
||||
// Highlighting modes rendered in that order
|
||||
static private readonly HighlighterMode[] renderingOrder = new HighlighterMode[]
|
||||
{
|
||||
HighlighterMode.Default,
|
||||
HighlighterMode.Overlay,
|
||||
HighlighterMode.Occluder
|
||||
};
|
||||
|
||||
// Pool chunk size for sRendererDataPool expansion
|
||||
private const int poolChunkSize = 4;
|
||||
#endregion
|
||||
|
||||
#region Static Fields
|
||||
// Static collections to prevent unnecessary memory allocations for grabbing and filtering renderer components
|
||||
static private readonly List<Renderer> sRenderers = new List<Renderer>(4);
|
||||
static private readonly Stack<RendererData> sRendererDataPool = new Stack<RendererData>();
|
||||
static private readonly List<RendererData> sRendererData = new List<RendererData>(4);
|
||||
static private readonly List<int> sSubmeshIndices = new List<int>(4);
|
||||
static private readonly List<HighlighterCore> sHighlighters = new List<HighlighterCore>(); // Collection of all enabled highlighters
|
||||
static private ReadOnlyCollection<HighlighterCore> sHighlightersReadonly;
|
||||
#endregion
|
||||
|
||||
#region Public Accessors
|
||||
static public ReadOnlyCollection<HighlighterCore> highlighters
|
||||
{
|
||||
get
|
||||
{
|
||||
if (sHighlightersReadonly == null)
|
||||
{
|
||||
sHighlightersReadonly = sHighlighters.AsReadOnly();
|
||||
}
|
||||
|
||||
return sHighlightersReadonly;
|
||||
}
|
||||
}
|
||||
#endregion
|
||||
|
||||
#region Public Fields
|
||||
/// <summary>
|
||||
/// Defines how this highlighter instance will be rendered.
|
||||
/// </summary>
|
||||
public HighlighterMode mode = HighlighterMode.Default;
|
||||
|
||||
/// <summary>
|
||||
/// Force-render this Highlighter. No culling is performed in this case (neither frustum nor occlusion culling) and renderers from all LOD levels will be always rendered.
|
||||
/// Please be considerate in enabling this mode, or you may experience performance degradation.
|
||||
/// </summary>
|
||||
public bool forceRender;
|
||||
|
||||
/// <summary>
|
||||
/// Highlighting color.
|
||||
/// </summary>
|
||||
public Color color = Color.white;
|
||||
#endregion
|
||||
|
||||
#region Private Fields
|
||||
// Cached transform component reference
|
||||
private Transform tr;
|
||||
|
||||
// Cached Renderers
|
||||
private List<HighlighterRenderer> highlightableRenderers = new List<HighlighterRenderer>();
|
||||
|
||||
// Renderers dirty flag
|
||||
private bool isDirty = true;
|
||||
|
||||
// Cached highlighting mode
|
||||
private bool cachedOverlay = false;
|
||||
|
||||
// Cached highlighting color
|
||||
private Color cachedColor = Color.clear;
|
||||
|
||||
// Opaque shader cached reference
|
||||
static private Shader _opaqueShader;
|
||||
[UnityEngine.Internal.ExcludeFromDocs]
|
||||
static public Shader opaqueShader
|
||||
{
|
||||
get
|
||||
{
|
||||
if (_opaqueShader == null)
|
||||
{
|
||||
_opaqueShader = Shader.Find("Hidden/Highlighted/Opaque");
|
||||
}
|
||||
return _opaqueShader;
|
||||
}
|
||||
}
|
||||
|
||||
// Transparent shader cached reference
|
||||
static private Shader _transparentShader;
|
||||
[UnityEngine.Internal.ExcludeFromDocs]
|
||||
static public Shader transparentShader
|
||||
{
|
||||
get
|
||||
{
|
||||
if (_transparentShader == null)
|
||||
{
|
||||
_transparentShader = Shader.Find("Hidden/Highlighted/Transparent");
|
||||
}
|
||||
return _transparentShader;
|
||||
}
|
||||
}
|
||||
|
||||
// Shared (for this component) replacement material for opaque geometry highlighting
|
||||
private Material _opaqueMaterial;
|
||||
private Material opaqueMaterial
|
||||
{
|
||||
get
|
||||
{
|
||||
if (_opaqueMaterial == null)
|
||||
{
|
||||
_opaqueMaterial = new Material(opaqueShader);
|
||||
|
||||
// Make sure that shader will have proper default values
|
||||
_opaqueMaterial.SetKeyword(keywordOverlay, cachedOverlay);
|
||||
_opaqueMaterial.SetColor(ShaderPropertyID._HighlightingColor, cachedColor);
|
||||
}
|
||||
return _opaqueMaterial;
|
||||
}
|
||||
}
|
||||
#endregion
|
||||
|
||||
#region Renderers Filtration
|
||||
public delegate bool RendererFilter(Renderer renderer, List<int> submeshIndices);
|
||||
|
||||
static private RendererFilter _globalRendererFilter = null;
|
||||
static public RendererFilter globalRendererFilter
|
||||
{
|
||||
get { return _globalRendererFilter; }
|
||||
set
|
||||
{
|
||||
if (_globalRendererFilter != value)
|
||||
{
|
||||
_globalRendererFilter = value;
|
||||
|
||||
for (int i = sHighlighters.Count - 1; i >= 0; i--)
|
||||
{
|
||||
var highlighter = sHighlighters[i];
|
||||
|
||||
// Cleanup null highlighters for extra safety
|
||||
if (highlighter == null)
|
||||
{
|
||||
sHighlighters.RemoveAt(i);
|
||||
continue;
|
||||
}
|
||||
|
||||
// Reinitialize all Highlighters without explicitly assigned rendererFilters
|
||||
if (highlighter.rendererFilter == null)
|
||||
{
|
||||
highlighter.SetDirty();
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
private RendererFilter _rendererFilter = null;
|
||||
public RendererFilter rendererFilter
|
||||
{
|
||||
get { return _rendererFilter; }
|
||||
set
|
||||
{
|
||||
if (_rendererFilter != value)
|
||||
{
|
||||
_rendererFilter = value;
|
||||
|
||||
SetDirty();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
protected virtual RendererFilter rendererFilterToUse
|
||||
{
|
||||
get
|
||||
{
|
||||
if (_rendererFilter != null)
|
||||
{
|
||||
return _rendererFilter;
|
||||
}
|
||||
else if (_globalRendererFilter != null)
|
||||
{
|
||||
return _globalRendererFilter;
|
||||
}
|
||||
else
|
||||
{
|
||||
return DefaultRendererFilter;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
//
|
||||
static public bool DefaultRendererFilter(Renderer renderer, List<int> submeshIndices)
|
||||
{
|
||||
// Do not highlight this renderer if it has HighlighterBlocker in parent
|
||||
if (renderer.GetComponentInParent<HighlighterBlocker>() != null) { return false; }
|
||||
|
||||
bool pass = false;
|
||||
|
||||
if (renderer is MeshRenderer) { pass = true; }
|
||||
else if (renderer is SkinnedMeshRenderer) { pass = true; }
|
||||
else if (renderer is SpriteRenderer) { pass = true; }
|
||||
else if (renderer is ParticleSystemRenderer) { pass = true; }
|
||||
|
||||
if (pass)
|
||||
{
|
||||
// Highlight all submeshes
|
||||
submeshIndices.Add(-1);
|
||||
}
|
||||
|
||||
return pass;
|
||||
}
|
||||
#endregion
|
||||
|
||||
#region MonoBehaviour
|
||||
// Override and use AwakeSafe instead of this method
|
||||
private void Awake()
|
||||
{
|
||||
tr = GetComponent<Transform>();
|
||||
AwakeSafe();
|
||||
}
|
||||
|
||||
// Override and use OnEnableSafe instead of this method
|
||||
private void OnEnable()
|
||||
{
|
||||
if (!sHighlighters.Contains(this)) { sHighlighters.Add(this); }
|
||||
OnEnableSafe();
|
||||
}
|
||||
|
||||
// Override and use OnDisableSafe instead of this method
|
||||
private void OnDisable()
|
||||
{
|
||||
sHighlighters.Remove(this);
|
||||
ClearRenderers();
|
||||
isDirty = true;
|
||||
OnDisableSafe();
|
||||
}
|
||||
|
||||
//
|
||||
private void OnDestroy()
|
||||
{
|
||||
// Unity never garbage-collects unreferenced materials, so it is our responsibility to destroy them
|
||||
if (_opaqueMaterial != null)
|
||||
{
|
||||
Destroy(_opaqueMaterial);
|
||||
}
|
||||
OnDestroySafe();
|
||||
}
|
||||
#endregion
|
||||
|
||||
#region MonoBehaviour Overrides
|
||||
//
|
||||
protected virtual void AwakeSafe() { }
|
||||
|
||||
//
|
||||
protected virtual void OnEnableSafe() { }
|
||||
|
||||
//
|
||||
protected virtual void OnDisableSafe() { }
|
||||
|
||||
//
|
||||
protected virtual void OnDestroySafe() { }
|
||||
#endregion
|
||||
|
||||
#region Public Methods
|
||||
/// <summary>
|
||||
/// Reinitialize renderers.
|
||||
/// Call this method if your highlighted object has changed it's materials, renderers or child objects.
|
||||
/// Can be called multiple times per update - renderers reinitialization will occur only once.
|
||||
/// </summary>
|
||||
public void SetDirty()
|
||||
{
|
||||
isDirty = true;
|
||||
}
|
||||
#endregion
|
||||
|
||||
#region Protected Methods
|
||||
//
|
||||
protected virtual void UpdateHighlighting()
|
||||
{
|
||||
// Update highlighting mode and color here.
|
||||
}
|
||||
#endregion
|
||||
|
||||
#region Private Methods
|
||||
// Clear cached renderers
|
||||
private void ClearRenderers()
|
||||
{
|
||||
for (int i = highlightableRenderers.Count - 1; i >= 0; i--)
|
||||
{
|
||||
HighlighterRenderer renderer = highlightableRenderers[i];
|
||||
renderer.isAlive = false;
|
||||
}
|
||||
highlightableRenderers.Clear();
|
||||
}
|
||||
|
||||
// This method defines how renderers are initialized
|
||||
private void UpdateRenderers()
|
||||
{
|
||||
if (isDirty)
|
||||
{
|
||||
isDirty = false;
|
||||
|
||||
ClearRenderers();
|
||||
|
||||
// Find all renderers which should be highlighted with this HighlighterCore component instance
|
||||
GrabRenderers(tr);
|
||||
|
||||
// Cache found renderers
|
||||
for (int i = 0, imax = sRendererData.Count; i < imax; i++)
|
||||
{
|
||||
RendererData rendererData = sRendererData[i];
|
||||
GameObject rg = rendererData.renderer.gameObject;
|
||||
|
||||
HighlighterRenderer renderer = rg.GetComponent<HighlighterRenderer>();
|
||||
if (renderer == null) { renderer = rg.AddComponent<HighlighterRenderer>(); }
|
||||
renderer.isAlive = true;
|
||||
|
||||
renderer.Initialize(opaqueMaterial, transparentShader, rendererData.submeshIndices);
|
||||
renderer.SetOverlay(cachedOverlay);
|
||||
renderer.SetColor(cachedColor);
|
||||
highlightableRenderers.Add(renderer);
|
||||
}
|
||||
|
||||
// Release RendererData instances
|
||||
for (int i = 0; i < sRendererData.Count; i++)
|
||||
{
|
||||
ReleaseRendererDataInstance(sRendererData[i]);
|
||||
}
|
||||
sRendererData.Clear();
|
||||
}
|
||||
}
|
||||
|
||||
// Recursively follows hierarchy of objects from t, searches for Renderers and adds them to the list.
|
||||
// Breaks if another Highlighter component found
|
||||
private void GrabRenderers(Transform t)
|
||||
{
|
||||
GameObject g = t.gameObject;
|
||||
|
||||
// Find all Renderers on the current GameObject g, filter them and add to the sRendererData list
|
||||
g.GetComponents<Renderer>(sRenderers);
|
||||
for (int i = 0, imax = sRenderers.Count; i < imax; i++)
|
||||
{
|
||||
Renderer renderer = sRenderers[i];
|
||||
if (rendererFilterToUse(renderer, sSubmeshIndices))
|
||||
{
|
||||
RendererData rendererData = GetRendererDataInstance();
|
||||
rendererData.renderer = renderer;
|
||||
List<int> submeshIndices = rendererData.submeshIndices;
|
||||
submeshIndices.Clear();
|
||||
submeshIndices.AddRange(sSubmeshIndices);
|
||||
sRendererData.Add(rendererData);
|
||||
}
|
||||
sSubmeshIndices.Clear();
|
||||
}
|
||||
sRenderers.Clear();
|
||||
|
||||
// Return if transform t doesn't have any children
|
||||
int childCount = t.childCount;
|
||||
if (childCount == 0) { return; }
|
||||
|
||||
// Recursively cache renderers on all child GameObjects
|
||||
for (int i = 0; i < childCount; i++)
|
||||
{
|
||||
Transform childTransform = t.GetChild(i);
|
||||
|
||||
// Do not cache Renderers of this childTransform in case it has it's own Highlighter component
|
||||
HighlighterCore h = childTransform.GetComponent<HighlighterCore>();
|
||||
if (h != null) { continue; }
|
||||
|
||||
GrabRenderers(childTransform);
|
||||
}
|
||||
}
|
||||
|
||||
//
|
||||
private void FillBufferInternal(CommandBuffer buffer)
|
||||
{
|
||||
// Set cachedOverlay if changed
|
||||
bool overlayToUse = mode == HighlighterMode.Overlay || mode == HighlighterMode.Occluder;
|
||||
if (cachedOverlay != overlayToUse)
|
||||
{
|
||||
cachedOverlay = overlayToUse;
|
||||
|
||||
opaqueMaterial.SetKeyword(keywordOverlay, cachedOverlay);
|
||||
for (int i = 0; i < highlightableRenderers.Count; i++)
|
||||
{
|
||||
highlightableRenderers[i].SetOverlay(cachedOverlay);
|
||||
}
|
||||
}
|
||||
|
||||
// Set cachedColor if changed
|
||||
Color colorToUse = mode != HighlighterMode.Occluder ? color : occluderColor;
|
||||
if (cachedColor != colorToUse)
|
||||
{
|
||||
cachedColor = colorToUse;
|
||||
|
||||
// Apply color
|
||||
opaqueMaterial.SetColor(ShaderPropertyID._HighlightingColor, cachedColor);
|
||||
for (int i = 0; i < highlightableRenderers.Count; i++)
|
||||
{
|
||||
highlightableRenderers[i].SetColor(cachedColor);
|
||||
}
|
||||
}
|
||||
|
||||
// Fill CommandBuffer with this highlighter rendering commands
|
||||
for (int i = highlightableRenderers.Count - 1; i >= 0; i--)
|
||||
{
|
||||
// To avoid null-reference exceptions when cached renderer has been removed but SetDirty() wasn't been called
|
||||
HighlighterRenderer renderer = highlightableRenderers[i];
|
||||
if (renderer == null)
|
||||
{
|
||||
highlightableRenderers.RemoveAt(i);
|
||||
}
|
||||
else if (!renderer.IsValid())
|
||||
{
|
||||
highlightableRenderers.RemoveAt(i);
|
||||
renderer.isAlive = false;
|
||||
}
|
||||
else
|
||||
{
|
||||
// Check if renderer is visible for the currently rendering camera.
|
||||
// (Last camera called OnWillRenderObject on HighlighterRenderer instance is the same camera for which we're currently filling CommandBuffer)
|
||||
if (HighlightingBase.GetVisible(renderer) || forceRender)
|
||||
{
|
||||
renderer.FillBuffer(buffer);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
#endregion
|
||||
|
||||
#region Static Methods
|
||||
//
|
||||
static private void ExpandRendererDataPool(int count)
|
||||
{
|
||||
for (int i = 0; i < count; i++)
|
||||
{
|
||||
RendererData instance = new RendererData();
|
||||
sRendererDataPool.Push(instance);
|
||||
}
|
||||
}
|
||||
|
||||
//
|
||||
static private RendererData GetRendererDataInstance()
|
||||
{
|
||||
RendererData instance;
|
||||
|
||||
if (sRendererDataPool.Count == 0)
|
||||
{
|
||||
ExpandRendererDataPool(poolChunkSize);
|
||||
}
|
||||
|
||||
instance = sRendererDataPool.Pop();
|
||||
|
||||
return instance;
|
||||
}
|
||||
|
||||
//
|
||||
static private void ReleaseRendererDataInstance(RendererData instance)
|
||||
{
|
||||
if (instance == null || sRendererDataPool.Contains(instance)) { return; }
|
||||
|
||||
instance.renderer = null;
|
||||
instance.submeshIndices.Clear();
|
||||
|
||||
sRendererDataPool.Push(instance);
|
||||
}
|
||||
|
||||
// Fill CommandBuffer with highlighters rendering commands
|
||||
[UnityEngine.Internal.ExcludeFromDocs]
|
||||
static public void FillBuffer(CommandBuffer buffer)
|
||||
{
|
||||
// Update all highlighters
|
||||
for (int i = sHighlighters.Count - 1; i >= 0; i--)
|
||||
{
|
||||
var highlighter = sHighlighters[i];
|
||||
|
||||
// Cleanup null highlighters for extra safety
|
||||
if (highlighter == null)
|
||||
{
|
||||
sHighlighters.RemoveAt(i);
|
||||
continue;
|
||||
}
|
||||
|
||||
// Update mode and color
|
||||
highlighter.UpdateHighlighting();
|
||||
|
||||
// Cleanup again in case Highlighter has been destroyed in UpdateHighlighting() call
|
||||
if (highlighter == null)
|
||||
{
|
||||
sHighlighters.RemoveAt(i);
|
||||
continue;
|
||||
}
|
||||
|
||||
// Update Renderer's if dirty
|
||||
highlighter.UpdateRenderers();
|
||||
}
|
||||
|
||||
// Fill CommandBuffer with highlighters rendering commands
|
||||
for (int i = 0; i < renderingOrder.Length; i++)
|
||||
{
|
||||
HighlighterMode renderMode = renderingOrder[i];
|
||||
|
||||
for (int j = sHighlighters.Count - 1; j >= 0; j--)
|
||||
{
|
||||
var highlighter = sHighlighters[j];
|
||||
if (highlighter.mode == renderMode)
|
||||
{
|
||||
highlighter.FillBufferInternal(buffer);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
#endregion
|
||||
}
|
||||
}
|
|
@ -0,0 +1,13 @@
|
|||
fileFormatVersion: 2
|
||||
guid: 00769d7dc66ce2a49a2ad03dc19d205e
|
||||
timeCreated: 1516141170
|
||||
licenseType: Store
|
||||
MonoImporter:
|
||||
externalObjects: {}
|
||||
serializedVersion: 2
|
||||
defaultReferences: []
|
||||
executionOrder: 0
|
||||
icon: {instanceID: 0}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
|
@ -0,0 +1,215 @@
|
|||
using UnityEngine;
|
||||
using UnityEngine.Rendering;
|
||||
using System.Collections;
|
||||
using System.Collections.Generic;
|
||||
|
||||
namespace HighlightingSystem
|
||||
{
|
||||
[DisallowMultipleComponent]
|
||||
[AddComponentMenu("")] // Hide in 'Add Component' menu
|
||||
[UnityEngine.Internal.ExcludeFromDocs]
|
||||
public class HighlighterRenderer : MonoBehaviour
|
||||
{
|
||||
[UnityEngine.Internal.ExcludeFromDocs]
|
||||
private struct Data
|
||||
{
|
||||
public Material material;
|
||||
public int submeshIndex;
|
||||
public bool transparent;
|
||||
}
|
||||
|
||||
#region Constants
|
||||
// Default transparency cutoff value (used for shaders without _Cutoff property)
|
||||
static private float transparentCutoff = 0.5f;
|
||||
|
||||
// Flags to hide and don't save this component in editor
|
||||
private const HideFlags flags = HideFlags.HideInInspector | HideFlags.DontSaveInEditor | HideFlags.NotEditable | HideFlags.DontSaveInBuild;
|
||||
|
||||
// Cull Off
|
||||
private const int cullOff = (int)CullMode.Off;
|
||||
#endregion
|
||||
|
||||
#region Static Fields
|
||||
static private readonly string sRenderType = "RenderType";
|
||||
static private readonly string sOpaque = "Opaque";
|
||||
static private readonly string sTransparent = "Transparent";
|
||||
static private readonly string sTransparentCutout = "TransparentCutout";
|
||||
static private readonly string sMainTex = "_MainTex";
|
||||
#endregion
|
||||
|
||||
#region Public Fields
|
||||
public bool isAlive = false;
|
||||
#endregion
|
||||
|
||||
#region Private Fields
|
||||
private Renderer r;
|
||||
private List<Data> data = new List<Data>();
|
||||
#endregion
|
||||
|
||||
#region MonoBehaviour
|
||||
//
|
||||
void Awake()
|
||||
{
|
||||
this.hideFlags = flags;
|
||||
}
|
||||
|
||||
//
|
||||
void OnEnable()
|
||||
{
|
||||
EndOfFrame.AddListener(OnEndOfFrame);
|
||||
}
|
||||
|
||||
//
|
||||
void OnDisable()
|
||||
{
|
||||
EndOfFrame.RemoveListener(OnEndOfFrame);
|
||||
}
|
||||
|
||||
// Called once (before OnPreRender) for each camera if the object is visible.
|
||||
// The function is called during the culling process just before rendering each culled object.
|
||||
void OnWillRenderObject()
|
||||
{
|
||||
HighlightingBase.SetVisible(this);
|
||||
}
|
||||
|
||||
//
|
||||
void OnDestroy()
|
||||
{
|
||||
// Data will be null if Undo / Redo was performed in Editor to delete / restore object with this component
|
||||
if (data == null) { return; }
|
||||
|
||||
for (int i = 0, imax = data.Count; i < imax; i++)
|
||||
{
|
||||
Data d = data[i];
|
||||
// Unity never garbage-collects unreferenced materials, so it is our responsibility to destroy them
|
||||
if (d.transparent)
|
||||
{
|
||||
Destroy(d.material);
|
||||
}
|
||||
}
|
||||
}
|
||||
#endregion
|
||||
|
||||
#region Public Methods
|
||||
//
|
||||
public void Initialize(Material sharedOpaqueMaterial, Shader transparentShader, List<int> submeshIndices)
|
||||
{
|
||||
data.Clear();
|
||||
|
||||
r = GetComponent<Renderer>();
|
||||
Material[] materials = r.sharedMaterials;
|
||||
int materialsLength = materials.Length;
|
||||
|
||||
if (materials == null || materialsLength == 0) { return; }
|
||||
|
||||
// Highlight all submeshes
|
||||
if (submeshIndices.Count == 1 && submeshIndices[0] == -1)
|
||||
{
|
||||
submeshIndices.Clear();
|
||||
for (int i = 0; i < materialsLength; i++)
|
||||
{
|
||||
submeshIndices.Add(i);
|
||||
}
|
||||
}
|
||||
|
||||
// Prepare specified submeshIndices
|
||||
for (int i = 0, imax = submeshIndices.Count; i < imax; i++)
|
||||
{
|
||||
int submeshIndex = submeshIndices[i];
|
||||
|
||||
// Invalid submeshIndex
|
||||
if (submeshIndex >= materialsLength) { continue; }
|
||||
|
||||
Material sourceMat = materials[submeshIndex];
|
||||
|
||||
if (sourceMat == null) { continue; }
|
||||
|
||||
Data d = new Data();
|
||||
|
||||
string tag = sourceMat.GetTag(sRenderType, true, sOpaque);
|
||||
if (tag == sTransparent || tag == sTransparentCutout)
|
||||
{
|
||||
Material replacementMat = new Material(transparentShader);
|
||||
|
||||
// To render both sides of the Sprite
|
||||
if (r is SpriteRenderer) { replacementMat.SetInt(ShaderPropertyID._HighlightingCull, cullOff); }
|
||||
|
||||
if (sourceMat.HasProperty(ShaderPropertyID._MainTex))
|
||||
{
|
||||
replacementMat.SetTexture(ShaderPropertyID._MainTex, sourceMat.mainTexture);
|
||||
replacementMat.SetTextureOffset(sMainTex, sourceMat.mainTextureOffset);
|
||||
replacementMat.SetTextureScale(sMainTex, sourceMat.mainTextureScale);
|
||||
}
|
||||
|
||||
int cutoff = ShaderPropertyID._Cutoff;
|
||||
replacementMat.SetFloat(cutoff, sourceMat.HasProperty(cutoff) ? sourceMat.GetFloat(cutoff) : transparentCutoff);
|
||||
|
||||
d.material = replacementMat;
|
||||
d.transparent = true;
|
||||
}
|
||||
else
|
||||
{
|
||||
d.material = sharedOpaqueMaterial;
|
||||
d.transparent = false;
|
||||
}
|
||||
|
||||
d.submeshIndex = submeshIndex;
|
||||
data.Add(d);
|
||||
}
|
||||
}
|
||||
|
||||
//
|
||||
public void SetOverlay(bool overlay)
|
||||
{
|
||||
for (int i = 0, imax = data.Count; i < imax; i++)
|
||||
{
|
||||
Data d = data[i];
|
||||
if (d.transparent)
|
||||
{
|
||||
d.material.SetKeyword(HighlighterCore.keywordOverlay, overlay);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// Sets given color as highlighting color on all transparent materials of this renderer
|
||||
public void SetColor(Color clr)
|
||||
{
|
||||
for (int i = 0, imax = data.Count; i < imax; i++)
|
||||
{
|
||||
Data d = data[i];
|
||||
if (d.transparent)
|
||||
{
|
||||
d.material.SetColor(ShaderPropertyID._HighlightingColor, clr);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
//
|
||||
public void FillBuffer(CommandBuffer buffer)
|
||||
{
|
||||
for (int i = 0, imax = data.Count; i < imax; i++)
|
||||
{
|
||||
Data d = data[i];
|
||||
buffer.DrawRenderer(r, d.material, d.submeshIndex);
|
||||
}
|
||||
}
|
||||
|
||||
//
|
||||
public bool IsValid()
|
||||
{
|
||||
return r != null;
|
||||
}
|
||||
#endregion
|
||||
|
||||
#region Private Methods
|
||||
//
|
||||
private void OnEndOfFrame()
|
||||
{
|
||||
if (!isAlive)
|
||||
{
|
||||
Destroy(this);
|
||||
}
|
||||
}
|
||||
#endregion
|
||||
}
|
||||
}
|
|
@ -0,0 +1,12 @@
|
|||
fileFormatVersion: 2
|
||||
guid: 23ffcf5db409ff94baada0048d38c89d
|
||||
timeCreated: 1454246717
|
||||
licenseType: Store
|
||||
MonoImporter:
|
||||
serializedVersion: 2
|
||||
defaultReferences: []
|
||||
executionOrder: 0
|
||||
icon: {instanceID: 0}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
|
@ -0,0 +1,634 @@
|
|||
using UnityEngine;
|
||||
using UnityEngine.Rendering;
|
||||
using UnityEngine.Serialization;
|
||||
using UnityEngine.XR;
|
||||
using System.Collections;
|
||||
using System.Collections.Generic;
|
||||
#if UNITY_5_5_OR_NEWER
|
||||
using UnityEngine.Profiling;
|
||||
#endif
|
||||
|
||||
namespace HighlightingSystem
|
||||
{
|
||||
public enum BlurDirections : int
|
||||
{
|
||||
Diagonal,
|
||||
Straight,
|
||||
All
|
||||
}
|
||||
|
||||
public enum AntiAliasing : int
|
||||
{
|
||||
QualitySettings,
|
||||
Disabled,
|
||||
MSAA2x,
|
||||
MSAA4x,
|
||||
MSAA8x,
|
||||
}
|
||||
|
||||
[DisallowMultipleComponent]
|
||||
[RequireComponent(typeof(Camera))]
|
||||
public class HighlightingBase : MonoBehaviour
|
||||
{
|
||||
#region Static Fields and Constants
|
||||
static protected readonly Color colorClear = new Color(0f, 0f, 0f, 0f);
|
||||
static protected readonly string renderBufferName = "HighlightingSystem";
|
||||
static protected readonly Matrix4x4 identityMatrix = Matrix4x4.identity;
|
||||
static protected readonly string keywordStraightDirections = "STRAIGHT_DIRECTIONS";
|
||||
static protected readonly string keywordAllDirections = "ALL_DIRECTIONS";
|
||||
static protected readonly string profileHighlightingSystem = "HighlightingSystem";
|
||||
protected const CameraEvent queue = CameraEvent.BeforeImageEffectsOpaque;
|
||||
|
||||
static protected Camera currentCamera;
|
||||
static protected HashSet<HighlighterRenderer> visibleRenderers = new HashSet<HighlighterRenderer>();
|
||||
#endregion
|
||||
|
||||
#region Accessors
|
||||
// True if supported on this platform
|
||||
public bool isSupported
|
||||
{
|
||||
get
|
||||
{
|
||||
return CheckSupported(false);
|
||||
}
|
||||
}
|
||||
|
||||
public float fillAlpha
|
||||
{
|
||||
get { return _fillAlpha; }
|
||||
set
|
||||
{
|
||||
value = Mathf.Clamp01(value);
|
||||
if (_fillAlpha != value)
|
||||
{
|
||||
if (Application.isPlaying)
|
||||
{
|
||||
cutMaterial.SetFloat(ShaderPropertyID._HighlightingFillAlpha, value);
|
||||
}
|
||||
|
||||
_fillAlpha = value;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// Highlighting buffer size downsample factor
|
||||
public int downsampleFactor
|
||||
{
|
||||
get { return _downsampleFactor; }
|
||||
set
|
||||
{
|
||||
if (_downsampleFactor != value)
|
||||
{
|
||||
// Is power of two check
|
||||
if ((value != 0) && ((value & (value - 1)) == 0))
|
||||
{
|
||||
_downsampleFactor = value;
|
||||
}
|
||||
else
|
||||
{
|
||||
Debug.LogWarning("HighlightingSystem : Prevented attempt to set incorrect downsample factor value.");
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// Blur iterations
|
||||
public int iterations
|
||||
{
|
||||
get { return _iterations; }
|
||||
set
|
||||
{
|
||||
if (_iterations != value)
|
||||
{
|
||||
_iterations = value;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// Blur minimal spread
|
||||
public float blurMinSpread
|
||||
{
|
||||
get { return _blurMinSpread; }
|
||||
set
|
||||
{
|
||||
if (_blurMinSpread != value)
|
||||
{
|
||||
_blurMinSpread = value;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// Blur spread per iteration
|
||||
public float blurSpread
|
||||
{
|
||||
get { return _blurSpread; }
|
||||
set
|
||||
{
|
||||
if (_blurSpread != value)
|
||||
{
|
||||
_blurSpread = value;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// Blurring intensity for the blur material
|
||||
public float blurIntensity
|
||||
{
|
||||
get { return _blurIntensity; }
|
||||
set
|
||||
{
|
||||
if (_blurIntensity != value)
|
||||
{
|
||||
_blurIntensity = value;
|
||||
if (Application.isPlaying)
|
||||
{
|
||||
blurMaterial.SetFloat(ShaderPropertyID._HighlightingIntensity, _blurIntensity);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public BlurDirections blurDirections
|
||||
{
|
||||
get { return _blurDirections; }
|
||||
set
|
||||
{
|
||||
if (_blurDirections != value)
|
||||
{
|
||||
_blurDirections = value;
|
||||
if (Application.isPlaying)
|
||||
{
|
||||
blurMaterial.SetKeyword(keywordStraightDirections, _blurDirections == BlurDirections.Straight);
|
||||
blurMaterial.SetKeyword(keywordAllDirections, _blurDirections == BlurDirections.All);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// Blitter component reference (optional)
|
||||
public HighlightingBlitter blitter
|
||||
{
|
||||
get { return _blitter; }
|
||||
set
|
||||
{
|
||||
if (_blitter != value)
|
||||
{
|
||||
if (_blitter != null)
|
||||
{
|
||||
_blitter.Unregister(this);
|
||||
}
|
||||
_blitter = value;
|
||||
if (_blitter != null)
|
||||
{
|
||||
_blitter.Register(this);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public AntiAliasing antiAliasing
|
||||
{
|
||||
get { return _antiAliasing; }
|
||||
set
|
||||
{
|
||||
if (_antiAliasing != value)
|
||||
{
|
||||
_antiAliasing = value;
|
||||
}
|
||||
}
|
||||
}
|
||||
#endregion
|
||||
|
||||
#region Protected Fields
|
||||
protected CommandBuffer renderBuffer;
|
||||
|
||||
protected RenderTextureDescriptor cachedDescriptor;
|
||||
|
||||
[SerializeField]
|
||||
protected float _fillAlpha = 0f;
|
||||
|
||||
[FormerlySerializedAs("downsampleFactor")]
|
||||
[SerializeField]
|
||||
protected int _downsampleFactor = 4;
|
||||
|
||||
[FormerlySerializedAs("iterations")]
|
||||
[SerializeField]
|
||||
protected int _iterations = 2;
|
||||
|
||||
[FormerlySerializedAs("blurMinSpread")]
|
||||
[SerializeField]
|
||||
protected float _blurMinSpread = 0.65f;
|
||||
|
||||
[FormerlySerializedAs("blurSpread")]
|
||||
[SerializeField]
|
||||
protected float _blurSpread = 0.25f;
|
||||
|
||||
[SerializeField]
|
||||
protected float _blurIntensity = 0.3f;
|
||||
|
||||
[SerializeField]
|
||||
protected BlurDirections _blurDirections = BlurDirections.Diagonal;
|
||||
|
||||
[SerializeField]
|
||||
protected HighlightingBlitter _blitter;
|
||||
|
||||
[SerializeField]
|
||||
protected AntiAliasing _antiAliasing = AntiAliasing.QualitySettings;
|
||||
|
||||
// RenderTargetidentifier for the highlightingBuffer RenderTexture
|
||||
protected RenderTargetIdentifier highlightingBufferID;
|
||||
protected RenderTargetIdentifier blur1ID;
|
||||
protected RenderTargetIdentifier blur2ID;
|
||||
|
||||
// RenderTexture with highlighting buffer
|
||||
protected RenderTexture highlightingBuffer = null;
|
||||
|
||||
// Camera reference
|
||||
protected Camera cam = null;
|
||||
|
||||
// Material parameters
|
||||
protected const int BLUR = 0;
|
||||
protected const int CUT = 1;
|
||||
protected const int COMP = 2;
|
||||
static protected readonly string[] shaderPaths = new string[]
|
||||
{
|
||||
"Hidden/Highlighted/Blur",
|
||||
"Hidden/Highlighted/Cut",
|
||||
"Hidden/Highlighted/Composite",
|
||||
};
|
||||
static protected Shader[] shaders;
|
||||
static protected Material[] materials;
|
||||
|
||||
// Dynamic materials
|
||||
protected Material blurMaterial;
|
||||
protected Material cutMaterial;
|
||||
protected Material compMaterial;
|
||||
|
||||
static protected bool initialized = false;
|
||||
#endregion
|
||||
|
||||
#region MonoBehaviour
|
||||
//
|
||||
protected virtual void OnEnable()
|
||||
{
|
||||
Initialize();
|
||||
|
||||
if (!CheckSupported(true))
|
||||
{
|
||||
enabled = false;
|
||||
Debug.LogError("HighlightingSystem : Highlighting System has been disabled due to unsupported Unity features on the current platform!");
|
||||
return;
|
||||
}
|
||||
|
||||
blur1ID = new RenderTargetIdentifier(ShaderPropertyID._HighlightingBlur1);
|
||||
blur2ID = new RenderTargetIdentifier(ShaderPropertyID._HighlightingBlur2);
|
||||
|
||||
blurMaterial = new Material(materials[BLUR]);
|
||||
cutMaterial = new Material(materials[CUT]);
|
||||
compMaterial = new Material(materials[COMP]);
|
||||
|
||||
// Set initial material properties
|
||||
blurMaterial.SetKeyword(keywordStraightDirections, _blurDirections == BlurDirections.Straight);
|
||||
blurMaterial.SetKeyword(keywordAllDirections, _blurDirections == BlurDirections.All);
|
||||
blurMaterial.SetFloat(ShaderPropertyID._HighlightingIntensity, _blurIntensity);
|
||||
cutMaterial.SetFloat(ShaderPropertyID._HighlightingFillAlpha, _fillAlpha);
|
||||
|
||||
renderBuffer = new CommandBuffer();
|
||||
renderBuffer.name = renderBufferName;
|
||||
|
||||
cam = GetComponent<Camera>();
|
||||
|
||||
cam.depthTextureMode |= DepthTextureMode.Depth;
|
||||
|
||||
cam.AddCommandBuffer(queue, renderBuffer);
|
||||
|
||||
if (_blitter != null)
|
||||
{
|
||||
_blitter.Register(this);
|
||||
}
|
||||
|
||||
EndOfFrame.AddListener(OnEndOfFrame);
|
||||
}
|
||||
|
||||
//
|
||||
protected virtual void OnDisable()
|
||||
{
|
||||
if (renderBuffer != null)
|
||||
{
|
||||
cam.RemoveCommandBuffer(queue, renderBuffer);
|
||||
renderBuffer = null;
|
||||
}
|
||||
|
||||
if (highlightingBuffer != null && highlightingBuffer.IsCreated())
|
||||
{
|
||||
highlightingBuffer.Release();
|
||||
highlightingBuffer = null;
|
||||
}
|
||||
|
||||
if (_blitter != null)
|
||||
{
|
||||
_blitter.Unregister(this);
|
||||
}
|
||||
|
||||
EndOfFrame.RemoveListener(OnEndOfFrame);
|
||||
}
|
||||
|
||||
//
|
||||
protected virtual void OnPreCull()
|
||||
{
|
||||
currentCamera = cam;
|
||||
visibleRenderers.Clear();
|
||||
}
|
||||
|
||||
//
|
||||
protected virtual void OnPreRender()
|
||||
{
|
||||
Profiler.BeginSample("HighlightingSystem.OnPreRender");
|
||||
|
||||
var descriptor = GetDescriptor();
|
||||
|
||||
if (highlightingBuffer == null || !Equals(cachedDescriptor, descriptor))
|
||||
{
|
||||
if (highlightingBuffer != null)
|
||||
{
|
||||
if (highlightingBuffer.IsCreated())
|
||||
{
|
||||
highlightingBuffer.Release();
|
||||
}
|
||||
highlightingBuffer = null;
|
||||
}
|
||||
|
||||
cachedDescriptor = descriptor;
|
||||
|
||||
highlightingBuffer = new RenderTexture(cachedDescriptor);
|
||||
highlightingBuffer.filterMode = FilterMode.Point;
|
||||
highlightingBuffer.wrapMode = TextureWrapMode.Clamp;
|
||||
|
||||
if (!highlightingBuffer.Create())
|
||||
{
|
||||
Debug.LogError("HighlightingSystem : UpdateHighlightingBuffer() : Failed to create highlightingBuffer RenderTexture!");
|
||||
}
|
||||
|
||||
highlightingBufferID = new RenderTargetIdentifier(highlightingBuffer);
|
||||
compMaterial.SetTexture(ShaderPropertyID._HighlightingBuffer, highlightingBuffer);
|
||||
}
|
||||
|
||||
RebuildCommandBuffer();
|
||||
Profiler.EndSample();
|
||||
}
|
||||
|
||||
// Do not remove!
|
||||
// Having this method in this script is necessary to support multiple cameras with different clear flags even in case custom blitter is being used.
|
||||
// Also, CommandBuffer is bound to CameraEvent.BeforeImageEffectsOpaque event,
|
||||
// so Unity will spam 'depthSurface == NULL || rcolorZero->backBuffer == depthSurface->backBuffer' error even if MSAA is enabled
|
||||
protected virtual void OnRenderImage(RenderTexture src, RenderTexture dst)
|
||||
{
|
||||
Profiler.BeginSample("HighlightingSystem.OnRenderImage");
|
||||
if (blitter == null)
|
||||
{
|
||||
Blit(src, dst);
|
||||
}
|
||||
else
|
||||
{
|
||||
Graphics.Blit(src, dst);
|
||||
}
|
||||
Profiler.EndSample();
|
||||
}
|
||||
|
||||
//
|
||||
protected virtual void OnEndOfFrame()
|
||||
{
|
||||
currentCamera = null;
|
||||
visibleRenderers.Clear();
|
||||
}
|
||||
#endregion
|
||||
|
||||
#region Internal
|
||||
//
|
||||
[UnityEngine.Internal.ExcludeFromDocs]
|
||||
static public void SetVisible(HighlighterRenderer renderer)
|
||||
{
|
||||
// Another camera may intercept rendering and send it's own OnWillRenderObject events (i.e. water rendering).
|
||||
// Also, VR Camera with Multi Pass Stereo Rendering Method renders twice per frame (once for each eye),
|
||||
// but OnWillRenderObject is called once so we have to check.
|
||||
if (Camera.current != currentCamera) { return; }
|
||||
|
||||
// Add to the list of renderers visible for the current Highlighting renderer
|
||||
visibleRenderers.Add(renderer);
|
||||
}
|
||||
|
||||
//
|
||||
[UnityEngine.Internal.ExcludeFromDocs]
|
||||
static public bool GetVisible(HighlighterRenderer renderer)
|
||||
{
|
||||
return visibleRenderers.Contains(renderer);
|
||||
}
|
||||
|
||||
//
|
||||
static protected void Initialize()
|
||||
{
|
||||
if (initialized) { return; }
|
||||
|
||||
// Initialize shaders and materials
|
||||
int l = shaderPaths.Length;
|
||||
shaders = new Shader[l];
|
||||
materials = new Material[l];
|
||||
for (int i = 0; i < l; i++)
|
||||
{
|
||||
Shader shader = Shader.Find(shaderPaths[i]);
|
||||
shaders[i] = shader;
|
||||
|
||||
Material material = new Material(shader);
|
||||
materials[i] = material;
|
||||
}
|
||||
|
||||
initialized = true;
|
||||
}
|
||||
|
||||
//
|
||||
protected virtual RenderTextureDescriptor GetDescriptor()
|
||||
{
|
||||
RenderTextureDescriptor descriptor;
|
||||
|
||||
// RTT
|
||||
var targetTexture = cam.targetTexture;
|
||||
if (targetTexture != null)
|
||||
{
|
||||
descriptor = targetTexture.descriptor;
|
||||
}
|
||||
// VR
|
||||
else if (XRSettings.enabled)
|
||||
{
|
||||
descriptor = XRSettings.eyeTextureDesc;
|
||||
}
|
||||
// Normal
|
||||
else
|
||||
{
|
||||
descriptor = new RenderTextureDescriptor(cam.pixelWidth, cam.pixelHeight, RenderTextureFormat.ARGB32, 24);
|
||||
}
|
||||
|
||||
// Overrides
|
||||
descriptor.colorFormat = RenderTextureFormat.ARGB32;
|
||||
descriptor.sRGB = QualitySettings.activeColorSpace == ColorSpace.Linear;
|
||||
descriptor.useMipMap = false;
|
||||
descriptor.msaaSamples = GetAA(targetTexture);
|
||||
|
||||
return descriptor;
|
||||
}
|
||||
|
||||
//
|
||||
protected virtual bool Equals(RenderTextureDescriptor x, RenderTextureDescriptor y)
|
||||
{
|
||||
return x.width == y.width && x.height == y.height && x.msaaSamples == y.msaaSamples; // TODO compare all fields?
|
||||
}
|
||||
|
||||
//
|
||||
protected virtual int GetAA(RenderTexture targetTexture)
|
||||
{
|
||||
int aa = 1;
|
||||
switch (_antiAliasing)
|
||||
{
|
||||
case AntiAliasing.QualitySettings:
|
||||
// Set aa value to 1 in case camera is in DeferredLighting or DeferredShading Rendering Path
|
||||
if (cam.actualRenderingPath == RenderingPath.DeferredLighting || cam.actualRenderingPath == RenderingPath.DeferredShading)
|
||||
{
|
||||
aa = 1;
|
||||
}
|
||||
else
|
||||
{
|
||||
if (targetTexture == null)
|
||||
{
|
||||
aa = QualitySettings.antiAliasing;
|
||||
if (aa == 0) { aa = 1; }
|
||||
}
|
||||
else
|
||||
{
|
||||
aa = targetTexture.antiAliasing;
|
||||
}
|
||||
}
|
||||
break;
|
||||
case AntiAliasing.Disabled:
|
||||
aa = 1;
|
||||
break;
|
||||
case AntiAliasing.MSAA2x:
|
||||
aa = 2;
|
||||
break;
|
||||
case AntiAliasing.MSAA4x:
|
||||
aa = 4;
|
||||
break;
|
||||
case AntiAliasing.MSAA8x:
|
||||
aa = 8;
|
||||
break;
|
||||
}
|
||||
return aa;
|
||||
}
|
||||
|
||||
//
|
||||
protected virtual bool CheckSupported(bool verbose)
|
||||
{
|
||||
bool supported = true;
|
||||
|
||||
// Image Effects supported?
|
||||
if (!SystemInfo.supportsImageEffects)
|
||||
{
|
||||
if (verbose) { Debug.LogError("HighlightingSystem : Image effects is not supported on this platform!"); }
|
||||
supported = false;
|
||||
}
|
||||
|
||||
// Required Render Texture Format supported?
|
||||
if (!SystemInfo.SupportsRenderTextureFormat(RenderTextureFormat.ARGB32))
|
||||
{
|
||||
if (verbose) { Debug.LogError("HighlightingSystem : RenderTextureFormat.ARGB32 is not supported on this platform!"); }
|
||||
supported = false;
|
||||
}
|
||||
|
||||
// HighlightingOpaque shader supported?
|
||||
if (!HighlighterCore.opaqueShader.isSupported)
|
||||
{
|
||||
if (verbose) { Debug.LogError("HighlightingSystem : HighlightingOpaque shader is not supported on this platform!"); }
|
||||
supported = false;
|
||||
}
|
||||
|
||||
// HighlightingTransparent shader supported?
|
||||
if (!HighlighterCore.transparentShader.isSupported)
|
||||
{
|
||||
if (verbose) { Debug.LogError("HighlightingSystem : HighlightingTransparent shader is not supported on this platform!"); }
|
||||
supported = false;
|
||||
}
|
||||
|
||||
// Highlighting shaders supported?
|
||||
for (int i = 0; i < shaders.Length; i++)
|
||||
{
|
||||
Shader shader = shaders[i];
|
||||
if (!shader.isSupported)
|
||||
{
|
||||
if (verbose) { Debug.LogError("HighlightingSystem : Shader '" + shader.name + "' is not supported on this platform!"); }
|
||||
supported = false;
|
||||
}
|
||||
}
|
||||
|
||||
return supported;
|
||||
}
|
||||
|
||||
//
|
||||
protected virtual void RebuildCommandBuffer()
|
||||
{
|
||||
renderBuffer.Clear();
|
||||
|
||||
renderBuffer.BeginSample(profileHighlightingSystem);
|
||||
|
||||
// Prepare and clear render target
|
||||
renderBuffer.SetRenderTarget(highlightingBufferID);
|
||||
renderBuffer.ClearRenderTarget(true, true, colorClear);
|
||||
|
||||
// Fill buffer with highlighters rendering commands
|
||||
HighlighterCore.FillBuffer(renderBuffer);
|
||||
|
||||
RenderTextureDescriptor desc = cachedDescriptor;
|
||||
desc.width = highlightingBuffer.width / _downsampleFactor;
|
||||
desc.height = highlightingBuffer.height / _downsampleFactor;
|
||||
desc.depthBufferBits = 0;
|
||||
|
||||
// Create two buffers for blurring the image
|
||||
renderBuffer.GetTemporaryRT(ShaderPropertyID._HighlightingBlur1, desc, FilterMode.Bilinear);
|
||||
renderBuffer.GetTemporaryRT(ShaderPropertyID._HighlightingBlur2, desc, FilterMode.Bilinear);
|
||||
|
||||
renderBuffer.Blit(highlightingBufferID, blur1ID);
|
||||
|
||||
// Blur the small texture
|
||||
bool oddEven = true;
|
||||
for (int i = 0; i < _iterations; i++)
|
||||
{
|
||||
float off = _blurMinSpread + _blurSpread * i;
|
||||
renderBuffer.SetGlobalFloat(ShaderPropertyID._HighlightingBlurOffset, off);
|
||||
|
||||
if (oddEven)
|
||||
{
|
||||
renderBuffer.Blit(blur1ID, blur2ID, blurMaterial);
|
||||
}
|
||||
else
|
||||
{
|
||||
renderBuffer.Blit(blur2ID, blur1ID, blurMaterial);
|
||||
}
|
||||
|
||||
oddEven = !oddEven;
|
||||
}
|
||||
|
||||
// Upscale blurred texture and cut stencil from it
|
||||
renderBuffer.Blit(oddEven ? blur1ID : blur2ID, highlightingBufferID, cutMaterial);
|
||||
|
||||
// Cleanup
|
||||
renderBuffer.ReleaseTemporaryRT(ShaderPropertyID._HighlightingBlur1);
|
||||
renderBuffer.ReleaseTemporaryRT(ShaderPropertyID._HighlightingBlur2);
|
||||
|
||||
renderBuffer.EndSample(profileHighlightingSystem);
|
||||
}
|
||||
|
||||
// Blit highlighting result to the destination RenderTexture
|
||||
public virtual void Blit(RenderTexture src, RenderTexture dst)
|
||||
{
|
||||
Graphics.Blit(src, dst, compMaterial);
|
||||
}
|
||||
#endregion
|
||||
}
|
||||
}
|
|
@ -0,0 +1,8 @@
|
|||
fileFormatVersion: 2
|
||||
guid: c9a69acb2622340e39a2b84d908232e3
|
||||
MonoImporter:
|
||||
serializedVersion: 2
|
||||
defaultReferences: []
|
||||
executionOrder: 0
|
||||
icon: {instanceID: 0}
|
||||
userData:
|
|
@ -0,0 +1,43 @@
|
|||
using UnityEngine;
|
||||
using System;
|
||||
|
||||
namespace HighlightingSystem
|
||||
{
|
||||
[Serializable]
|
||||
public struct HighlightingPreset : IEquatable<HighlightingPreset>
|
||||
{
|
||||
public string name { get { return _name; } set { _name = value; } }
|
||||
public float fillAlpha { get { return _fillAlpha; } set { _fillAlpha = value; } }
|
||||
public int downsampleFactor { get { return _downsampleFactor; } set { _downsampleFactor = value; } }
|
||||
public int iterations { get { return _iterations; } set { _iterations = value; } }
|
||||
public float blurMinSpread { get { return _blurMinSpread; } set { _blurMinSpread = value; } }
|
||||
public float blurSpread { get { return _blurSpread; } set { _blurSpread = value; } }
|
||||
public float blurIntensity { get { return _blurIntensity; } set { _blurIntensity = value; } }
|
||||
public BlurDirections blurDirections { get { return _blurDirections; } set { _blurDirections = value; } }
|
||||
|
||||
[SerializeField] private string _name;
|
||||
[SerializeField] private float _fillAlpha;
|
||||
[SerializeField] private int _downsampleFactor;
|
||||
[SerializeField] private int _iterations;
|
||||
[SerializeField] private float _blurMinSpread;
|
||||
[SerializeField] private float _blurSpread;
|
||||
[SerializeField] private float _blurIntensity;
|
||||
[SerializeField] private BlurDirections _blurDirections;
|
||||
|
||||
#region IEquatable implementation
|
||||
//
|
||||
bool IEquatable<HighlightingPreset>.Equals(HighlightingPreset other)
|
||||
{
|
||||
return
|
||||
_name == other._name &&
|
||||
_fillAlpha == other._fillAlpha &&
|
||||
_downsampleFactor == other._downsampleFactor &&
|
||||
_iterations == other._iterations &&
|
||||
_blurMinSpread == other._blurMinSpread &&
|
||||
_blurSpread == other._blurSpread &&
|
||||
_blurIntensity == other._blurIntensity &&
|
||||
_blurDirections == other._blurDirections;
|
||||
}
|
||||
#endregion
|
||||
}
|
||||
}
|
|
@ -0,0 +1,12 @@
|
|||
fileFormatVersion: 2
|
||||
guid: bf36fd3853ef7584bb8c13c22fff962e
|
||||
timeCreated: 1480207882
|
||||
licenseType: Store
|
||||
MonoImporter:
|
||||
serializedVersion: 2
|
||||
defaultReferences: []
|
||||
executionOrder: 0
|
||||
icon: {instanceID: 0}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
|
@ -0,0 +1,16 @@
|
|||
using System;
|
||||
using UnityEngine;
|
||||
|
||||
namespace HighlightingSystem
|
||||
{
|
||||
[UnityEngine.Internal.ExcludeFromDocs]
|
||||
static public class MaterialExtensions
|
||||
{
|
||||
// Helper method to enable or disable keyword on material
|
||||
static public void SetKeyword(this Material material, string keyword, bool state)
|
||||
{
|
||||
if (state) { material.EnableKeyword(keyword); }
|
||||
else { material.DisableKeyword(keyword); }
|
||||
}
|
||||
}
|
||||
}
|
|
@ -0,0 +1,13 @@
|
|||
fileFormatVersion: 2
|
||||
guid: f2b5d57c66061e548b250a8d44c4f43a
|
||||
timeCreated: 1521664113
|
||||
licenseType: Store
|
||||
MonoImporter:
|
||||
externalObjects: {}
|
||||
serializedVersion: 2
|
||||
defaultReferences: []
|
||||
executionOrder: 0
|
||||
icon: {instanceID: 0}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
|
@ -0,0 +1,24 @@
|
|||
using UnityEngine;
|
||||
using System.Collections;
|
||||
|
||||
namespace HighlightingSystem
|
||||
{
|
||||
// Shader property ID cached constants
|
||||
[UnityEngine.Internal.ExcludeFromDocs]
|
||||
public class ShaderPropertyID
|
||||
{
|
||||
// Common
|
||||
static public readonly int _MainTex = Shader.PropertyToID("_MainTex");
|
||||
static public readonly int _Cutoff = Shader.PropertyToID("_Cutoff");
|
||||
|
||||
static public readonly int _HighlightingIntensity = Shader.PropertyToID("_HighlightingIntensity");
|
||||
static public readonly int _HighlightingCull = Shader.PropertyToID("_HighlightingCull");
|
||||
static public readonly int _HighlightingColor = Shader.PropertyToID("_HighlightingColor");
|
||||
static public readonly int _HighlightingBlurOffset = Shader.PropertyToID("_HighlightingBlurOffset");
|
||||
static public readonly int _HighlightingFillAlpha = Shader.PropertyToID("_HighlightingFillAlpha");
|
||||
|
||||
static public readonly int _HighlightingBuffer = Shader.PropertyToID("_HighlightingBuffer");
|
||||
static public readonly int _HighlightingBlur1 = Shader.PropertyToID("_HighlightingBlur1");
|
||||
static public readonly int _HighlightingBlur2 = Shader.PropertyToID("_HighlightingBlur2");
|
||||
}
|
||||
}
|
|
@ -0,0 +1,8 @@
|
|||
fileFormatVersion: 2
|
||||
guid: bdf8fd90b69cf684cbbb8f6ec27bf953
|
||||
MonoImporter:
|
||||
serializedVersion: 2
|
||||
defaultReferences: []
|
||||
executionOrder: 0
|
||||
icon: {instanceID: 0}
|
||||
userData:
|
|
@ -930,6 +930,7 @@ GameObject:
|
|||
- component: {fileID: 90795400}
|
||||
- component: {fileID: 90795403}
|
||||
- component: {fileID: 90795404}
|
||||
- component: {fileID: 90795405}
|
||||
m_Layer: 0
|
||||
m_Name: Main Camera
|
||||
m_TagString: MainCamera
|
||||
|
@ -980,7 +981,7 @@ Camera:
|
|||
m_RenderingPath: -1
|
||||
m_TargetTexture: {fileID: 0}
|
||||
m_TargetDisplay: 0
|
||||
m_TargetEye: 3
|
||||
m_TargetEye: 0
|
||||
m_HDR: 1
|
||||
m_AllowMSAA: 1
|
||||
m_AllowDynamicResolution: 0
|
||||
|
@ -995,8 +996,8 @@ Transform:
|
|||
m_PrefabInstance: {fileID: 0}
|
||||
m_PrefabAsset: {fileID: 0}
|
||||
m_GameObject: {fileID: 90795399}
|
||||
m_LocalRotation: {x: 0.19936788, y: 0, z: 0, w: 0.97992474}
|
||||
m_LocalPosition: {x: -118, y: 163, z: -409}
|
||||
m_LocalRotation: {x: 0.38686386, y: -0.10340534, z: 0.04370654, w: 0.91527784}
|
||||
m_LocalPosition: {x: 114.28273, y: 305.18033, z: -95.789764}
|
||||
m_LocalScale: {x: 1, y: 1, z: 1}
|
||||
m_Children: []
|
||||
m_Father: {fileID: 0}
|
||||
|
@ -1043,6 +1044,84 @@ MonoBehaviour:
|
|||
rotationLerpTime: 0.01
|
||||
invertY: 0
|
||||
--- !u!114 &90795404
|
||||
MonoBehaviour:
|
||||
m_ObjectHideFlags: 0
|
||||
m_CorrespondingSourceObject: {fileID: 0}
|
||||
m_PrefabInstance: {fileID: 0}
|
||||
m_PrefabAsset: {fileID: 0}
|
||||
m_GameObject: {fileID: 90795399}
|
||||
m_Enabled: 1
|
||||
m_EditorHideFlags: 0
|
||||
m_Script: {fileID: 11500000, guid: 8b765e0b5af3bcf4a9deb5895e477da8, type: 3}
|
||||
m_Name:
|
||||
m_EditorClassIdentifier:
|
||||
_fillAlpha: 0
|
||||
_downsampleFactor: 4
|
||||
_iterations: 3
|
||||
_blurMinSpread: 0.65
|
||||
_blurSpread: 0.25
|
||||
_blurIntensity: 0.3
|
||||
_blurDirections: 0
|
||||
_blitter: {fileID: 0}
|
||||
_antiAliasing: 0
|
||||
_presets:
|
||||
- _name: Default
|
||||
_fillAlpha: 0
|
||||
_downsampleFactor: 4
|
||||
_iterations: 2
|
||||
_blurMinSpread: 0.65
|
||||
_blurSpread: 0.25
|
||||
_blurIntensity: 0.3
|
||||
_blurDirections: 0
|
||||
- _name: Wide
|
||||
_fillAlpha: 0
|
||||
_downsampleFactor: 4
|
||||
_iterations: 4
|
||||
_blurMinSpread: 0.65
|
||||
_blurSpread: 0.25
|
||||
_blurIntensity: 0.3
|
||||
_blurDirections: 0
|
||||
- _name: Strong
|
||||
_fillAlpha: 0
|
||||
_downsampleFactor: 4
|
||||
_iterations: 2
|
||||
_blurMinSpread: 0.5
|
||||
_blurSpread: 0.15
|
||||
_blurIntensity: 0.325
|
||||
_blurDirections: 0
|
||||
- _name: Speed
|
||||
_fillAlpha: 0
|
||||
_downsampleFactor: 4
|
||||
_iterations: 1
|
||||
_blurMinSpread: 0.75
|
||||
_blurSpread: 0
|
||||
_blurIntensity: 0.35
|
||||
_blurDirections: 0
|
||||
- _name: Quality
|
||||
_fillAlpha: 0
|
||||
_downsampleFactor: 2
|
||||
_iterations: 3
|
||||
_blurMinSpread: 0.5
|
||||
_blurSpread: 0.5
|
||||
_blurIntensity: 0.28
|
||||
_blurDirections: 0
|
||||
- _name: Solid 1px
|
||||
_fillAlpha: 0
|
||||
_downsampleFactor: 1
|
||||
_iterations: 1
|
||||
_blurMinSpread: 1
|
||||
_blurSpread: 0
|
||||
_blurIntensity: 1
|
||||
_blurDirections: 2
|
||||
- _name: Solid 2px
|
||||
_fillAlpha: 0
|
||||
_downsampleFactor: 1
|
||||
_iterations: 2
|
||||
_blurMinSpread: 1
|
||||
_blurSpread: 0
|
||||
_blurIntensity: 1
|
||||
_blurDirections: 2
|
||||
--- !u!114 &90795405
|
||||
MonoBehaviour:
|
||||
m_ObjectHideFlags: 0
|
||||
m_CorrespondingSourceObject: {fileID: 0}
|
||||
|
@ -1054,6 +1133,54 @@ MonoBehaviour:
|
|||
m_Script: {fileID: 11500000, guid: 948f4100a11a5c24981795d21301da5c, type: 3}
|
||||
m_Name:
|
||||
m_EditorClassIdentifier:
|
||||
volumeTrigger: {fileID: 90795402}
|
||||
volumeLayer:
|
||||
serializedVersion: 2
|
||||
m_Bits: 256
|
||||
stopNaNPropagation: 1
|
||||
finalBlitToCameraTarget: 0
|
||||
antialiasingMode: 0
|
||||
temporalAntialiasing:
|
||||
jitterSpread: 0.75
|
||||
sharpness: 0.25
|
||||
stationaryBlending: 0.95
|
||||
motionBlending: 0.85
|
||||
subpixelMorphologicalAntialiasing:
|
||||
quality: 2
|
||||
fastApproximateAntialiasing:
|
||||
fastMode: 0
|
||||
keepAlpha: 0
|
||||
fog:
|
||||
enabled: 1
|
||||
excludeSkybox: 1
|
||||
debugLayer:
|
||||
lightMeter:
|
||||
width: 512
|
||||
height: 256
|
||||
showCurves: 1
|
||||
histogram:
|
||||
width: 512
|
||||
height: 256
|
||||
channel: 3
|
||||
waveform:
|
||||
exposure: 0.12
|
||||
height: 256
|
||||
vectorscope:
|
||||
size: 256
|
||||
exposure: 0.12
|
||||
overlaySettings:
|
||||
linearDepth: 0
|
||||
motionColorIntensity: 4
|
||||
motionGridSize: 64
|
||||
colorBlindnessType: 0
|
||||
colorBlindnessStrength: 1
|
||||
m_Resources: {fileID: 11400000, guid: d82512f9c8e5d4a4d938b575d47f88d4, type: 2}
|
||||
m_ShowToolkit: 1
|
||||
m_ShowCustomSorter: 1
|
||||
breakBeforeColorGrading: 0
|
||||
m_BeforeTransparentBundles: []
|
||||
m_BeforeStackBundles: []
|
||||
m_AfterStackBundles: []
|
||||
--- !u!1 &91360180
|
||||
GameObject:
|
||||
m_ObjectHideFlags: 0
|
||||
|
@ -2265,7 +2392,9 @@ GameObject:
|
|||
- component: {fileID: 317830998}
|
||||
- component: {fileID: 317830999}
|
||||
- component: {fileID: 317831000}
|
||||
m_Layer: 0
|
||||
- component: {fileID: 317831002}
|
||||
- component: {fileID: 317831001}
|
||||
m_Layer: 10
|
||||
m_Name: "\u706B\u70AE (5)"
|
||||
m_TagString: Untagged
|
||||
m_Icon: {fileID: -964228994112308473, guid: 0000000000000000d000000000000000, type: 0}
|
||||
|
@ -2320,6 +2449,81 @@ BoxCollider:
|
|||
serializedVersion: 2
|
||||
m_Size: {x: 3.64, y: 5.4, z: 2.93}
|
||||
m_Center: {x: 0, y: 2.74, z: 0}
|
||||
--- !u!114 &317831001
|
||||
MonoBehaviour:
|
||||
m_ObjectHideFlags: 0
|
||||
m_CorrespondingSourceObject: {fileID: 0}
|
||||
m_PrefabInstance: {fileID: 0}
|
||||
m_PrefabAsset: {fileID: 0}
|
||||
m_GameObject: {fileID: 317830997}
|
||||
m_Enabled: 1
|
||||
m_EditorHideFlags: 0
|
||||
m_Script: {fileID: 11500000, guid: 67d4de287b46eb34e83a61e4f9115070, type: 3}
|
||||
m_Name:
|
||||
m_EditorClassIdentifier:
|
||||
mode: 0
|
||||
forceRender: 0
|
||||
color: {r: 1, g: 1, b: 1, a: 1}
|
||||
_overlay: 0
|
||||
_occluder: 0
|
||||
_tween: 0
|
||||
_tweenGradient:
|
||||
serializedVersion: 2
|
||||
key0: {r: 0, g: 1, b: 1, a: 0}
|
||||
key1: {r: 0, g: 1, b: 1, a: 1}
|
||||
key2: {r: 0, g: 0, b: 0, a: 0}
|
||||
key3: {r: 0, g: 0, b: 0, a: 0}
|
||||
key4: {r: 0, g: 0, b: 0, a: 0}
|
||||
key5: {r: 0, g: 0, b: 0, a: 0}
|
||||
key6: {r: 0, g: 0, b: 0, a: 0}
|
||||
key7: {r: 0, g: 0, b: 0, a: 0}
|
||||
ctime0: 0
|
||||
ctime1: 65535
|
||||
ctime2: 0
|
||||
ctime3: 0
|
||||
ctime4: 0
|
||||
ctime5: 0
|
||||
ctime6: 0
|
||||
ctime7: 0
|
||||
atime0: 0
|
||||
atime1: 65535
|
||||
atime2: 0
|
||||
atime3: 0
|
||||
atime4: 0
|
||||
atime5: 0
|
||||
atime6: 0
|
||||
atime7: 0
|
||||
m_Mode: 0
|
||||
m_NumColorKeys: 2
|
||||
m_NumAlphaKeys: 2
|
||||
_tweenDuration: 1
|
||||
_tweenReverse: 0
|
||||
_tweenLoop: 2
|
||||
_tweenEasing: 0
|
||||
_tweenDelay: 0
|
||||
_tweenRepeatCount: -1
|
||||
_tweenUseUnscaledTime: 0
|
||||
_constant: 0
|
||||
_constantColor: {r: 1, g: 0.92156863, b: 0.015686275, a: 1}
|
||||
_constantFadeInTime: 0.1
|
||||
_constantFadeOutTime: 0.25
|
||||
_constantEasing: 0
|
||||
_constantUseUnscaledTime: 0
|
||||
_filterMode: 0
|
||||
_filterList: []
|
||||
--- !u!114 &317831002
|
||||
MonoBehaviour:
|
||||
m_ObjectHideFlags: 0
|
||||
m_CorrespondingSourceObject: {fileID: 0}
|
||||
m_PrefabInstance: {fileID: 0}
|
||||
m_PrefabAsset: {fileID: 0}
|
||||
m_GameObject: {fileID: 317830997}
|
||||
m_Enabled: 1
|
||||
m_EditorHideFlags: 0
|
||||
m_Script: {fileID: 11500000, guid: e7de33601c65ad84eac6d63477030d3d, type: 3}
|
||||
m_Name:
|
||||
m_EditorClassIdentifier:
|
||||
selfHighlight: {fileID: 0}
|
||||
--- !u!1 &335469898
|
||||
GameObject:
|
||||
m_ObjectHideFlags: 0
|
||||
|
@ -2573,7 +2777,9 @@ GameObject:
|
|||
- component: {fileID: 354464464}
|
||||
- component: {fileID: 354464465}
|
||||
- component: {fileID: 354464466}
|
||||
m_Layer: 0
|
||||
- component: {fileID: 354464468}
|
||||
- component: {fileID: 354464467}
|
||||
m_Layer: 10
|
||||
m_Name: "\u706B\u70AE"
|
||||
m_TagString: Untagged
|
||||
m_Icon: {fileID: -964228994112308473, guid: 0000000000000000d000000000000000, type: 0}
|
||||
|
@ -2628,6 +2834,81 @@ BoxCollider:
|
|||
serializedVersion: 2
|
||||
m_Size: {x: 3.64, y: 4.25, z: 2.93}
|
||||
m_Center: {x: 0, y: 3.1, z: 0}
|
||||
--- !u!114 &354464467
|
||||
MonoBehaviour:
|
||||
m_ObjectHideFlags: 0
|
||||
m_CorrespondingSourceObject: {fileID: 0}
|
||||
m_PrefabInstance: {fileID: 0}
|
||||
m_PrefabAsset: {fileID: 0}
|
||||
m_GameObject: {fileID: 354464463}
|
||||
m_Enabled: 1
|
||||
m_EditorHideFlags: 0
|
||||
m_Script: {fileID: 11500000, guid: 67d4de287b46eb34e83a61e4f9115070, type: 3}
|
||||
m_Name:
|
||||
m_EditorClassIdentifier:
|
||||
mode: 0
|
||||
forceRender: 0
|
||||
color: {r: 1, g: 1, b: 1, a: 1}
|
||||
_overlay: 0
|
||||
_occluder: 0
|
||||
_tween: 0
|
||||
_tweenGradient:
|
||||
serializedVersion: 2
|
||||
key0: {r: 0, g: 1, b: 1, a: 0}
|
||||
key1: {r: 0, g: 1, b: 1, a: 1}
|
||||
key2: {r: 0, g: 0, b: 0, a: 0}
|
||||
key3: {r: 0, g: 0, b: 0, a: 0}
|
||||
key4: {r: 0, g: 0, b: 0, a: 0}
|
||||
key5: {r: 0, g: 0, b: 0, a: 0}
|
||||
key6: {r: 0, g: 0, b: 0, a: 0}
|
||||
key7: {r: 0, g: 0, b: 0, a: 0}
|
||||
ctime0: 0
|
||||
ctime1: 65535
|
||||
ctime2: 0
|
||||
ctime3: 0
|
||||
ctime4: 0
|
||||
ctime5: 0
|
||||
ctime6: 0
|
||||
ctime7: 0
|
||||
atime0: 0
|
||||
atime1: 65535
|
||||
atime2: 0
|
||||
atime3: 0
|
||||
atime4: 0
|
||||
atime5: 0
|
||||
atime6: 0
|
||||
atime7: 0
|
||||
m_Mode: 0
|
||||
m_NumColorKeys: 2
|
||||
m_NumAlphaKeys: 2
|
||||
_tweenDuration: 1
|
||||
_tweenReverse: 0
|
||||
_tweenLoop: 2
|
||||
_tweenEasing: 0
|
||||
_tweenDelay: 0
|
||||
_tweenRepeatCount: -1
|
||||
_tweenUseUnscaledTime: 0
|
||||
_constant: 0
|
||||
_constantColor: {r: 1, g: 0.92156863, b: 0.015686275, a: 1}
|
||||
_constantFadeInTime: 0.1
|
||||
_constantFadeOutTime: 0.25
|
||||
_constantEasing: 0
|
||||
_constantUseUnscaledTime: 0
|
||||
_filterMode: 0
|
||||
_filterList: []
|
||||
--- !u!114 &354464468
|
||||
MonoBehaviour:
|
||||
m_ObjectHideFlags: 0
|
||||
m_CorrespondingSourceObject: {fileID: 0}
|
||||
m_PrefabInstance: {fileID: 0}
|
||||
m_PrefabAsset: {fileID: 0}
|
||||
m_GameObject: {fileID: 354464463}
|
||||
m_Enabled: 1
|
||||
m_EditorHideFlags: 0
|
||||
m_Script: {fileID: 11500000, guid: e7de33601c65ad84eac6d63477030d3d, type: 3}
|
||||
m_Name:
|
||||
m_EditorClassIdentifier:
|
||||
selfHighlight: {fileID: 0}
|
||||
--- !u!1 &386896060
|
||||
GameObject:
|
||||
m_ObjectHideFlags: 0
|
||||
|
@ -2873,7 +3154,9 @@ GameObject:
|
|||
- component: {fileID: 468828551}
|
||||
- component: {fileID: 468828552}
|
||||
- component: {fileID: 468828553}
|
||||
m_Layer: 0
|
||||
- component: {fileID: 468828555}
|
||||
- component: {fileID: 468828554}
|
||||
m_Layer: 10
|
||||
m_Name: "\u706B\u70AE (3)"
|
||||
m_TagString: Untagged
|
||||
m_Icon: {fileID: -964228994112308473, guid: 0000000000000000d000000000000000, type: 0}
|
||||
|
@ -2928,6 +3211,81 @@ BoxCollider:
|
|||
serializedVersion: 2
|
||||
m_Size: {x: 3.64, y: 5.23, z: 2.93}
|
||||
m_Center: {x: 0, y: 1.93, z: 0}
|
||||
--- !u!114 &468828554
|
||||
MonoBehaviour:
|
||||
m_ObjectHideFlags: 0
|
||||
m_CorrespondingSourceObject: {fileID: 0}
|
||||
m_PrefabInstance: {fileID: 0}
|
||||
m_PrefabAsset: {fileID: 0}
|
||||
m_GameObject: {fileID: 468828550}
|
||||
m_Enabled: 1
|
||||
m_EditorHideFlags: 0
|
||||
m_Script: {fileID: 11500000, guid: 67d4de287b46eb34e83a61e4f9115070, type: 3}
|
||||
m_Name:
|
||||
m_EditorClassIdentifier:
|
||||
mode: 0
|
||||
forceRender: 0
|
||||
color: {r: 1, g: 1, b: 1, a: 1}
|
||||
_overlay: 0
|
||||
_occluder: 0
|
||||
_tween: 0
|
||||
_tweenGradient:
|
||||
serializedVersion: 2
|
||||
key0: {r: 0, g: 1, b: 1, a: 0}
|
||||
key1: {r: 0, g: 1, b: 1, a: 1}
|
||||
key2: {r: 0, g: 0, b: 0, a: 0}
|
||||
key3: {r: 0, g: 0, b: 0, a: 0}
|
||||
key4: {r: 0, g: 0, b: 0, a: 0}
|
||||
key5: {r: 0, g: 0, b: 0, a: 0}
|
||||
key6: {r: 0, g: 0, b: 0, a: 0}
|
||||
key7: {r: 0, g: 0, b: 0, a: 0}
|
||||
ctime0: 0
|
||||
ctime1: 65535
|
||||
ctime2: 0
|
||||
ctime3: 0
|
||||
ctime4: 0
|
||||
ctime5: 0
|
||||
ctime6: 0
|
||||
ctime7: 0
|
||||
atime0: 0
|
||||
atime1: 65535
|
||||
atime2: 0
|
||||
atime3: 0
|
||||
atime4: 0
|
||||
atime5: 0
|
||||
atime6: 0
|
||||
atime7: 0
|
||||
m_Mode: 0
|
||||
m_NumColorKeys: 2
|
||||
m_NumAlphaKeys: 2
|
||||
_tweenDuration: 1
|
||||
_tweenReverse: 0
|
||||
_tweenLoop: 2
|
||||
_tweenEasing: 0
|
||||
_tweenDelay: 0
|
||||
_tweenRepeatCount: -1
|
||||
_tweenUseUnscaledTime: 0
|
||||
_constant: 0
|
||||
_constantColor: {r: 1, g: 0.92156863, b: 0.015686275, a: 1}
|
||||
_constantFadeInTime: 0.1
|
||||
_constantFadeOutTime: 0.25
|
||||
_constantEasing: 0
|
||||
_constantUseUnscaledTime: 0
|
||||
_filterMode: 0
|
||||
_filterList: []
|
||||
--- !u!114 &468828555
|
||||
MonoBehaviour:
|
||||
m_ObjectHideFlags: 0
|
||||
m_CorrespondingSourceObject: {fileID: 0}
|
||||
m_PrefabInstance: {fileID: 0}
|
||||
m_PrefabAsset: {fileID: 0}
|
||||
m_GameObject: {fileID: 468828550}
|
||||
m_Enabled: 1
|
||||
m_EditorHideFlags: 0
|
||||
m_Script: {fileID: 11500000, guid: e7de33601c65ad84eac6d63477030d3d, type: 3}
|
||||
m_Name:
|
||||
m_EditorClassIdentifier:
|
||||
selfHighlight: {fileID: 0}
|
||||
--- !u!1 &494165987
|
||||
GameObject:
|
||||
m_ObjectHideFlags: 0
|
||||
|
@ -4120,7 +4478,7 @@ MonoBehaviour:
|
|||
m_PersistentCalls:
|
||||
m_Calls:
|
||||
- m_Target: {fileID: 1436809533}
|
||||
m_MethodName: SetMove
|
||||
m_MethodName: SetAttackTargetView
|
||||
m_Mode: 1
|
||||
m_Arguments:
|
||||
m_ObjectArgument: {fileID: 0}
|
||||
|
@ -5681,7 +6039,9 @@ GameObject:
|
|||
- component: {fileID: 1089750760}
|
||||
- component: {fileID: 1089750761}
|
||||
- component: {fileID: 1089750762}
|
||||
m_Layer: 0
|
||||
- component: {fileID: 1089750764}
|
||||
- component: {fileID: 1089750763}
|
||||
m_Layer: 10
|
||||
m_Name: "\u706B\u70AE (1)"
|
||||
m_TagString: Untagged
|
||||
m_Icon: {fileID: -964228994112308473, guid: 0000000000000000d000000000000000, type: 0}
|
||||
|
@ -5736,6 +6096,81 @@ BoxCollider:
|
|||
serializedVersion: 2
|
||||
m_Size: {x: 3.64, y: 5.34, z: 2.93}
|
||||
m_Center: {x: 0, y: 2.24, z: 0}
|
||||
--- !u!114 &1089750763
|
||||
MonoBehaviour:
|
||||
m_ObjectHideFlags: 0
|
||||
m_CorrespondingSourceObject: {fileID: 0}
|
||||
m_PrefabInstance: {fileID: 0}
|
||||
m_PrefabAsset: {fileID: 0}
|
||||
m_GameObject: {fileID: 1089750759}
|
||||
m_Enabled: 1
|
||||
m_EditorHideFlags: 0
|
||||
m_Script: {fileID: 11500000, guid: 67d4de287b46eb34e83a61e4f9115070, type: 3}
|
||||
m_Name:
|
||||
m_EditorClassIdentifier:
|
||||
mode: 0
|
||||
forceRender: 0
|
||||
color: {r: 1, g: 1, b: 1, a: 1}
|
||||
_overlay: 0
|
||||
_occluder: 0
|
||||
_tween: 0
|
||||
_tweenGradient:
|
||||
serializedVersion: 2
|
||||
key0: {r: 0, g: 1, b: 1, a: 0}
|
||||
key1: {r: 0, g: 1, b: 1, a: 1}
|
||||
key2: {r: 0, g: 0, b: 0, a: 0}
|
||||
key3: {r: 0, g: 0, b: 0, a: 0}
|
||||
key4: {r: 0, g: 0, b: 0, a: 0}
|
||||
key5: {r: 0, g: 0, b: 0, a: 0}
|
||||
key6: {r: 0, g: 0, b: 0, a: 0}
|
||||
key7: {r: 0, g: 0, b: 0, a: 0}
|
||||
ctime0: 0
|
||||
ctime1: 65535
|
||||
ctime2: 0
|
||||
ctime3: 0
|
||||
ctime4: 0
|
||||
ctime5: 0
|
||||
ctime6: 0
|
||||
ctime7: 0
|
||||
atime0: 0
|
||||
atime1: 65535
|
||||
atime2: 0
|
||||
atime3: 0
|
||||
atime4: 0
|
||||
atime5: 0
|
||||
atime6: 0
|
||||
atime7: 0
|
||||
m_Mode: 0
|
||||
m_NumColorKeys: 2
|
||||
m_NumAlphaKeys: 2
|
||||
_tweenDuration: 1
|
||||
_tweenReverse: 0
|
||||
_tweenLoop: 2
|
||||
_tweenEasing: 0
|
||||
_tweenDelay: 0
|
||||
_tweenRepeatCount: -1
|
||||
_tweenUseUnscaledTime: 0
|
||||
_constant: 0
|
||||
_constantColor: {r: 1, g: 0.92156863, b: 0.015686275, a: 1}
|
||||
_constantFadeInTime: 0.1
|
||||
_constantFadeOutTime: 0.25
|
||||
_constantEasing: 0
|
||||
_constantUseUnscaledTime: 0
|
||||
_filterMode: 0
|
||||
_filterList: []
|
||||
--- !u!114 &1089750764
|
||||
MonoBehaviour:
|
||||
m_ObjectHideFlags: 0
|
||||
m_CorrespondingSourceObject: {fileID: 0}
|
||||
m_PrefabInstance: {fileID: 0}
|
||||
m_PrefabAsset: {fileID: 0}
|
||||
m_GameObject: {fileID: 1089750759}
|
||||
m_Enabled: 1
|
||||
m_EditorHideFlags: 0
|
||||
m_Script: {fileID: 11500000, guid: e7de33601c65ad84eac6d63477030d3d, type: 3}
|
||||
m_Name:
|
||||
m_EditorClassIdentifier:
|
||||
selfHighlight: {fileID: 0}
|
||||
--- !u!4 &1091286425 stripped
|
||||
Transform:
|
||||
m_CorrespondingSourceObject: {fileID: -8679921383154817045, guid: 5072bfb20a3d05f43b9c99152a5860ad,
|
||||
|
@ -5753,7 +6188,9 @@ GameObject:
|
|||
- component: {fileID: 1095573349}
|
||||
- component: {fileID: 1095573350}
|
||||
- component: {fileID: 1095573351}
|
||||
m_Layer: 0
|
||||
- component: {fileID: 1095573353}
|
||||
- component: {fileID: 1095573352}
|
||||
m_Layer: 10
|
||||
m_Name: "\u706B\u70AE (4)"
|
||||
m_TagString: Untagged
|
||||
m_Icon: {fileID: -964228994112308473, guid: 0000000000000000d000000000000000, type: 0}
|
||||
|
@ -5808,6 +6245,81 @@ BoxCollider:
|
|||
serializedVersion: 2
|
||||
m_Size: {x: 3.64, y: 4.99, z: 2.93}
|
||||
m_Center: {x: 0, y: 1.97, z: 0}
|
||||
--- !u!114 &1095573352
|
||||
MonoBehaviour:
|
||||
m_ObjectHideFlags: 0
|
||||
m_CorrespondingSourceObject: {fileID: 0}
|
||||
m_PrefabInstance: {fileID: 0}
|
||||
m_PrefabAsset: {fileID: 0}
|
||||
m_GameObject: {fileID: 1095573348}
|
||||
m_Enabled: 1
|
||||
m_EditorHideFlags: 0
|
||||
m_Script: {fileID: 11500000, guid: 67d4de287b46eb34e83a61e4f9115070, type: 3}
|
||||
m_Name:
|
||||
m_EditorClassIdentifier:
|
||||
mode: 0
|
||||
forceRender: 0
|
||||
color: {r: 1, g: 1, b: 1, a: 1}
|
||||
_overlay: 0
|
||||
_occluder: 0
|
||||
_tween: 0
|
||||
_tweenGradient:
|
||||
serializedVersion: 2
|
||||
key0: {r: 0, g: 1, b: 1, a: 0}
|
||||
key1: {r: 0, g: 1, b: 1, a: 1}
|
||||
key2: {r: 0, g: 0, b: 0, a: 0}
|
||||
key3: {r: 0, g: 0, b: 0, a: 0}
|
||||
key4: {r: 0, g: 0, b: 0, a: 0}
|
||||
key5: {r: 0, g: 0, b: 0, a: 0}
|
||||
key6: {r: 0, g: 0, b: 0, a: 0}
|
||||
key7: {r: 0, g: 0, b: 0, a: 0}
|
||||
ctime0: 0
|
||||
ctime1: 65535
|
||||
ctime2: 0
|
||||
ctime3: 0
|
||||
ctime4: 0
|
||||
ctime5: 0
|
||||
ctime6: 0
|
||||
ctime7: 0
|
||||
atime0: 0
|
||||
atime1: 65535
|
||||
atime2: 0
|
||||
atime3: 0
|
||||
atime4: 0
|
||||
atime5: 0
|
||||
atime6: 0
|
||||
atime7: 0
|
||||
m_Mode: 0
|
||||
m_NumColorKeys: 2
|
||||
m_NumAlphaKeys: 2
|
||||
_tweenDuration: 1
|
||||
_tweenReverse: 0
|
||||
_tweenLoop: 2
|
||||
_tweenEasing: 0
|
||||
_tweenDelay: 0
|
||||
_tweenRepeatCount: -1
|
||||
_tweenUseUnscaledTime: 0
|
||||
_constant: 0
|
||||
_constantColor: {r: 1, g: 0.92156863, b: 0.015686275, a: 1}
|
||||
_constantFadeInTime: 0.1
|
||||
_constantFadeOutTime: 0.25
|
||||
_constantEasing: 0
|
||||
_constantUseUnscaledTime: 0
|
||||
_filterMode: 0
|
||||
_filterList: []
|
||||
--- !u!114 &1095573353
|
||||
MonoBehaviour:
|
||||
m_ObjectHideFlags: 0
|
||||
m_CorrespondingSourceObject: {fileID: 0}
|
||||
m_PrefabInstance: {fileID: 0}
|
||||
m_PrefabAsset: {fileID: 0}
|
||||
m_GameObject: {fileID: 1095573348}
|
||||
m_Enabled: 1
|
||||
m_EditorHideFlags: 0
|
||||
m_Script: {fileID: 11500000, guid: e7de33601c65ad84eac6d63477030d3d, type: 3}
|
||||
m_Name:
|
||||
m_EditorClassIdentifier:
|
||||
selfHighlight: {fileID: 0}
|
||||
--- !u!1 &1113159740
|
||||
GameObject:
|
||||
m_ObjectHideFlags: 0
|
||||
|
@ -6742,6 +7254,7 @@ MonoBehaviour:
|
|||
m_Script: {fileID: 11500000, guid: b94a2969b398cb44cb3031e8cdf455e1, type: 3}
|
||||
m_Name:
|
||||
m_EditorClassIdentifier:
|
||||
wRJControllers: []
|
||||
currentWRJ: {fileID: 0}
|
||||
wrjMenuSetPanel: {fileID: 1703180990}
|
||||
canvasRect: {fileID: 147647011}
|
||||
|
@ -6795,7 +7308,7 @@ MonoBehaviour:
|
|||
simpleCameraController: {fileID: 90795403}
|
||||
wrjManager: {fileID: 1436809531}
|
||||
buleInstruct: {fileID: 125837377}
|
||||
lines: []
|
||||
instructs: []
|
||||
isDistance: 1
|
||||
--- !u!1 &1444599844
|
||||
GameObject:
|
||||
|
@ -10575,7 +11088,9 @@ GameObject:
|
|||
- component: {fileID: 2101056906}
|
||||
- component: {fileID: 2101056907}
|
||||
- component: {fileID: 2101056908}
|
||||
m_Layer: 0
|
||||
- component: {fileID: 2101056910}
|
||||
- component: {fileID: 2101056909}
|
||||
m_Layer: 10
|
||||
m_Name: "\u706B\u70AE (2)"
|
||||
m_TagString: Untagged
|
||||
m_Icon: {fileID: -964228994112308473, guid: 0000000000000000d000000000000000, type: 0}
|
||||
|
@ -10630,6 +11145,81 @@ BoxCollider:
|
|||
serializedVersion: 2
|
||||
m_Size: {x: 3.64, y: 6.44, z: 2.93}
|
||||
m_Center: {x: 0, y: 3.1, z: 0}
|
||||
--- !u!114 &2101056909
|
||||
MonoBehaviour:
|
||||
m_ObjectHideFlags: 0
|
||||
m_CorrespondingSourceObject: {fileID: 0}
|
||||
m_PrefabInstance: {fileID: 0}
|
||||
m_PrefabAsset: {fileID: 0}
|
||||
m_GameObject: {fileID: 2101056905}
|
||||
m_Enabled: 1
|
||||
m_EditorHideFlags: 0
|
||||
m_Script: {fileID: 11500000, guid: 67d4de287b46eb34e83a61e4f9115070, type: 3}
|
||||
m_Name:
|
||||
m_EditorClassIdentifier:
|
||||
mode: 0
|
||||
forceRender: 0
|
||||
color: {r: 1, g: 1, b: 1, a: 1}
|
||||
_overlay: 0
|
||||
_occluder: 0
|
||||
_tween: 0
|
||||
_tweenGradient:
|
||||
serializedVersion: 2
|
||||
key0: {r: 0, g: 1, b: 1, a: 0}
|
||||
key1: {r: 0, g: 1, b: 1, a: 1}
|
||||
key2: {r: 0, g: 0, b: 0, a: 0}
|
||||
key3: {r: 0, g: 0, b: 0, a: 0}
|
||||
key4: {r: 0, g: 0, b: 0, a: 0}
|
||||
key5: {r: 0, g: 0, b: 0, a: 0}
|
||||
key6: {r: 0, g: 0, b: 0, a: 0}
|
||||
key7: {r: 0, g: 0, b: 0, a: 0}
|
||||
ctime0: 0
|
||||
ctime1: 65535
|
||||
ctime2: 0
|
||||
ctime3: 0
|
||||
ctime4: 0
|
||||
ctime5: 0
|
||||
ctime6: 0
|
||||
ctime7: 0
|
||||
atime0: 0
|
||||
atime1: 65535
|
||||
atime2: 0
|
||||
atime3: 0
|
||||
atime4: 0
|
||||
atime5: 0
|
||||
atime6: 0
|
||||
atime7: 0
|
||||
m_Mode: 0
|
||||
m_NumColorKeys: 2
|
||||
m_NumAlphaKeys: 2
|
||||
_tweenDuration: 1
|
||||
_tweenReverse: 0
|
||||
_tweenLoop: 2
|
||||
_tweenEasing: 0
|
||||
_tweenDelay: 0
|
||||
_tweenRepeatCount: -1
|
||||
_tweenUseUnscaledTime: 0
|
||||
_constant: 0
|
||||
_constantColor: {r: 1, g: 0.92156863, b: 0.015686275, a: 1}
|
||||
_constantFadeInTime: 0.1
|
||||
_constantFadeOutTime: 0.25
|
||||
_constantEasing: 0
|
||||
_constantUseUnscaledTime: 0
|
||||
_filterMode: 0
|
||||
_filterList: []
|
||||
--- !u!114 &2101056910
|
||||
MonoBehaviour:
|
||||
m_ObjectHideFlags: 0
|
||||
m_CorrespondingSourceObject: {fileID: 0}
|
||||
m_PrefabInstance: {fileID: 0}
|
||||
m_PrefabAsset: {fileID: 0}
|
||||
m_GameObject: {fileID: 2101056905}
|
||||
m_Enabled: 1
|
||||
m_EditorHideFlags: 0
|
||||
m_Script: {fileID: 11500000, guid: e7de33601c65ad84eac6d63477030d3d, type: 3}
|
||||
m_Name:
|
||||
m_EditorClassIdentifier:
|
||||
selfHighlight: {fileID: 0}
|
||||
--- !u!1 &2128163974
|
||||
GameObject:
|
||||
m_ObjectHideFlags: 0
|
||||
|
@ -10880,7 +11470,7 @@ GameObject:
|
|||
m_TagString: Untagged
|
||||
m_Icon: {fileID: 0}
|
||||
m_NavMeshLayer: 0
|
||||
m_StaticEditorFlags: 4294967295
|
||||
m_StaticEditorFlags: 0
|
||||
m_IsActive: 1
|
||||
--- !u!4 &4900298106786792354
|
||||
Transform:
|
||||
|
@ -11098,6 +11688,11 @@ MonoBehaviour:
|
|||
m_Script: {fileID: 11500000, guid: 8b9a305e18de0c04dbd257a21cd47087, type: 3}
|
||||
m_Name:
|
||||
m_EditorClassIdentifier:
|
||||
sharedProfile: {fileID: 11400000, guid: f7cb712597617514a8ed7f910f4d495d, type: 2}
|
||||
isGlobal: 1
|
||||
blendDistance: 0
|
||||
weight: 1
|
||||
priority: 0
|
||||
--- !u!1 &4900298107543512938
|
||||
GameObject:
|
||||
m_ObjectHideFlags: 0
|
||||
|
|
|
@ -7,6 +7,7 @@ public class BulletController : MonoBehaviour
|
|||
public bool isMove = false;
|
||||
public bool isWRJFire = false;
|
||||
public GameObject boom;
|
||||
public HuoPaoController huoPaoController;
|
||||
// Start is called before the first frame update
|
||||
void Start()
|
||||
{
|
||||
|
@ -17,7 +18,7 @@ public class BulletController : MonoBehaviour
|
|||
void Update()
|
||||
{
|
||||
if (isMove)
|
||||
transform.Translate(transform.forward * Time.deltaTime * 30f, Space.World);
|
||||
transform.Translate(transform.forward * Time.deltaTime * 70f, Space.World);
|
||||
}
|
||||
public void SetBoolIsMove()
|
||||
{
|
||||
|
@ -47,6 +48,9 @@ public class BulletController : MonoBehaviour
|
|||
}
|
||||
else
|
||||
{
|
||||
huoPaoController.wrjs.Remove(other.collider.gameObject);
|
||||
Destroy(other.collider.gameObject);
|
||||
|
||||
Debug.Log("无人机被消灭干净");
|
||||
}
|
||||
Destroy(gameObject);
|
||||
|
|
|
@ -0,0 +1,31 @@
|
|||
using HighlightingSystem;
|
||||
using System.Collections;
|
||||
using System.Collections.Generic;
|
||||
using UnityEngine;
|
||||
|
||||
public class On3DClick : MonoBehaviour
|
||||
{
|
||||
public Highlighter selfHighlight;
|
||||
// Start is called before the first frame update
|
||||
void Start()
|
||||
{
|
||||
selfHighlight = GetComponent<Highlighter>();
|
||||
}
|
||||
|
||||
// Update is called once per frame
|
||||
void Update()
|
||||
{
|
||||
|
||||
}
|
||||
private void OnMouseEnter()
|
||||
{
|
||||
selfHighlight.ConstantOn(Color.green);
|
||||
Debug.Log("OnMouseEnter");
|
||||
}
|
||||
|
||||
private void OnMouseExit()
|
||||
{
|
||||
selfHighlight.ConstantOff();
|
||||
Debug.Log("OnMouseExit");
|
||||
}
|
||||
}
|
|
@ -0,0 +1,11 @@
|
|||
fileFormatVersion: 2
|
||||
guid: e7de33601c65ad84eac6d63477030d3d
|
||||
MonoImporter:
|
||||
externalObjects: {}
|
||||
serializedVersion: 2
|
||||
defaultReferences: []
|
||||
executionOrder: 0
|
||||
icon: {instanceID: 0}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
|
@ -38,6 +38,7 @@ namespace Umawerse.FiniteStateMachines
|
|||
{
|
||||
OnDoubleTap();
|
||||
});
|
||||
root.tapGesture.SetLayerMask(1<<8);
|
||||
Init();
|
||||
}
|
||||
|
||||
|
@ -71,7 +72,7 @@ namespace Umawerse.FiniteStateMachines
|
|||
{
|
||||
vertices = new List<Vector3>();
|
||||
target = new GameObject($"{name}_{Time.frameCount:D5}");
|
||||
root.lines.Add(target);
|
||||
root.instructs.Add(target);
|
||||
}
|
||||
|
||||
public abstract void Complete();
|
||||
|
|
|
@ -21,26 +21,30 @@ public class HuoPaoController : MonoBehaviour
|
|||
{
|
||||
for (int i = 0; i < wrjs.Count; i++)
|
||||
{
|
||||
dis = Vector3.Distance(wrjs[i].transform.localPosition, firePos.localPosition);
|
||||
if (Vector3.Distance(wrjs[i].transform.localPosition, firePos.localPosition) < limitDis)
|
||||
if (wrjs[i] != null)
|
||||
{
|
||||
if (wrj == null)
|
||||
wrj = wrjs[i];
|
||||
return;
|
||||
}
|
||||
else
|
||||
{
|
||||
wrj = null;
|
||||
dis = Vector3.Distance(wrjs[i].transform.localPosition, firePos.localPosition);
|
||||
if (Vector3.Distance(wrjs[i].transform.localPosition, firePos.localPosition) < limitDis)
|
||||
{
|
||||
if (wrj == null)
|
||||
{
|
||||
wrj = wrjs[i];
|
||||
}
|
||||
return;
|
||||
}
|
||||
else
|
||||
{
|
||||
wrj = null;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
private void OnFire()
|
||||
{
|
||||
|
||||
if (wrj != null)
|
||||
{
|
||||
if (wrj.transform.childCount == 0)
|
||||
if (wrjs.Count == 0)
|
||||
{
|
||||
CancelInvoke("OnFire");
|
||||
return;
|
||||
|
@ -49,6 +53,7 @@ public class HuoPaoController : MonoBehaviour
|
|||
GameObject fire = Instantiate(firePrefab);
|
||||
fire.transform.eulerAngles = firePos.eulerAngles;
|
||||
fire.transform.position = firePos.position;
|
||||
fire.GetComponent<BulletController>().huoPaoController = this;
|
||||
fire.GetComponent<BulletController>().SetBoolIsMove();
|
||||
//fire.transform.LookAt(wrj.transform.localPosition);
|
||||
}
|
||||
|
|
|
@ -21,7 +21,7 @@ public class ToolsBootstrap : MonoBehaviour
|
|||
public WRJManager wrjManager;
|
||||
|
||||
public GameObject buleInstruct;
|
||||
public List<GameObject> lines = new List<GameObject>();
|
||||
public List<GameObject> instructs = new List<GameObject>();
|
||||
|
||||
public bool isDistance = true;
|
||||
|
||||
|
@ -70,27 +70,41 @@ public class ToolsBootstrap : MonoBehaviour
|
|||
|
||||
public void Switch2DModel(bool isActive)
|
||||
{
|
||||
if (lines.Count == 0) return;
|
||||
for (int i = 0; i < lines.Count; i++)
|
||||
if (instructs.Count == 0) return;
|
||||
for (int i = 0; i < instructs.Count; i++)
|
||||
{
|
||||
if (lines[i].gameObject)
|
||||
lines[i].gameObject.SetActive(isActive);
|
||||
if (instructs[i].gameObject)
|
||||
instructs[i].gameObject.SetActive(isActive);
|
||||
}
|
||||
}
|
||||
|
||||
public void SetMove()
|
||||
public void SetAttackTargetView()
|
||||
{
|
||||
for (int i = 0; i < wrjManager.wRJControllers.Count; i++)
|
||||
{
|
||||
wrjManager.wRJControllers[i].isMove = true;
|
||||
}
|
||||
//wrjManager.currentWRJ.isMove = true;
|
||||
simpleCameraController.enabled = false;
|
||||
mCamera.transform.position = new Vector3(114.282f, 305.2f, -95.7f);
|
||||
mCamera.transform.eulerAngles = new Vector3(45.8f, -13f, 0f);
|
||||
mCamera.orthographic = false;
|
||||
tapGesture.SetLayerMask(1 << 10);
|
||||
wrjManager.currentWRJ.isAuto = false;
|
||||
wrjManager.wrjMenuSetPanel.gameObject.SetActive(false);
|
||||
simpleCameraController.enabled = true;
|
||||
}
|
||||
|
||||
private void Update()
|
||||
{
|
||||
_fsm.Update();
|
||||
|
||||
if (Input.GetMouseButtonDown(0))
|
||||
{
|
||||
if (tapGesture.HitTest().collider != null)
|
||||
{
|
||||
if (tapGesture.HitTest().collider.gameObject.layer == 10)
|
||||
{
|
||||
|
||||
wrjManager.currentWRJ.SetAttackTarget(tapGesture.HitTest().collider.gameObject.GetComponent<HuoPaoController>());
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public void SwitchState(int indexState)
|
||||
|
@ -118,6 +132,7 @@ public class ToolsBootstrap : MonoBehaviour
|
|||
isDistance = false;
|
||||
_fsm.SetState(StateName.line);
|
||||
SwitchSet2DMap(2);
|
||||
wrjManager.currentWRJ.isAuto = true;
|
||||
wrjManager.wrjMenuSetPanel.gameObject.SetActive(false);
|
||||
}
|
||||
|
||||
|
@ -129,7 +144,7 @@ public class ToolsBootstrap : MonoBehaviour
|
|||
//wrjManager.currentWRJ.isMove = true;
|
||||
for (int i = 0; i < wrjManager.wRJControllers.Count; i++)
|
||||
{
|
||||
wrjManager.wRJControllers[i].isMove = true;
|
||||
wrjManager.wRJControllers[i].SetMove();
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -8,12 +8,15 @@ public class WRJController : MonoBehaviour
|
|||
public int index1 = 0;
|
||||
public float speed;
|
||||
public HuoPaoController[] huoPaoControllerList;
|
||||
public List<HuoPaoController> attackTarget = new List<HuoPaoController>();
|
||||
public bool isMove = false;
|
||||
public float dis;
|
||||
public float limitDis;
|
||||
public Transform firePos;
|
||||
public GameObject firePrefab;
|
||||
public bool isGoToPlace = false;
|
||||
public bool isAuto = false;
|
||||
public int fireCount;
|
||||
// Start is called before the first frame update
|
||||
void Start()
|
||||
{
|
||||
|
@ -23,7 +26,7 @@ public class WRJController : MonoBehaviour
|
|||
// Update is called once per frame
|
||||
void Update()
|
||||
{
|
||||
if (wayPoints.Count == 0) return;
|
||||
|
||||
if (isMove)
|
||||
{
|
||||
MoveToway1();
|
||||
|
@ -38,6 +41,9 @@ public class WRJController : MonoBehaviour
|
|||
|
||||
public void MoveToway1()
|
||||
{
|
||||
//if (isAuto)
|
||||
//{
|
||||
if (wayPoints.Count == 0) return;
|
||||
if (index1 > wayPoints.Count - 1) { return; }
|
||||
transform.localPosition = Vector3.MoveTowards(transform.localPosition, wayPoints[index1], speed * Time.deltaTime);
|
||||
if (Vector3.Distance(wayPoints[index1], transform.localPosition) < 0.01f)
|
||||
|
@ -51,34 +57,96 @@ public class WRJController : MonoBehaviour
|
|||
isMove = false;
|
||||
}
|
||||
}
|
||||
//}
|
||||
//else
|
||||
//{
|
||||
// if (index1 > attackTarget.Count - 1) { return; }
|
||||
// transform.localPosition = Vector3.MoveTowards(transform.localPosition, new Vector3(attackTarget[index1].transform.localPosition.x, attackTarget[index1].transform.localPosition.y + 180f, attackTarget[index1].transform.localPosition.z), speed * Time.deltaTime);
|
||||
// if (Vector3.Distance(attackTarget[index1].transform.localPosition, transform.localPosition) < 0.01f)
|
||||
// {
|
||||
// index1++;
|
||||
// if (index1 == attackTarget.Count)
|
||||
// {
|
||||
// transform.localPosition = attackTarget[index1 - 1].transform.localPosition;
|
||||
// isGoToPlace = true;
|
||||
// isMove = false;
|
||||
// }
|
||||
// }
|
||||
//}
|
||||
}
|
||||
|
||||
public void SetAttackTarget(HuoPaoController target)
|
||||
{
|
||||
if (!attackTarget.Contains(target))
|
||||
attackTarget.Add(target);
|
||||
|
||||
}
|
||||
|
||||
public void SetMove()
|
||||
{
|
||||
isMove = true;
|
||||
if (!isAuto)
|
||||
{
|
||||
wayPoints.Clear();
|
||||
wayPoints.Add(new Vector3(-132.7299f, 149.0329f, -309.2459f));
|
||||
wayPoints.Add(new Vector3(-98.94415f, 188.4612f, -219.9548f));
|
||||
wayPoints.Add(new Vector3(-69.9848f, 212.5105f, -145.1433f));
|
||||
wayPoints.Add(new Vector3(-2.413391f, 201.8178f, -24.47968f));
|
||||
wayPoints.Add(new Vector3(48f, 191.4619f, 47f));
|
||||
}
|
||||
}
|
||||
|
||||
public int currentHuoPaoIndex = 0;
|
||||
private void OnFire()
|
||||
{
|
||||
//for (int i = 0; i < huoPaoControllerList.Length; i++)
|
||||
//{
|
||||
|
||||
if (currentHuoPaoIndex > huoPaoControllerList.Length - 1)
|
||||
if (fireCount <= 0) return;
|
||||
if (isAuto)
|
||||
{
|
||||
CancelInvoke("OnFire");
|
||||
return;
|
||||
}
|
||||
if (currentHuoPaoIndex >= huoPaoControllerList.Length - 1)
|
||||
{
|
||||
CancelInvoke("OnFire");
|
||||
return;
|
||||
}
|
||||
|
||||
if (huoPaoControllerList[currentHuoPaoIndex] == null)
|
||||
if (huoPaoControllerList[currentHuoPaoIndex] == null)
|
||||
{
|
||||
currentHuoPaoIndex++;
|
||||
}
|
||||
|
||||
if (firePos != null)
|
||||
{
|
||||
firePos.LookAt(huoPaoControllerList[currentHuoPaoIndex].transform.position);
|
||||
GameObject fire = Instantiate(firePrefab);
|
||||
fire.transform.eulerAngles = firePos.eulerAngles;
|
||||
fire.transform.position = firePos.position;
|
||||
fire.GetComponent<BulletController>().SetBoolIsMove();
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
currentHuoPaoIndex++;
|
||||
}
|
||||
if (currentHuoPaoIndex >= attackTarget.Count - 1)
|
||||
{
|
||||
CancelInvoke("OnFire");
|
||||
return;
|
||||
}
|
||||
|
||||
if (firePos != null)
|
||||
{
|
||||
firePos.LookAt(huoPaoControllerList[currentHuoPaoIndex].transform.position);
|
||||
GameObject fire = Instantiate(firePrefab);
|
||||
fire.transform.eulerAngles = firePos.eulerAngles;
|
||||
fire.transform.position = firePos.position;
|
||||
fire.GetComponent<BulletController>().SetBoolIsMove();
|
||||
}
|
||||
if (attackTarget[currentHuoPaoIndex] == null)
|
||||
{
|
||||
currentHuoPaoIndex++;
|
||||
}
|
||||
|
||||
//}
|
||||
//fire.transform.LookAt(wrj.transform.localPosition);
|
||||
if (firePos != null)
|
||||
{
|
||||
firePos.LookAt(attackTarget[currentHuoPaoIndex].transform.position);
|
||||
GameObject fire = Instantiate(firePrefab);
|
||||
fire.transform.eulerAngles = firePos.eulerAngles;
|
||||
fire.transform.position = firePos.position;
|
||||
fire.GetComponent<BulletController>().SetBoolIsMove();
|
||||
}
|
||||
}
|
||||
fireCount--;
|
||||
}
|
||||
}
|
||||
|
|
|
@ -13,6 +13,7 @@ namespace Assets.Zion.Scripts.Adam
|
|||
public WRJController currentWRJ;
|
||||
public RectTransform wrjMenuSetPanel;
|
||||
public RectTransform canvasRect;
|
||||
|
||||
private void Start()
|
||||
{
|
||||
wrjMenuSetPanel.gameObject.SetActive(false);
|
||||
|
@ -28,7 +29,8 @@ namespace Assets.Zion.Scripts.Adam
|
|||
{
|
||||
Debug.Log("daadad");
|
||||
currentWRJ = hitInfo.collider.GetComponent<WRJController>();
|
||||
wRJControllers.Add(currentWRJ);
|
||||
if (!wRJControllers.Contains(currentWRJ))
|
||||
wRJControllers.Add(currentWRJ);
|
||||
wrjMenuSetPanel.gameObject.SetActive(true);
|
||||
Vector3 posItem = GetScreenPosition(hitInfo.collider.gameObject);
|
||||
wrjMenuSetPanel.anchoredPosition = new Vector3(posItem.x + 100f, posItem.y, posItem.z);
|
||||
|
@ -38,6 +40,7 @@ namespace Assets.Zion.Scripts.Adam
|
|||
wrjMenuSetPanel.gameObject.SetActive(false);
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
public Vector3 GetScreenPosition(GameObject target)
|
||||
|
|
|
@ -3,6 +3,7 @@
|
|||
"com.unity.collab-proxy": "1.2.16",
|
||||
"com.unity.ide.rider": "1.1.4",
|
||||
"com.unity.ide.vscode": "1.2.1",
|
||||
"com.unity.postprocessing": "2.3.0",
|
||||
"com.unity.test-framework": "1.1.16",
|
||||
"com.unity.textmeshpro": "2.1.1",
|
||||
"com.unity.timeline": "1.2.16",
|
||||
|
|
|
@ -30,6 +30,13 @@
|
|||
"dependencies": {},
|
||||
"url": "https://packages.unity.com"
|
||||
},
|
||||
"com.unity.postprocessing": {
|
||||
"version": "2.3.0",
|
||||
"depth": 0,
|
||||
"source": "registry",
|
||||
"dependencies": {},
|
||||
"url": "https://packages.unity.com"
|
||||
},
|
||||
"com.unity.test-framework": {
|
||||
"version": "1.1.16",
|
||||
"depth": 0,
|
||||
|
|
|
@ -573,7 +573,19 @@ PlayerSettings:
|
|||
webGLLinkerTarget: 1
|
||||
webGLThreadsSupport: 0
|
||||
webGLWasmStreaming: 0
|
||||
scriptingDefineSymbols: {}
|
||||
scriptingDefineSymbols:
|
||||
1: UNITY_POST_PROCESSING_STACK_V2
|
||||
4: UNITY_POST_PROCESSING_STACK_V2
|
||||
7: UNITY_POST_PROCESSING_STACK_V2
|
||||
13: UNITY_POST_PROCESSING_STACK_V2
|
||||
14: UNITY_POST_PROCESSING_STACK_V2
|
||||
19: UNITY_POST_PROCESSING_STACK_V2
|
||||
21: UNITY_POST_PROCESSING_STACK_V2
|
||||
25: UNITY_POST_PROCESSING_STACK_V2
|
||||
27: UNITY_POST_PROCESSING_STACK_V2
|
||||
28: UNITY_POST_PROCESSING_STACK_V2
|
||||
29: UNITY_POST_PROCESSING_STACK_V2
|
||||
30: UNITY_POST_PROCESSING_STACK_V2
|
||||
platformArchitecture: {}
|
||||
scriptingBackend: {}
|
||||
il2cppCompilerConfiguration: {}
|
||||
|
|
|
@ -202,7 +202,7 @@ QualitySettings:
|
|||
textureQuality: 0
|
||||
anisotropicTextures: 2
|
||||
antiAliasing: 0
|
||||
softParticles: 1
|
||||
softParticles: 0
|
||||
softVegetation: 1
|
||||
realtimeReflectionProbes: 1
|
||||
billboardsFaceCameraPosition: 1
|
||||
|
|
|
@ -14,9 +14,9 @@ TagManager:
|
|||
- UI
|
||||
-
|
||||
-
|
||||
-
|
||||
-
|
||||
-
|
||||
- Ground
|
||||
- WRJ
|
||||
- HuoPao
|
||||
-
|
||||
-
|
||||
-
|
||||
|
|
Loading…
Reference in New Issue