完成编队 增加多个细节和小功能
This commit is contained in:
@@ -0,0 +1,8 @@
|
||||
fileFormatVersion: 2
|
||||
guid: b16b62c0c52758c4785b56fb1ffad1c5
|
||||
folderAsset: yes
|
||||
DefaultImporter:
|
||||
externalObjects: {}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
@@ -0,0 +1,157 @@
|
||||
#if UNITY_EDITOR
|
||||
using System.Collections.Generic;
|
||||
using System.Text.RegularExpressions;
|
||||
using UnityEditor;
|
||||
using UnityEngine;
|
||||
|
||||
namespace SmoothShakeFree
|
||||
{
|
||||
public static class EditorUtility
|
||||
{
|
||||
#if UNITY_2020
|
||||
public static Color SmoothShakeFreeColor = new Color(0.78f, 0.78f, 0.78f);
|
||||
#else
|
||||
public static Color SmoothShakeFreeColor = new(0.78f, 0.78f, 0.78f);
|
||||
#endif
|
||||
|
||||
public static void DrawTitle(string title)
|
||||
{
|
||||
//-------------------------------------------
|
||||
// Create a custom GUIStyle
|
||||
GUIStyle titleStyle = new GUIStyle(EditorStyles.boldLabel);
|
||||
titleStyle.fontSize = 18; // Adjust the font size as needed
|
||||
titleStyle.fontStyle = FontStyle.Bold;
|
||||
titleStyle.alignment = TextAnchor.MiddleCenter;
|
||||
//-------------------------------------------
|
||||
|
||||
EditorGUILayout.LabelField(title, titleStyle);
|
||||
EditorGUILayout.GetControlRect(false, 10);
|
||||
}
|
||||
|
||||
public static void DrawUILine(Color color, int thickness = 2, int padding = 10)
|
||||
{
|
||||
Rect r = EditorGUILayout.GetControlRect(GUILayout.Height(padding + thickness));
|
||||
r.height = thickness;
|
||||
r.y += padding / 2;
|
||||
r.x -= 2;
|
||||
r.width += 6;
|
||||
EditorGUI.DrawRect(r, color);
|
||||
}
|
||||
|
||||
public static void DisplaySerializedProperties(SerializedObject obj, params string[] properties)
|
||||
{
|
||||
foreach (string property in properties)
|
||||
{
|
||||
SerializedProperty myDataProperty = obj.FindProperty(property);
|
||||
if (myDataProperty == null)
|
||||
{
|
||||
Debug.LogError("Property '" + property + "' not found!");
|
||||
continue;
|
||||
}
|
||||
EditorGUILayout.PropertyField(myDataProperty, true);
|
||||
obj.ApplyModifiedProperties();
|
||||
}
|
||||
}
|
||||
|
||||
public static void DrawSerializedProperties(SerializedProperty property, ref Rect position, float padding, params string[] properties)
|
||||
{
|
||||
for (int i = 0; i < properties.Length; i++)
|
||||
{
|
||||
SerializedProperty newProperty = property.FindPropertyRelative(properties[i]);
|
||||
|
||||
if (newProperty == null)
|
||||
Debug.LogError("Property '" + properties[i] + "' not found!");
|
||||
|
||||
float propertyHeight = EditorGUI.GetPropertyHeight(newProperty);
|
||||
Rect fieldRect = new Rect(position.x, position.y, position.width, propertyHeight);
|
||||
EditorGUI.PropertyField(fieldRect, newProperty);
|
||||
position.y += propertyHeight + padding;
|
||||
}
|
||||
}
|
||||
|
||||
public static string AddSpacesToSentence(string text, bool preserveAcronyms = true)
|
||||
{
|
||||
if (string.IsNullOrWhiteSpace(text))
|
||||
return string.Empty;
|
||||
string newText = Regex.Replace(text, "([a-z])([A-Z])", "$1 $2");
|
||||
if (preserveAcronyms)
|
||||
{
|
||||
newText = Regex.Replace(newText, "([A-Z])([A-Z][a-z])", "$1 $2");
|
||||
}
|
||||
return newText;
|
||||
}
|
||||
|
||||
public static void DrawPropertiesHorizontally(SerializedProperty property, ref Rect position, string label, float padding, float minWidth, float[] weight, params string[] properties)
|
||||
{
|
||||
if (position.width < 5) return;
|
||||
|
||||
Rect[] rects = new Rect[properties.Length];
|
||||
|
||||
float[] minWidths = new float[properties.Length];
|
||||
for (int i = 0; i < minWidths.Length; i++) minWidths[i] = minWidth;
|
||||
|
||||
Rect rect = new Rect(position.x, position.y, position.width, EditorGUIUtility.singleLineHeight);
|
||||
SplitRectsHorizontally(rect, padding, minWidths, weight, ref rects);
|
||||
|
||||
for (int i = 0; i < properties.Length; i++)
|
||||
{
|
||||
if (i == 0) EditorGUI.PropertyField(rects[0], property.FindPropertyRelative(properties[0]), new GUIContent(label));
|
||||
else EditorGUI.PropertyField(rects[i], property.FindPropertyRelative(properties[i]), GUIContent.none);
|
||||
}
|
||||
position.y += EditorGUIUtility.singleLineHeight + padding;
|
||||
}
|
||||
|
||||
public static void DrawDropdown(SerializedProperty property, ref Rect position, float padding, string label, string propertypath)
|
||||
{
|
||||
float dropdownHeight = EditorGUI.GetPropertyHeight(property.FindPropertyRelative(propertypath));
|
||||
Rect dropdownRect = new Rect(position.x, position.y, position.width, dropdownHeight);
|
||||
EditorGUI.PropertyField(dropdownRect, property.FindPropertyRelative(propertypath), new GUIContent(label));
|
||||
position.y += dropdownHeight + padding;
|
||||
}
|
||||
|
||||
public static bool ThinView(float viewWidth = 330f)
|
||||
{
|
||||
if (EditorGUIUtility.currentViewWidth > viewWidth)
|
||||
return false;
|
||||
else
|
||||
return true;
|
||||
}
|
||||
|
||||
|
||||
//------------------
|
||||
//Credit for this section goes to Wessel van der Es
|
||||
public static void SplitRectsHorizontally(this Rect rect, float space, float[] minWidths, float[] weights, ref Rect[] rects)
|
||||
{
|
||||
int count = weights.Length;
|
||||
|
||||
float budget = rect.width - (count - 1) * space - minWidths.Sum();
|
||||
float totalWeight = weights.Sum();
|
||||
|
||||
float offset = 0.0f;
|
||||
float error = 0.0f;
|
||||
for (int i = 0; i < count; i++)
|
||||
{
|
||||
rects[i] = rect;
|
||||
rects[i].x += offset;
|
||||
rects[i].width = minWidths[i] + weights[i] / totalWeight * budget + error;
|
||||
|
||||
float rounded = Mathf.Round(rects[i].width);
|
||||
error = rects[i].width - rounded;
|
||||
rects[i].width = rounded;
|
||||
|
||||
offset += rects[i].width + space;
|
||||
}
|
||||
}
|
||||
|
||||
public static float Sum(this IEnumerable<float> numbers)
|
||||
{
|
||||
float sum = 0.0f;
|
||||
foreach (float number in numbers)
|
||||
sum += number;
|
||||
return sum;
|
||||
}
|
||||
//------------------
|
||||
}
|
||||
|
||||
}
|
||||
#endif
|
||||
@@ -0,0 +1,18 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 0cd3d6475f5fc654b8f15e75e854c3e1
|
||||
MonoImporter:
|
||||
externalObjects: {}
|
||||
serializedVersion: 2
|
||||
defaultReferences: []
|
||||
executionOrder: 0
|
||||
icon: {fileID: 2800000, guid: ce2446e8e0ad47b4c8554496daa9625e, type: 3}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
AssetOrigin:
|
||||
serializedVersion: 1
|
||||
productId: 271263
|
||||
packageName: Smooth Shake Free
|
||||
packageVersion: 1.0.2
|
||||
assetPath: Assets/SmoothShakeFree/Data/Editor/EditorUtility.cs
|
||||
uploadId: 656168
|
||||
@@ -0,0 +1,8 @@
|
||||
fileFormatVersion: 2
|
||||
guid: f7466c00f029c2e46aa5ba478ff9ae38
|
||||
folderAsset: yes
|
||||
DefaultImporter:
|
||||
externalObjects: {}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
Binary file not shown.
|
After Width: | Height: | Size: 11 KiB |
@@ -0,0 +1,134 @@
|
||||
fileFormatVersion: 2
|
||||
guid: ce2446e8e0ad47b4c8554496daa9625e
|
||||
TextureImporter:
|
||||
internalIDToNameTable: []
|
||||
externalObjects: {}
|
||||
serializedVersion: 12
|
||||
mipmaps:
|
||||
mipMapMode: 0
|
||||
enableMipMap: 1
|
||||
sRGBTexture: 1
|
||||
linearTexture: 0
|
||||
fadeOut: 0
|
||||
borderMipMap: 0
|
||||
mipMapsPreserveCoverage: 0
|
||||
alphaTestReferenceValue: 0.5
|
||||
mipMapFadeDistanceStart: 1
|
||||
mipMapFadeDistanceEnd: 3
|
||||
bumpmap:
|
||||
convertToNormalMap: 0
|
||||
externalNormalMap: 0
|
||||
heightScale: 0.25
|
||||
normalMapFilter: 0
|
||||
flipGreenChannel: 0
|
||||
isReadable: 0
|
||||
streamingMipmaps: 0
|
||||
streamingMipmapsPriority: 0
|
||||
vTOnly: 0
|
||||
ignoreMipmapLimit: 0
|
||||
grayScaleToAlpha: 0
|
||||
generateCubemap: 6
|
||||
cubemapConvolution: 0
|
||||
seamlessCubemap: 0
|
||||
textureFormat: 1
|
||||
maxTextureSize: 2048
|
||||
textureSettings:
|
||||
serializedVersion: 2
|
||||
filterMode: 1
|
||||
aniso: 1
|
||||
mipBias: 0
|
||||
wrapU: 0
|
||||
wrapV: 0
|
||||
wrapW: 0
|
||||
nPOTScale: 1
|
||||
lightmap: 0
|
||||
compressionQuality: 50
|
||||
spriteMode: 0
|
||||
spriteExtrude: 1
|
||||
spriteMeshType: 1
|
||||
alignment: 0
|
||||
spritePivot: {x: 0.5, y: 0.5}
|
||||
spritePixelsToUnits: 100
|
||||
spriteBorder: {x: 0, y: 0, z: 0, w: 0}
|
||||
spriteGenerateFallbackPhysicsShape: 1
|
||||
alphaUsage: 1
|
||||
alphaIsTransparency: 1
|
||||
spriteTessellationDetail: -1
|
||||
textureType: 0
|
||||
textureShape: 1
|
||||
singleChannelComponent: 0
|
||||
flipbookRows: 1
|
||||
flipbookColumns: 1
|
||||
maxTextureSizeSet: 0
|
||||
compressionQualitySet: 0
|
||||
textureFormatSet: 0
|
||||
ignorePngGamma: 0
|
||||
applyGammaDecoding: 0
|
||||
swizzle: 50462976
|
||||
cookieLightType: 0
|
||||
platformSettings:
|
||||
- serializedVersion: 3
|
||||
buildTarget: DefaultTexturePlatform
|
||||
maxTextureSize: 2048
|
||||
resizeAlgorithm: 0
|
||||
textureFormat: -1
|
||||
textureCompression: 1
|
||||
compressionQuality: 50
|
||||
crunchedCompression: 0
|
||||
allowsAlphaSplitting: 0
|
||||
overridden: 0
|
||||
ignorePlatformSupport: 0
|
||||
androidETC2FallbackOverride: 0
|
||||
forceMaximumCompressionQuality_BC6H_BC7: 0
|
||||
- serializedVersion: 3
|
||||
buildTarget: Standalone
|
||||
maxTextureSize: 2048
|
||||
resizeAlgorithm: 0
|
||||
textureFormat: -1
|
||||
textureCompression: 1
|
||||
compressionQuality: 50
|
||||
crunchedCompression: 0
|
||||
allowsAlphaSplitting: 0
|
||||
overridden: 0
|
||||
ignorePlatformSupport: 0
|
||||
androidETC2FallbackOverride: 0
|
||||
forceMaximumCompressionQuality_BC6H_BC7: 0
|
||||
- serializedVersion: 3
|
||||
buildTarget: Server
|
||||
maxTextureSize: 2048
|
||||
resizeAlgorithm: 0
|
||||
textureFormat: -1
|
||||
textureCompression: 1
|
||||
compressionQuality: 50
|
||||
crunchedCompression: 0
|
||||
allowsAlphaSplitting: 0
|
||||
overridden: 0
|
||||
ignorePlatformSupport: 0
|
||||
androidETC2FallbackOverride: 0
|
||||
forceMaximumCompressionQuality_BC6H_BC7: 0
|
||||
spriteSheet:
|
||||
serializedVersion: 2
|
||||
sprites: []
|
||||
outline: []
|
||||
physicsShape: []
|
||||
bones: []
|
||||
spriteID:
|
||||
internalID: 0
|
||||
vertices: []
|
||||
indices:
|
||||
edges: []
|
||||
weights: []
|
||||
secondaryTextures: []
|
||||
nameFileIdTable: {}
|
||||
mipmapLimitGroupName:
|
||||
pSDRemoveMatte: 0
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
AssetOrigin:
|
||||
serializedVersion: 1
|
||||
productId: 271263
|
||||
packageName: Smooth Shake Free
|
||||
packageVersion: 1.0.2
|
||||
assetPath: Assets/SmoothShakeFree/Data/Editor/Icons/Icon_Default.png
|
||||
uploadId: 656168
|
||||
Binary file not shown.
|
After Width: | Height: | Size: 6.7 KiB |
@@ -0,0 +1,134 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 78fc80bb49a6807458a322585a480e98
|
||||
TextureImporter:
|
||||
internalIDToNameTable: []
|
||||
externalObjects: {}
|
||||
serializedVersion: 12
|
||||
mipmaps:
|
||||
mipMapMode: 0
|
||||
enableMipMap: 1
|
||||
sRGBTexture: 1
|
||||
linearTexture: 0
|
||||
fadeOut: 0
|
||||
borderMipMap: 0
|
||||
mipMapsPreserveCoverage: 0
|
||||
alphaTestReferenceValue: 0.5
|
||||
mipMapFadeDistanceStart: 1
|
||||
mipMapFadeDistanceEnd: 3
|
||||
bumpmap:
|
||||
convertToNormalMap: 0
|
||||
externalNormalMap: 0
|
||||
heightScale: 0.25
|
||||
normalMapFilter: 0
|
||||
flipGreenChannel: 0
|
||||
isReadable: 0
|
||||
streamingMipmaps: 0
|
||||
streamingMipmapsPriority: 0
|
||||
vTOnly: 0
|
||||
ignoreMipmapLimit: 0
|
||||
grayScaleToAlpha: 0
|
||||
generateCubemap: 6
|
||||
cubemapConvolution: 0
|
||||
seamlessCubemap: 0
|
||||
textureFormat: 1
|
||||
maxTextureSize: 2048
|
||||
textureSettings:
|
||||
serializedVersion: 2
|
||||
filterMode: 1
|
||||
aniso: 1
|
||||
mipBias: 0
|
||||
wrapU: 0
|
||||
wrapV: 0
|
||||
wrapW: 0
|
||||
nPOTScale: 1
|
||||
lightmap: 0
|
||||
compressionQuality: 50
|
||||
spriteMode: 0
|
||||
spriteExtrude: 1
|
||||
spriteMeshType: 1
|
||||
alignment: 0
|
||||
spritePivot: {x: 0.5, y: 0.5}
|
||||
spritePixelsToUnits: 100
|
||||
spriteBorder: {x: 0, y: 0, z: 0, w: 0}
|
||||
spriteGenerateFallbackPhysicsShape: 1
|
||||
alphaUsage: 1
|
||||
alphaIsTransparency: 1
|
||||
spriteTessellationDetail: -1
|
||||
textureType: 0
|
||||
textureShape: 1
|
||||
singleChannelComponent: 0
|
||||
flipbookRows: 1
|
||||
flipbookColumns: 1
|
||||
maxTextureSizeSet: 0
|
||||
compressionQualitySet: 0
|
||||
textureFormatSet: 0
|
||||
ignorePngGamma: 0
|
||||
applyGammaDecoding: 0
|
||||
swizzle: 50462976
|
||||
cookieLightType: 0
|
||||
platformSettings:
|
||||
- serializedVersion: 3
|
||||
buildTarget: DefaultTexturePlatform
|
||||
maxTextureSize: 2048
|
||||
resizeAlgorithm: 0
|
||||
textureFormat: -1
|
||||
textureCompression: 1
|
||||
compressionQuality: 50
|
||||
crunchedCompression: 0
|
||||
allowsAlphaSplitting: 0
|
||||
overridden: 0
|
||||
ignorePlatformSupport: 0
|
||||
androidETC2FallbackOverride: 0
|
||||
forceMaximumCompressionQuality_BC6H_BC7: 0
|
||||
- serializedVersion: 3
|
||||
buildTarget: Standalone
|
||||
maxTextureSize: 2048
|
||||
resizeAlgorithm: 0
|
||||
textureFormat: -1
|
||||
textureCompression: 1
|
||||
compressionQuality: 50
|
||||
crunchedCompression: 0
|
||||
allowsAlphaSplitting: 0
|
||||
overridden: 0
|
||||
ignorePlatformSupport: 0
|
||||
androidETC2FallbackOverride: 0
|
||||
forceMaximumCompressionQuality_BC6H_BC7: 0
|
||||
- serializedVersion: 3
|
||||
buildTarget: Server
|
||||
maxTextureSize: 2048
|
||||
resizeAlgorithm: 0
|
||||
textureFormat: -1
|
||||
textureCompression: 1
|
||||
compressionQuality: 50
|
||||
crunchedCompression: 0
|
||||
allowsAlphaSplitting: 0
|
||||
overridden: 0
|
||||
ignorePlatformSupport: 0
|
||||
androidETC2FallbackOverride: 0
|
||||
forceMaximumCompressionQuality_BC6H_BC7: 0
|
||||
spriteSheet:
|
||||
serializedVersion: 2
|
||||
sprites: []
|
||||
outline: []
|
||||
physicsShape: []
|
||||
bones: []
|
||||
spriteID:
|
||||
internalID: 0
|
||||
vertices: []
|
||||
indices:
|
||||
edges: []
|
||||
weights: []
|
||||
secondaryTextures: []
|
||||
nameFileIdTable: {}
|
||||
mipmapLimitGroupName:
|
||||
pSDRemoveMatte: 0
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
AssetOrigin:
|
||||
serializedVersion: 1
|
||||
productId: 271263
|
||||
packageName: Smooth Shake Free
|
||||
packageVersion: 1.0.2
|
||||
assetPath: Assets/SmoothShakeFree/Data/Editor/Icons/Icon_Default_base.png
|
||||
uploadId: 656168
|
||||
Binary file not shown.
|
After Width: | Height: | Size: 6.6 KiB |
@@ -0,0 +1,134 @@
|
||||
fileFormatVersion: 2
|
||||
guid: cda6f08464b9f844c82e8ff0b03d06be
|
||||
TextureImporter:
|
||||
internalIDToNameTable: []
|
||||
externalObjects: {}
|
||||
serializedVersion: 12
|
||||
mipmaps:
|
||||
mipMapMode: 0
|
||||
enableMipMap: 1
|
||||
sRGBTexture: 1
|
||||
linearTexture: 0
|
||||
fadeOut: 0
|
||||
borderMipMap: 0
|
||||
mipMapsPreserveCoverage: 0
|
||||
alphaTestReferenceValue: 0.5
|
||||
mipMapFadeDistanceStart: 1
|
||||
mipMapFadeDistanceEnd: 3
|
||||
bumpmap:
|
||||
convertToNormalMap: 0
|
||||
externalNormalMap: 0
|
||||
heightScale: 0.25
|
||||
normalMapFilter: 0
|
||||
flipGreenChannel: 0
|
||||
isReadable: 0
|
||||
streamingMipmaps: 0
|
||||
streamingMipmapsPriority: 0
|
||||
vTOnly: 0
|
||||
ignoreMipmapLimit: 0
|
||||
grayScaleToAlpha: 0
|
||||
generateCubemap: 6
|
||||
cubemapConvolution: 0
|
||||
seamlessCubemap: 0
|
||||
textureFormat: 1
|
||||
maxTextureSize: 2048
|
||||
textureSettings:
|
||||
serializedVersion: 2
|
||||
filterMode: 1
|
||||
aniso: 1
|
||||
mipBias: 0
|
||||
wrapU: 0
|
||||
wrapV: 0
|
||||
wrapW: 0
|
||||
nPOTScale: 1
|
||||
lightmap: 0
|
||||
compressionQuality: 50
|
||||
spriteMode: 0
|
||||
spriteExtrude: 1
|
||||
spriteMeshType: 1
|
||||
alignment: 0
|
||||
spritePivot: {x: 0.5, y: 0.5}
|
||||
spritePixelsToUnits: 100
|
||||
spriteBorder: {x: 0, y: 0, z: 0, w: 0}
|
||||
spriteGenerateFallbackPhysicsShape: 1
|
||||
alphaUsage: 1
|
||||
alphaIsTransparency: 1
|
||||
spriteTessellationDetail: -1
|
||||
textureType: 0
|
||||
textureShape: 1
|
||||
singleChannelComponent: 0
|
||||
flipbookRows: 1
|
||||
flipbookColumns: 1
|
||||
maxTextureSizeSet: 0
|
||||
compressionQualitySet: 0
|
||||
textureFormatSet: 0
|
||||
ignorePngGamma: 0
|
||||
applyGammaDecoding: 0
|
||||
swizzle: 50462976
|
||||
cookieLightType: 0
|
||||
platformSettings:
|
||||
- serializedVersion: 3
|
||||
buildTarget: DefaultTexturePlatform
|
||||
maxTextureSize: 2048
|
||||
resizeAlgorithm: 0
|
||||
textureFormat: -1
|
||||
textureCompression: 1
|
||||
compressionQuality: 50
|
||||
crunchedCompression: 0
|
||||
allowsAlphaSplitting: 0
|
||||
overridden: 0
|
||||
ignorePlatformSupport: 0
|
||||
androidETC2FallbackOverride: 0
|
||||
forceMaximumCompressionQuality_BC6H_BC7: 0
|
||||
- serializedVersion: 3
|
||||
buildTarget: Standalone
|
||||
maxTextureSize: 2048
|
||||
resizeAlgorithm: 0
|
||||
textureFormat: -1
|
||||
textureCompression: 1
|
||||
compressionQuality: 50
|
||||
crunchedCompression: 0
|
||||
allowsAlphaSplitting: 0
|
||||
overridden: 0
|
||||
ignorePlatformSupport: 0
|
||||
androidETC2FallbackOverride: 0
|
||||
forceMaximumCompressionQuality_BC6H_BC7: 0
|
||||
- serializedVersion: 3
|
||||
buildTarget: Server
|
||||
maxTextureSize: 2048
|
||||
resizeAlgorithm: 0
|
||||
textureFormat: -1
|
||||
textureCompression: 1
|
||||
compressionQuality: 50
|
||||
crunchedCompression: 0
|
||||
allowsAlphaSplitting: 0
|
||||
overridden: 0
|
||||
ignorePlatformSupport: 0
|
||||
androidETC2FallbackOverride: 0
|
||||
forceMaximumCompressionQuality_BC6H_BC7: 0
|
||||
spriteSheet:
|
||||
serializedVersion: 2
|
||||
sprites: []
|
||||
outline: []
|
||||
physicsShape: []
|
||||
bones: []
|
||||
spriteID:
|
||||
internalID: 0
|
||||
vertices: []
|
||||
indices:
|
||||
edges: []
|
||||
weights: []
|
||||
secondaryTextures: []
|
||||
nameFileIdTable: {}
|
||||
mipmapLimitGroupName:
|
||||
pSDRemoveMatte: 0
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
AssetOrigin:
|
||||
serializedVersion: 1
|
||||
productId: 271263
|
||||
packageName: Smooth Shake Free
|
||||
packageVersion: 1.0.2
|
||||
assetPath: Assets/SmoothShakeFree/Data/Editor/Icons/Icon_SmoothShake_Base.png
|
||||
uploadId: 656168
|
||||
Binary file not shown.
|
After Width: | Height: | Size: 8.6 KiB |
@@ -0,0 +1,134 @@
|
||||
fileFormatVersion: 2
|
||||
guid: c0e8b27d7173b314fa78f14aa3686f8e
|
||||
TextureImporter:
|
||||
internalIDToNameTable: []
|
||||
externalObjects: {}
|
||||
serializedVersion: 12
|
||||
mipmaps:
|
||||
mipMapMode: 0
|
||||
enableMipMap: 1
|
||||
sRGBTexture: 1
|
||||
linearTexture: 0
|
||||
fadeOut: 0
|
||||
borderMipMap: 0
|
||||
mipMapsPreserveCoverage: 0
|
||||
alphaTestReferenceValue: 0.5
|
||||
mipMapFadeDistanceStart: 1
|
||||
mipMapFadeDistanceEnd: 3
|
||||
bumpmap:
|
||||
convertToNormalMap: 0
|
||||
externalNormalMap: 0
|
||||
heightScale: 0.25
|
||||
normalMapFilter: 0
|
||||
flipGreenChannel: 0
|
||||
isReadable: 0
|
||||
streamingMipmaps: 0
|
||||
streamingMipmapsPriority: 0
|
||||
vTOnly: 0
|
||||
ignoreMipmapLimit: 0
|
||||
grayScaleToAlpha: 0
|
||||
generateCubemap: 6
|
||||
cubemapConvolution: 0
|
||||
seamlessCubemap: 0
|
||||
textureFormat: 1
|
||||
maxTextureSize: 2048
|
||||
textureSettings:
|
||||
serializedVersion: 2
|
||||
filterMode: 1
|
||||
aniso: 1
|
||||
mipBias: 0
|
||||
wrapU: 0
|
||||
wrapV: 0
|
||||
wrapW: 0
|
||||
nPOTScale: 1
|
||||
lightmap: 0
|
||||
compressionQuality: 50
|
||||
spriteMode: 0
|
||||
spriteExtrude: 1
|
||||
spriteMeshType: 1
|
||||
alignment: 0
|
||||
spritePivot: {x: 0.5, y: 0.5}
|
||||
spritePixelsToUnits: 100
|
||||
spriteBorder: {x: 0, y: 0, z: 0, w: 0}
|
||||
spriteGenerateFallbackPhysicsShape: 1
|
||||
alphaUsage: 1
|
||||
alphaIsTransparency: 1
|
||||
spriteTessellationDetail: -1
|
||||
textureType: 0
|
||||
textureShape: 1
|
||||
singleChannelComponent: 0
|
||||
flipbookRows: 1
|
||||
flipbookColumns: 1
|
||||
maxTextureSizeSet: 0
|
||||
compressionQualitySet: 0
|
||||
textureFormatSet: 0
|
||||
ignorePngGamma: 0
|
||||
applyGammaDecoding: 0
|
||||
swizzle: 50462976
|
||||
cookieLightType: 0
|
||||
platformSettings:
|
||||
- serializedVersion: 3
|
||||
buildTarget: DefaultTexturePlatform
|
||||
maxTextureSize: 2048
|
||||
resizeAlgorithm: 0
|
||||
textureFormat: -1
|
||||
textureCompression: 1
|
||||
compressionQuality: 50
|
||||
crunchedCompression: 0
|
||||
allowsAlphaSplitting: 0
|
||||
overridden: 0
|
||||
ignorePlatformSupport: 0
|
||||
androidETC2FallbackOverride: 0
|
||||
forceMaximumCompressionQuality_BC6H_BC7: 0
|
||||
- serializedVersion: 3
|
||||
buildTarget: Standalone
|
||||
maxTextureSize: 2048
|
||||
resizeAlgorithm: 0
|
||||
textureFormat: -1
|
||||
textureCompression: 1
|
||||
compressionQuality: 50
|
||||
crunchedCompression: 0
|
||||
allowsAlphaSplitting: 0
|
||||
overridden: 0
|
||||
ignorePlatformSupport: 0
|
||||
androidETC2FallbackOverride: 0
|
||||
forceMaximumCompressionQuality_BC6H_BC7: 0
|
||||
- serializedVersion: 3
|
||||
buildTarget: Server
|
||||
maxTextureSize: 2048
|
||||
resizeAlgorithm: 0
|
||||
textureFormat: -1
|
||||
textureCompression: 1
|
||||
compressionQuality: 50
|
||||
crunchedCompression: 0
|
||||
allowsAlphaSplitting: 0
|
||||
overridden: 0
|
||||
ignorePlatformSupport: 0
|
||||
androidETC2FallbackOverride: 0
|
||||
forceMaximumCompressionQuality_BC6H_BC7: 0
|
||||
spriteSheet:
|
||||
serializedVersion: 2
|
||||
sprites: []
|
||||
outline: []
|
||||
physicsShape: []
|
||||
bones: []
|
||||
spriteID:
|
||||
internalID: 0
|
||||
vertices: []
|
||||
indices:
|
||||
edges: []
|
||||
weights: []
|
||||
secondaryTextures: []
|
||||
nameFileIdTable: {}
|
||||
mipmapLimitGroupName:
|
||||
pSDRemoveMatte: 0
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
AssetOrigin:
|
||||
serializedVersion: 1
|
||||
productId: 271263
|
||||
packageName: Smooth Shake Free
|
||||
packageVersion: 1.0.2
|
||||
assetPath: Assets/SmoothShakeFree/Data/Editor/Icons/Icon_SmoothShake_Preset.png
|
||||
uploadId: 656168
|
||||
@@ -0,0 +1,82 @@
|
||||
#if UNITY_EDITOR
|
||||
using UnityEditor;
|
||||
using UnityEngine;
|
||||
|
||||
namespace SmoothShakeFree
|
||||
{
|
||||
[CustomEditor(typeof(ShakeBase), true)]
|
||||
internal class ShakeBaseEditor : Editor
|
||||
{
|
||||
public override void OnInspectorGUI()
|
||||
{
|
||||
serializedObject.Update();
|
||||
|
||||
ShakeBase shakeBase = (ShakeBase)target;
|
||||
|
||||
EditorUtility.DrawTitle("Smooth Shake Free");
|
||||
EditorUtility.DrawUILine(EditorUtility.SmoothShakeFreeColor, 1, 10);
|
||||
|
||||
if(shakeBase is SmoothShake ssf)
|
||||
{
|
||||
DrawPresetInspector(ssf.preset, ssf);
|
||||
}
|
||||
|
||||
EditorUtility.DrawUILine(Color.gray, 1, 10);
|
||||
|
||||
//Draw test buttons
|
||||
DrawTestButtons(shakeBase);
|
||||
|
||||
|
||||
serializedObject.ApplyModifiedProperties();
|
||||
}
|
||||
|
||||
private void DrawPresetInspector(SmoothShakeFreePreset preset, ShakeBase shakeBase)
|
||||
{
|
||||
//Draw preset property
|
||||
EditorGUILayout.PropertyField(serializedObject.FindProperty("preset"), true);
|
||||
|
||||
if (preset)
|
||||
{
|
||||
if (!Application.isPlaying) shakeBase.ApplyPresetSettings(preset);
|
||||
|
||||
//Helpbox
|
||||
EditorGUILayout.HelpBox("This shake being overriden by " + preset.name, MessageType.Info);
|
||||
|
||||
EditorGUILayout.BeginHorizontal();
|
||||
{
|
||||
if (GUILayout.Button("Go To Preset"))
|
||||
{
|
||||
Selection.activeObject = preset;
|
||||
}
|
||||
|
||||
}
|
||||
EditorGUILayout.EndHorizontal();
|
||||
}
|
||||
else
|
||||
{
|
||||
DrawPropertiesExcluding(serializedObject, "m_Script", "preset");
|
||||
}
|
||||
}
|
||||
|
||||
void DrawTestButtons(ShakeBase shakeBase)
|
||||
{
|
||||
//Test start and stop buttons in horizontal
|
||||
EditorGUILayout.BeginHorizontal();
|
||||
{
|
||||
//Disable buttons in edit mode
|
||||
GUI.enabled = Application.isPlaying;
|
||||
if (GUILayout.Button("Test Shake"))
|
||||
shakeBase.StartShake();
|
||||
if (GUILayout.Button("Stop Test Shake"))
|
||||
shakeBase.StopShake();
|
||||
if (GUILayout.Button("Force Stop Test Shake"))
|
||||
shakeBase.ForceStop();
|
||||
}
|
||||
EditorGUILayout.EndHorizontal();
|
||||
|
||||
if (!GUI.enabled)
|
||||
EditorGUILayout.HelpBox("You can only test shakes play mode", MessageType.Info);
|
||||
}
|
||||
}
|
||||
}
|
||||
#endif
|
||||
@@ -0,0 +1,18 @@
|
||||
fileFormatVersion: 2
|
||||
guid: e6b6befad0fd07b4c9c0f9c06aa9dc23
|
||||
MonoImporter:
|
||||
externalObjects: {}
|
||||
serializedVersion: 2
|
||||
defaultReferences: []
|
||||
executionOrder: 0
|
||||
icon: {fileID: 2800000, guid: ce2446e8e0ad47b4c8554496daa9625e, type: 3}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
AssetOrigin:
|
||||
serializedVersion: 1
|
||||
productId: 271263
|
||||
packageName: Smooth Shake Free
|
||||
packageVersion: 1.0.2
|
||||
assetPath: Assets/SmoothShakeFree/Data/Editor/ShakeBaseEditor.cs
|
||||
uploadId: 656168
|
||||
@@ -0,0 +1,21 @@
|
||||
#if UNITY_EDITOR
|
||||
using UnityEditor;
|
||||
|
||||
namespace SmoothShakeFree
|
||||
{
|
||||
[CustomEditor(typeof(SmoothShakeFreePreset), true)]
|
||||
internal class ShakeBasePresetEditor : Editor
|
||||
{
|
||||
public override void OnInspectorGUI()
|
||||
{
|
||||
EditorUtility.DrawTitle("Smooth Shake Free");
|
||||
EditorUtility.DrawUILine(EditorUtility.SmoothShakeFreeColor, 1, 10);
|
||||
|
||||
serializedObject.Update();
|
||||
DrawPropertiesExcluding(serializedObject, "m_Script");
|
||||
serializedObject.ApplyModifiedProperties();
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
#endif
|
||||
@@ -0,0 +1,18 @@
|
||||
fileFormatVersion: 2
|
||||
guid: edf83b5628d981b41a75cf5009f1e4e6
|
||||
MonoImporter:
|
||||
externalObjects: {}
|
||||
serializedVersion: 2
|
||||
defaultReferences: []
|
||||
executionOrder: 0
|
||||
icon: {fileID: 2800000, guid: ce2446e8e0ad47b4c8554496daa9625e, type: 3}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
AssetOrigin:
|
||||
serializedVersion: 1
|
||||
productId: 271263
|
||||
packageName: Smooth Shake Free
|
||||
packageVersion: 1.0.2
|
||||
assetPath: Assets/SmoothShakeFree/Data/Editor/ShakeBasePresetEditor.cs
|
||||
uploadId: 656168
|
||||
@@ -0,0 +1,107 @@
|
||||
#if UNITY_EDITOR
|
||||
using UnityEditor;
|
||||
using UnityEngine;
|
||||
using System.Collections.Generic;
|
||||
using static SmoothShakeFree.Shaker;
|
||||
|
||||
namespace SmoothShakeFree
|
||||
{
|
||||
[CustomPropertyDrawer(typeof(Shaker))]
|
||||
internal class ShakerDrawer : PropertyDrawer
|
||||
{
|
||||
private readonly float padding = 2f;
|
||||
|
||||
//Init foldoutStates
|
||||
#if UNITY_2020
|
||||
private static Dictionary<string, bool> foldoutStates = new Dictionary<string, bool>();
|
||||
#else
|
||||
private static Dictionary<string, bool> foldoutStates = new();
|
||||
#endif
|
||||
|
||||
//-----------------------------------------------------------------------------------------
|
||||
//Noise type implementation
|
||||
|
||||
//Noise type variable setup
|
||||
private readonly string[] waveVariables = new string[] { "amplitude", "frequency" };
|
||||
private readonly string[] baseVariables = new string[] { "amplitude" };
|
||||
|
||||
public void DrawNoiseTypeSettings(Rect position, SerializedProperty property, NoiseType noiseType)
|
||||
{
|
||||
switch (noiseType)
|
||||
{
|
||||
case NoiseType.SineWave:
|
||||
EditorUtility.DrawSerializedProperties(property, ref position, padding, waveVariables);
|
||||
break;
|
||||
case NoiseType.WhiteNoise:
|
||||
EditorUtility.DrawSerializedProperties(property, ref position, padding, baseVariables);
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
public float GetPropertyAmount(NoiseType noiseType) => noiseType switch
|
||||
{
|
||||
NoiseType.SineWave => waveVariables.Length,
|
||||
NoiseType.WhiteNoise => baseVariables.Length,
|
||||
_ => throw new System.Exception("Unknown noise type")
|
||||
};
|
||||
|
||||
//-----------------------------------------------------------------------------------------
|
||||
|
||||
public override void OnGUI(Rect position, SerializedProperty property, GUIContent label)
|
||||
{
|
||||
//Get noise type info
|
||||
SerializedProperty noiseTypeProperty = property.FindPropertyRelative("noiseType");
|
||||
NoiseType noiseType = (NoiseType)noiseTypeProperty.enumValueIndex;
|
||||
|
||||
// Draw foldout
|
||||
InitFoldout(property, out string key);
|
||||
DrawFoldout(ref position, noiseType, key);
|
||||
if (!foldoutStates[key]) return;
|
||||
|
||||
//Draw the noiseType property
|
||||
EditorUtility.DrawDropdown(property, ref position, padding, "Noise Type", "noiseType");
|
||||
|
||||
// Draw fields based on the selected noiseType
|
||||
DrawNoiseTypeSettings(new Rect(position.x, position.y, position.width, EditorGUIUtility.singleLineHeight), property, noiseType);
|
||||
}
|
||||
|
||||
public override float GetPropertyHeight(SerializedProperty property, GUIContent label)
|
||||
{
|
||||
InitFoldout(property, out string key);
|
||||
if (!foldoutStates[key]) return EditorGUIUtility.singleLineHeight + padding;
|
||||
|
||||
//Add height for foldout
|
||||
float foldoutHeight = EditorGUIUtility.singleLineHeight + padding;
|
||||
|
||||
//Add height for noiseType property
|
||||
NoiseType noiseType = (NoiseType)property.FindPropertyRelative("noiseType").enumValueIndex;
|
||||
float propertiesHeight = GetPropertyAmount(noiseType) * (EditorGUIUtility.singleLineHeight + padding) + padding;
|
||||
if (EditorUtility.ThinView()) propertiesHeight += GetPropertyAmount(noiseType) * (EditorGUIUtility.singleLineHeight + padding);
|
||||
|
||||
return foldoutHeight + propertiesHeight + (EditorGUIUtility.singleLineHeight + padding) + padding;
|
||||
}
|
||||
|
||||
private void InitFoldout(SerializedProperty property, out string key)
|
||||
{
|
||||
key = GetFoldoutKey(property);
|
||||
|
||||
// Initialize foldout state if not present
|
||||
if (!foldoutStates.ContainsKey(key))
|
||||
{
|
||||
foldoutStates[key] = false;
|
||||
}
|
||||
}
|
||||
|
||||
private void DrawFoldout(ref Rect position, NoiseType noiseType, string key)
|
||||
{
|
||||
foldoutStates[key] = EditorGUI.Foldout(new Rect(position.x, position.y, position.width, EditorGUIUtility.singleLineHeight + padding), foldoutStates[key], "Shake Settings", true);
|
||||
position.y += EditorGUIUtility.singleLineHeight + padding;
|
||||
}
|
||||
|
||||
private string GetFoldoutKey(SerializedProperty property)
|
||||
{
|
||||
return property.serializedObject.targetObject.GetInstanceID() + "-" + property.propertyPath;
|
||||
}
|
||||
}
|
||||
}
|
||||
#endif
|
||||
@@ -0,0 +1,18 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 1ca3e0c191d9ee347989dc612e7472c5
|
||||
MonoImporter:
|
||||
externalObjects: {}
|
||||
serializedVersion: 2
|
||||
defaultReferences: []
|
||||
executionOrder: 0
|
||||
icon: {fileID: 2800000, guid: ce2446e8e0ad47b4c8554496daa9625e, type: 3}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
AssetOrigin:
|
||||
serializedVersion: 1
|
||||
productId: 271263
|
||||
packageName: Smooth Shake Free
|
||||
packageVersion: 1.0.2
|
||||
assetPath: Assets/SmoothShakeFree/Data/Editor/ShakerDrawer.cs
|
||||
uploadId: 656168
|
||||
@@ -0,0 +1,32 @@
|
||||
#if UNITY_EDITOR
|
||||
using UnityEditor;
|
||||
using UnityEngine;
|
||||
|
||||
namespace SmoothShakeFree
|
||||
{
|
||||
[CustomPropertyDrawer(typeof(TimeSettings))]
|
||||
internal class TimeSettingsDrawer : PropertyDrawer
|
||||
{
|
||||
public float padding = 2f;
|
||||
public override void OnGUI(Rect position, SerializedProperty property, GUIContent label)
|
||||
{
|
||||
//Draw enableOnStart and constantShake
|
||||
EditorUtility.DrawSerializedProperties(property, ref position, padding, "enableOnStart", "constantShake");
|
||||
|
||||
// Draw fadeInDuration and fadeInCurve
|
||||
EditorUtility.DrawPropertiesHorizontally(property, ref position, "Fade In", padding, 25f, new float[] { 1.5f, 1 }, "fadeInDuration", "fadeInCurve");
|
||||
|
||||
// Draw holdDuration
|
||||
EditorUtility.DrawSerializedProperties(property, ref position, padding, "holdDuration");
|
||||
|
||||
// Draw fadeOutDuration and fadeOutCurve
|
||||
EditorUtility.DrawPropertiesHorizontally(property, ref position, "Fade Out", padding, 25f, new float[] { 1.5f, 1 }, "fadeOutDuration", "fadeOutCurve");
|
||||
}
|
||||
|
||||
public override float GetPropertyHeight(SerializedProperty property, GUIContent label)
|
||||
{
|
||||
return (EditorGUIUtility.singleLineHeight + padding) * 5;
|
||||
}
|
||||
}
|
||||
}
|
||||
#endif
|
||||
@@ -0,0 +1,18 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 53770111b3244694ba8d48649c29f0b1
|
||||
MonoImporter:
|
||||
externalObjects: {}
|
||||
serializedVersion: 2
|
||||
defaultReferences: []
|
||||
executionOrder: 0
|
||||
icon: {fileID: 2800000, guid: ce2446e8e0ad47b4c8554496daa9625e, type: 3}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
AssetOrigin:
|
||||
serializedVersion: 1
|
||||
productId: 271263
|
||||
packageName: Smooth Shake Free
|
||||
packageVersion: 1.0.2
|
||||
assetPath: Assets/SmoothShakeFree/Data/Editor/TimeSettingsDrawer.cs
|
||||
uploadId: 656168
|
||||
@@ -0,0 +1,31 @@
|
||||
#if UNITY_EDITOR
|
||||
using System.Collections;
|
||||
using System.Collections.Generic;
|
||||
using UnityEngine;
|
||||
using UnityEditor;
|
||||
|
||||
namespace SmoothShakeFree
|
||||
{
|
||||
internal class WindowLinks : Editor
|
||||
{
|
||||
[MenuItem("Window/SmoothShakeFree/Upgrade to Pro version")]
|
||||
public static void ProLink()
|
||||
{
|
||||
Application.OpenURL("https://assetstore.unity.com/packages/tools/animation/smooth-shake-pro-271080");
|
||||
}
|
||||
|
||||
[MenuItem("Window/SmoothShakeFree/Showcase and Tutorial")]
|
||||
public static void TutorialLink()
|
||||
{
|
||||
Application.OpenURL("https://youtu.be/SFpfRgB9yh0?si=8H1EVeIFZ1tNjTdt");
|
||||
}
|
||||
|
||||
//Leave a review
|
||||
[MenuItem("Window/SmoothShakeFree/Leave a review")]
|
||||
public static void ReviewLink()
|
||||
{
|
||||
Application.OpenURL("https://assetstore.unity.com/packages/tools/animation/smooth-shake-free-271263#reviews");
|
||||
}
|
||||
}
|
||||
}
|
||||
#endif
|
||||
@@ -0,0 +1,18 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 6be097daa292f614ca08ebeb7e893fea
|
||||
MonoImporter:
|
||||
externalObjects: {}
|
||||
serializedVersion: 2
|
||||
defaultReferences: []
|
||||
executionOrder: 0
|
||||
icon: {fileID: 2800000, guid: ce2446e8e0ad47b4c8554496daa9625e, type: 3}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
AssetOrigin:
|
||||
serializedVersion: 1
|
||||
productId: 271263
|
||||
packageName: Smooth Shake Free
|
||||
packageVersion: 1.0.2
|
||||
assetPath: Assets/SmoothShakeFree/Data/Editor/WindowLinks.cs
|
||||
uploadId: 656168
|
||||
@@ -0,0 +1,207 @@
|
||||
using System.Collections;
|
||||
using System.Collections.Generic;
|
||||
using UnityEngine;
|
||||
|
||||
namespace SmoothShakeFree
|
||||
{
|
||||
public abstract class ShakeBase : MonoBehaviour
|
||||
{
|
||||
[Header("Time Settings")]
|
||||
[Tooltip("Settings for the shake timing")]
|
||||
public TimeSettings timeSettings;
|
||||
|
||||
private bool willStop = false;
|
||||
|
||||
[HideInInspector] internal Shaker[] shakers;
|
||||
#if UNITY_2020
|
||||
[HideInInspector] internal readonly List<Coroutine> activeShakeRoutines = new List<Coroutine>();
|
||||
#else
|
||||
[HideInInspector] internal readonly List<Coroutine> activeShakeRoutines = new();
|
||||
#endif
|
||||
[HideInInspector] internal Coroutine clearAfterFinished;
|
||||
|
||||
[HideInInspector] internal Vector3[] sum;
|
||||
|
||||
internal void Awake()
|
||||
{
|
||||
shakers = GetShakers();
|
||||
sum = new Vector3[shakers.Length];
|
||||
if (timeSettings.enableOnStart) StartShake();
|
||||
}
|
||||
|
||||
internal void Start()
|
||||
{
|
||||
if (timeSettings.enableOnStart) StartShake();
|
||||
}
|
||||
|
||||
public virtual void StartShake()
|
||||
{
|
||||
willStop = false;
|
||||
if (activeShakeRoutines.Count == 0)
|
||||
{
|
||||
clearAfterFinished = StartCoroutine(ClearAfterFinished());
|
||||
SaveDefaultValues();
|
||||
for (int i = 0; i < shakers.Length; i++)
|
||||
{
|
||||
activeShakeRoutines.Add(StartCoroutine(ShakeRoutine(shakers[i], timeSettings, i)));
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
ForceStop();
|
||||
StartShake();
|
||||
}
|
||||
}
|
||||
|
||||
public void StartShake(SmoothShakeFreePreset preset)
|
||||
{
|
||||
ApplyPresetSettings(preset);
|
||||
StartShake();
|
||||
}
|
||||
|
||||
public void StopShake() => willStop = true;
|
||||
|
||||
public void ForceStop()
|
||||
{
|
||||
for (int i = 0; i < activeShakeRoutines.Count; i++)
|
||||
{
|
||||
if (activeShakeRoutines[i] != null)
|
||||
{
|
||||
StopCoroutine(activeShakeRoutines[i]);
|
||||
activeShakeRoutines[i] = null;
|
||||
}
|
||||
}
|
||||
if (clearAfterFinished != null)
|
||||
{
|
||||
StopCoroutine(clearAfterFinished);
|
||||
clearAfterFinished = null;
|
||||
}
|
||||
|
||||
for (int i = 0; i < sum.Length; i++)
|
||||
{
|
||||
sum[i] = Vector3.zero;
|
||||
}
|
||||
|
||||
activeShakeRoutines.Clear();
|
||||
ResetDefaultValues();
|
||||
willStop = false;
|
||||
}
|
||||
|
||||
protected IEnumerator ClearAfterFinished()
|
||||
{
|
||||
if (timeSettings.constantShake)
|
||||
{
|
||||
while (true)
|
||||
{
|
||||
if (willStop) break;
|
||||
yield return null;
|
||||
}
|
||||
yield return new WaitForSeconds(timeSettings.fadeOutDuration);
|
||||
ForceStop();
|
||||
}
|
||||
else
|
||||
{
|
||||
yield return new WaitForSeconds(timeSettings.GetShakeDuration());
|
||||
ForceStop();
|
||||
}
|
||||
}
|
||||
|
||||
protected IEnumerator ShakeRoutine(Shaker shaker, TimeSettings timeSettings, int i)
|
||||
{
|
||||
bool isFadingOut = false;
|
||||
if (timeSettings.fadeInDuration > 0) { yield return FadeRoutine(this.timeSettings.fadeInCurve, shaker, timeSettings, isFadingOut, i); }
|
||||
|
||||
if (timeSettings.holdDuration > 0 && !this.timeSettings.constantShake) { yield return HoldRoutine(timeSettings.holdDuration, shaker, timeSettings, i); }
|
||||
if (this.timeSettings.constantShake) { yield return HoldRoutine(Mathf.Infinity, shaker, timeSettings, i); }
|
||||
|
||||
isFadingOut = true;
|
||||
if (timeSettings.fadeOutDuration > 0) { yield return FadeRoutine(this.timeSettings.fadeOutCurve, shaker, timeSettings, isFadingOut, i); }
|
||||
}
|
||||
|
||||
private IEnumerator FadeRoutine(AnimationCurve curve, Shaker shaker, TimeSettings timeSettings, bool isFadingOut, int i)
|
||||
{
|
||||
//Don't play the fade routine if the curve has no keys
|
||||
if (curve.length <= 1) yield break;
|
||||
|
||||
if (isFadingOut && timeSettings.holdDuration == 0 && timeSettings.fadeInDuration == 0) timeSettings.fadeValue = 1;
|
||||
|
||||
Keyframe[] keys = curve.keys;
|
||||
float tEnd = isFadingOut ? timeSettings.fadeOutDuration : timeSettings.fadeInDuration;
|
||||
float t = 0;
|
||||
|
||||
while (t < tEnd)
|
||||
{
|
||||
if (!isFadingOut && willStop) yield break;
|
||||
#if UNITY_2020
|
||||
float remappedTime = Utility.Remap(t, 0, tEnd, keys[0].time, keys[keys.Length - 1].time);
|
||||
#else
|
||||
float remappedTime = Utility.Remap(t, 0, tEnd, keys[0].time, keys[^1].time);
|
||||
#endif
|
||||
//timeSettings.fadeValue = Utility.Remap(curve.Evaluate(remappedTime), keys[0].value, keys[^1].value, isFadingOut ? 1 : 0, isFadingOut ? 0 : 1);
|
||||
timeSettings.fadeValue = curve.Evaluate(remappedTime);
|
||||
Execute(shaker, timeSettings, i);
|
||||
yield return null;
|
||||
t += Time.deltaTime;
|
||||
}
|
||||
|
||||
#if UNITY_2020
|
||||
timeSettings.fadeValue = Utility.Remap(curve.Evaluate(keys[keys.Length - 1].time), keys[0].value, keys[keys.Length - 1].value, isFadingOut ? 1 : 0, isFadingOut ? 0 : 1);
|
||||
#else
|
||||
timeSettings.fadeValue = Utility.Remap(curve.Evaluate(keys[^1].time), keys[0].value, keys[^1].value, isFadingOut ? 1 : 0, isFadingOut ? 0 : 1);
|
||||
#endif
|
||||
Execute(shaker, timeSettings, i);
|
||||
}
|
||||
|
||||
private IEnumerator HoldRoutine(float duration, Shaker shaker, TimeSettings timeSettings, int i)
|
||||
{
|
||||
if (timeSettings.fadeValue == 0) timeSettings.fadeValue = 1;
|
||||
|
||||
float t = 0;
|
||||
|
||||
// Check if the duration is infinite
|
||||
if (float.IsInfinity(duration))
|
||||
{
|
||||
while (true) // Infinite loop
|
||||
{
|
||||
if (willStop) yield break;
|
||||
|
||||
Execute(shaker, timeSettings, i);
|
||||
yield return null;
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
while (t < duration)
|
||||
{
|
||||
if (willStop) yield break;
|
||||
|
||||
Execute(shaker, timeSettings, i);
|
||||
yield return null;
|
||||
t += Time.deltaTime;
|
||||
}
|
||||
}
|
||||
|
||||
if (timeSettings.fadeOutDuration == 0)
|
||||
{
|
||||
timeSettings.fadeValue = 0;
|
||||
Execute(shaker, timeSettings, i);
|
||||
}
|
||||
}
|
||||
|
||||
protected virtual void Execute(Shaker shaker, TimeSettings timeSettings, int i)
|
||||
{
|
||||
sum[i] = shaker.Evaluate(Time.time) * timeSettings.fadeValue;
|
||||
}
|
||||
|
||||
protected virtual void ApplySum() => Apply(sum);
|
||||
|
||||
private void Update() { if (activeShakeRoutines.Count > 0) ApplySum(); }
|
||||
|
||||
internal abstract void Apply(Vector3[] value);
|
||||
protected abstract Shaker[] GetShakers();
|
||||
internal abstract void SaveDefaultValues();
|
||||
internal abstract void ResetDefaultValues();
|
||||
internal abstract void ApplyPresetSettings(SmoothShakeFreePreset preset);
|
||||
}
|
||||
|
||||
}
|
||||
@@ -0,0 +1,18 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 1e85372b54e898b4792097d11349fefe
|
||||
MonoImporter:
|
||||
externalObjects: {}
|
||||
serializedVersion: 2
|
||||
defaultReferences: []
|
||||
executionOrder: 0
|
||||
icon: {fileID: 2800000, guid: ce2446e8e0ad47b4c8554496daa9625e, type: 3}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
AssetOrigin:
|
||||
serializedVersion: 1
|
||||
productId: 271263
|
||||
packageName: Smooth Shake Free
|
||||
packageVersion: 1.0.2
|
||||
assetPath: Assets/SmoothShakeFree/Data/ShakeBase.cs
|
||||
uploadId: 656168
|
||||
@@ -0,0 +1,54 @@
|
||||
using System;
|
||||
using UnityEngine;
|
||||
|
||||
namespace SmoothShakeFree
|
||||
{
|
||||
[Serializable]
|
||||
public class Shaker
|
||||
{
|
||||
//Serializable Properties
|
||||
[Tooltip("The type of shake to use")]
|
||||
public NoiseType noiseType;
|
||||
|
||||
//Serializable properties
|
||||
[Tooltip("The amplitude (strength) of this shaker")]
|
||||
public Vector3 amplitude;
|
||||
[Tooltip("The frequency (speed) of this shaker")]
|
||||
public Vector3 frequency;
|
||||
|
||||
//Convert to Vector3
|
||||
public Vector3 Evaluate(float t)
|
||||
{
|
||||
Vector3 modified;
|
||||
modified.x = EvaluateBase(t, amplitude.x, frequency.x);
|
||||
modified.y = EvaluateBase(t, amplitude.y, frequency.y);
|
||||
modified.z = EvaluateBase(t, amplitude.z, frequency.z);
|
||||
return modified;
|
||||
}
|
||||
|
||||
//Evaluate based on noise type
|
||||
protected float EvaluateBase(
|
||||
float t,
|
||||
float amplitude,
|
||||
float frequency
|
||||
) => noiseType switch
|
||||
{
|
||||
NoiseType.SineWave => amplitude * EvaluateSinewave(frequency * t),
|
||||
NoiseType.WhiteNoise => amplitude * EvaluateWhiteNoise(),
|
||||
_ => throw new Exception("Unknown noise type")
|
||||
};
|
||||
|
||||
//Enum to store noise type
|
||||
public enum NoiseType
|
||||
{
|
||||
SineWave,
|
||||
WhiteNoise,
|
||||
}
|
||||
|
||||
//SineWave
|
||||
private float EvaluateSinewave(float t) => Mathf.Sin(2 * Mathf.PI * t);
|
||||
|
||||
//Whitenoise
|
||||
private float EvaluateWhiteNoise() => UnityEngine.Random.Range(-1f, 1f);
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,18 @@
|
||||
fileFormatVersion: 2
|
||||
guid: a7fc9e73e844e3b47a76216c53f5da75
|
||||
MonoImporter:
|
||||
externalObjects: {}
|
||||
serializedVersion: 2
|
||||
defaultReferences: []
|
||||
executionOrder: 0
|
||||
icon: {fileID: 2800000, guid: ce2446e8e0ad47b4c8554496daa9625e, type: 3}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
AssetOrigin:
|
||||
serializedVersion: 1
|
||||
productId: 271263
|
||||
packageName: Smooth Shake Free
|
||||
packageVersion: 1.0.2
|
||||
assetPath: Assets/SmoothShakeFree/Data/Shaker.cs
|
||||
uploadId: 656168
|
||||
@@ -0,0 +1,303 @@
|
||||
%YAML 1.1
|
||||
%TAG !u! tag:unity3d.com,2011:
|
||||
--- !u!181963792 &2655988077585873504
|
||||
Preset:
|
||||
m_ObjectHideFlags: 0
|
||||
m_CorrespondingSourceObject: {fileID: 0}
|
||||
m_PrefabInstance: {fileID: 0}
|
||||
m_PrefabAsset: {fileID: 0}
|
||||
m_Name: SmoothShakeFreeDefault
|
||||
m_TargetType:
|
||||
m_NativeTypeID: 114
|
||||
m_ManagedTypePPtr: {fileID: 11500000, guid: ca6c4a2ae5b653d4da56baa3a520f389, type: 3}
|
||||
m_ManagedTypeFallback:
|
||||
m_Properties:
|
||||
- target: {fileID: 0}
|
||||
propertyPath: m_Enabled
|
||||
value: 1
|
||||
objectReference: {fileID: 0}
|
||||
- target: {fileID: 0}
|
||||
propertyPath: m_EditorHideFlags
|
||||
value: 0
|
||||
objectReference: {fileID: 0}
|
||||
- target: {fileID: 0}
|
||||
propertyPath: m_EditorClassIdentifier
|
||||
value:
|
||||
objectReference: {fileID: 0}
|
||||
- target: {fileID: 0}
|
||||
propertyPath: timeSettings.fadeValue
|
||||
value: 0
|
||||
objectReference: {fileID: 0}
|
||||
- target: {fileID: 0}
|
||||
propertyPath: timeSettings.enableOnStart
|
||||
value: 0
|
||||
objectReference: {fileID: 0}
|
||||
- target: {fileID: 0}
|
||||
propertyPath: timeSettings.constantShake
|
||||
value: 0
|
||||
objectReference: {fileID: 0}
|
||||
- target: {fileID: 0}
|
||||
propertyPath: timeSettings.fadeInDuration
|
||||
value: 0
|
||||
objectReference: {fileID: 0}
|
||||
- target: {fileID: 0}
|
||||
propertyPath: timeSettings.fadeInCurve.m_Curve.Array.size
|
||||
value: 2
|
||||
objectReference: {fileID: 0}
|
||||
- target: {fileID: 0}
|
||||
propertyPath: timeSettings.fadeInCurve.m_Curve.Array.data[0].time
|
||||
value: 0
|
||||
objectReference: {fileID: 0}
|
||||
- target: {fileID: 0}
|
||||
propertyPath: timeSettings.fadeInCurve.m_Curve.Array.data[0].value
|
||||
value: 0
|
||||
objectReference: {fileID: 0}
|
||||
- target: {fileID: 0}
|
||||
propertyPath: timeSettings.fadeInCurve.m_Curve.Array.data[0].inSlope
|
||||
value: 0
|
||||
objectReference: {fileID: 0}
|
||||
- target: {fileID: 0}
|
||||
propertyPath: timeSettings.fadeInCurve.m_Curve.Array.data[0].outSlope
|
||||
value: 0
|
||||
objectReference: {fileID: 0}
|
||||
- target: {fileID: 0}
|
||||
propertyPath: timeSettings.fadeInCurve.m_Curve.Array.data[0].tangentMode
|
||||
value: 0
|
||||
objectReference: {fileID: 0}
|
||||
- target: {fileID: 0}
|
||||
propertyPath: timeSettings.fadeInCurve.m_Curve.Array.data[0].weightedMode
|
||||
value: 0
|
||||
objectReference: {fileID: 0}
|
||||
- target: {fileID: 0}
|
||||
propertyPath: timeSettings.fadeInCurve.m_Curve.Array.data[0].inWeight
|
||||
value: 0
|
||||
objectReference: {fileID: 0}
|
||||
- target: {fileID: 0}
|
||||
propertyPath: timeSettings.fadeInCurve.m_Curve.Array.data[0].outWeight
|
||||
value: 0
|
||||
objectReference: {fileID: 0}
|
||||
- target: {fileID: 0}
|
||||
propertyPath: timeSettings.fadeInCurve.m_Curve.Array.data[1].time
|
||||
value: 1
|
||||
objectReference: {fileID: 0}
|
||||
- target: {fileID: 0}
|
||||
propertyPath: timeSettings.fadeInCurve.m_Curve.Array.data[1].value
|
||||
value: 1
|
||||
objectReference: {fileID: 0}
|
||||
- target: {fileID: 0}
|
||||
propertyPath: timeSettings.fadeInCurve.m_Curve.Array.data[1].inSlope
|
||||
value: 0
|
||||
objectReference: {fileID: 0}
|
||||
- target: {fileID: 0}
|
||||
propertyPath: timeSettings.fadeInCurve.m_Curve.Array.data[1].outSlope
|
||||
value: 0
|
||||
objectReference: {fileID: 0}
|
||||
- target: {fileID: 0}
|
||||
propertyPath: timeSettings.fadeInCurve.m_Curve.Array.data[1].tangentMode
|
||||
value: 0
|
||||
objectReference: {fileID: 0}
|
||||
- target: {fileID: 0}
|
||||
propertyPath: timeSettings.fadeInCurve.m_Curve.Array.data[1].weightedMode
|
||||
value: 0
|
||||
objectReference: {fileID: 0}
|
||||
- target: {fileID: 0}
|
||||
propertyPath: timeSettings.fadeInCurve.m_Curve.Array.data[1].inWeight
|
||||
value: 0
|
||||
objectReference: {fileID: 0}
|
||||
- target: {fileID: 0}
|
||||
propertyPath: timeSettings.fadeInCurve.m_Curve.Array.data[1].outWeight
|
||||
value: 0
|
||||
objectReference: {fileID: 0}
|
||||
- target: {fileID: 0}
|
||||
propertyPath: timeSettings.fadeInCurve.m_PreInfinity
|
||||
value: 2
|
||||
objectReference: {fileID: 0}
|
||||
- target: {fileID: 0}
|
||||
propertyPath: timeSettings.fadeInCurve.m_PostInfinity
|
||||
value: 2
|
||||
objectReference: {fileID: 0}
|
||||
- target: {fileID: 0}
|
||||
propertyPath: timeSettings.fadeInCurve.m_RotationOrder
|
||||
value: 4
|
||||
objectReference: {fileID: 0}
|
||||
- target: {fileID: 0}
|
||||
propertyPath: timeSettings.holdDuration
|
||||
value: 0
|
||||
objectReference: {fileID: 0}
|
||||
- target: {fileID: 0}
|
||||
propertyPath: timeSettings.fadeOutDuration
|
||||
value: 0.3
|
||||
objectReference: {fileID: 0}
|
||||
- target: {fileID: 0}
|
||||
propertyPath: timeSettings.fadeOutCurve.m_Curve.Array.size
|
||||
value: 2
|
||||
objectReference: {fileID: 0}
|
||||
- target: {fileID: 0}
|
||||
propertyPath: timeSettings.fadeOutCurve.m_Curve.Array.data[0].time
|
||||
value: 0.016666412
|
||||
objectReference: {fileID: 0}
|
||||
- target: {fileID: 0}
|
||||
propertyPath: timeSettings.fadeOutCurve.m_Curve.Array.data[0].value
|
||||
value: 1
|
||||
objectReference: {fileID: 0}
|
||||
- target: {fileID: 0}
|
||||
propertyPath: timeSettings.fadeOutCurve.m_Curve.Array.data[0].inSlope
|
||||
value: 0
|
||||
objectReference: {fileID: 0}
|
||||
- target: {fileID: 0}
|
||||
propertyPath: timeSettings.fadeOutCurve.m_Curve.Array.data[0].outSlope
|
||||
value: 0
|
||||
objectReference: {fileID: 0}
|
||||
- target: {fileID: 0}
|
||||
propertyPath: timeSettings.fadeOutCurve.m_Curve.Array.data[0].tangentMode
|
||||
value: 0
|
||||
objectReference: {fileID: 0}
|
||||
- target: {fileID: 0}
|
||||
propertyPath: timeSettings.fadeOutCurve.m_Curve.Array.data[0].weightedMode
|
||||
value: 0
|
||||
objectReference: {fileID: 0}
|
||||
- target: {fileID: 0}
|
||||
propertyPath: timeSettings.fadeOutCurve.m_Curve.Array.data[0].inWeight
|
||||
value: 0
|
||||
objectReference: {fileID: 0}
|
||||
- target: {fileID: 0}
|
||||
propertyPath: timeSettings.fadeOutCurve.m_Curve.Array.data[0].outWeight
|
||||
value: 0
|
||||
objectReference: {fileID: 0}
|
||||
- target: {fileID: 0}
|
||||
propertyPath: timeSettings.fadeOutCurve.m_Curve.Array.data[1].time
|
||||
value: 0.9916687
|
||||
objectReference: {fileID: 0}
|
||||
- target: {fileID: 0}
|
||||
propertyPath: timeSettings.fadeOutCurve.m_Curve.Array.data[1].value
|
||||
value: 0.0070762634
|
||||
objectReference: {fileID: 0}
|
||||
- target: {fileID: 0}
|
||||
propertyPath: timeSettings.fadeOutCurve.m_Curve.Array.data[1].inSlope
|
||||
value: 0.02483903
|
||||
objectReference: {fileID: 0}
|
||||
- target: {fileID: 0}
|
||||
propertyPath: timeSettings.fadeOutCurve.m_Curve.Array.data[1].outSlope
|
||||
value: 0.02483903
|
||||
objectReference: {fileID: 0}
|
||||
- target: {fileID: 0}
|
||||
propertyPath: timeSettings.fadeOutCurve.m_Curve.Array.data[1].tangentMode
|
||||
value: 0
|
||||
objectReference: {fileID: 0}
|
||||
- target: {fileID: 0}
|
||||
propertyPath: timeSettings.fadeOutCurve.m_Curve.Array.data[1].weightedMode
|
||||
value: 0
|
||||
objectReference: {fileID: 0}
|
||||
- target: {fileID: 0}
|
||||
propertyPath: timeSettings.fadeOutCurve.m_Curve.Array.data[1].inWeight
|
||||
value: 0.09741809
|
||||
objectReference: {fileID: 0}
|
||||
- target: {fileID: 0}
|
||||
propertyPath: timeSettings.fadeOutCurve.m_Curve.Array.data[1].outWeight
|
||||
value: 0
|
||||
objectReference: {fileID: 0}
|
||||
- target: {fileID: 0}
|
||||
propertyPath: timeSettings.fadeOutCurve.m_PreInfinity
|
||||
value: 2
|
||||
objectReference: {fileID: 0}
|
||||
- target: {fileID: 0}
|
||||
propertyPath: timeSettings.fadeOutCurve.m_PostInfinity
|
||||
value: 2
|
||||
objectReference: {fileID: 0}
|
||||
- target: {fileID: 0}
|
||||
propertyPath: timeSettings.fadeOutCurve.m_RotationOrder
|
||||
value: 4
|
||||
objectReference: {fileID: 0}
|
||||
- target: {fileID: 0}
|
||||
propertyPath: shakers.Array.size
|
||||
value: 0
|
||||
objectReference: {fileID: 0}
|
||||
- target: {fileID: 0}
|
||||
propertyPath: sum.Array.size
|
||||
value: 0
|
||||
objectReference: {fileID: 0}
|
||||
- target: {fileID: 0}
|
||||
propertyPath: preset
|
||||
value:
|
||||
objectReference: {fileID: 0}
|
||||
- target: {fileID: 0}
|
||||
propertyPath: positionShake.noiseType
|
||||
value: 0
|
||||
objectReference: {fileID: 0}
|
||||
- target: {fileID: 0}
|
||||
propertyPath: positionShake.amplitude.x
|
||||
value: 0.3
|
||||
objectReference: {fileID: 0}
|
||||
- target: {fileID: 0}
|
||||
propertyPath: positionShake.amplitude.y
|
||||
value: 0.3
|
||||
objectReference: {fileID: 0}
|
||||
- target: {fileID: 0}
|
||||
propertyPath: positionShake.amplitude.z
|
||||
value: 0.3
|
||||
objectReference: {fileID: 0}
|
||||
- target: {fileID: 0}
|
||||
propertyPath: positionShake.frequency.x
|
||||
value: 5
|
||||
objectReference: {fileID: 0}
|
||||
- target: {fileID: 0}
|
||||
propertyPath: positionShake.frequency.y
|
||||
value: 5.5
|
||||
objectReference: {fileID: 0}
|
||||
- target: {fileID: 0}
|
||||
propertyPath: positionShake.frequency.z
|
||||
value: 4.5
|
||||
objectReference: {fileID: 0}
|
||||
- target: {fileID: 0}
|
||||
propertyPath: rotationShake.noiseType
|
||||
value: 0
|
||||
objectReference: {fileID: 0}
|
||||
- target: {fileID: 0}
|
||||
propertyPath: rotationShake.amplitude.x
|
||||
value: 0
|
||||
objectReference: {fileID: 0}
|
||||
- target: {fileID: 0}
|
||||
propertyPath: rotationShake.amplitude.y
|
||||
value: 0
|
||||
objectReference: {fileID: 0}
|
||||
- target: {fileID: 0}
|
||||
propertyPath: rotationShake.amplitude.z
|
||||
value: 0
|
||||
objectReference: {fileID: 0}
|
||||
- target: {fileID: 0}
|
||||
propertyPath: rotationShake.frequency.x
|
||||
value: 0
|
||||
objectReference: {fileID: 0}
|
||||
- target: {fileID: 0}
|
||||
propertyPath: rotationShake.frequency.y
|
||||
value: 0
|
||||
objectReference: {fileID: 0}
|
||||
- target: {fileID: 0}
|
||||
propertyPath: rotationShake.frequency.z
|
||||
value: 0
|
||||
objectReference: {fileID: 0}
|
||||
- target: {fileID: 0}
|
||||
propertyPath: startPosition.x
|
||||
value: 0
|
||||
objectReference: {fileID: 0}
|
||||
- target: {fileID: 0}
|
||||
propertyPath: startPosition.y
|
||||
value: 0
|
||||
objectReference: {fileID: 0}
|
||||
- target: {fileID: 0}
|
||||
propertyPath: startPosition.z
|
||||
value: 0
|
||||
objectReference: {fileID: 0}
|
||||
- target: {fileID: 0}
|
||||
propertyPath: startRotation.x
|
||||
value: 0
|
||||
objectReference: {fileID: 0}
|
||||
- target: {fileID: 0}
|
||||
propertyPath: startRotation.y
|
||||
value: 0
|
||||
objectReference: {fileID: 0}
|
||||
- target: {fileID: 0}
|
||||
propertyPath: startRotation.z
|
||||
value: 0
|
||||
objectReference: {fileID: 0}
|
||||
m_ExcludedProperties: []
|
||||
@@ -0,0 +1,15 @@
|
||||
fileFormatVersion: 2
|
||||
guid: a6b2485f1546b454091cd313d22a4b99
|
||||
NativeFormatImporter:
|
||||
externalObjects: {}
|
||||
mainObjectFileID: 2655988077585873504
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
AssetOrigin:
|
||||
serializedVersion: 1
|
||||
productId: 271263
|
||||
packageName: Smooth Shake Free
|
||||
packageVersion: 1.0.2
|
||||
assetPath: Assets/SmoothShakeFree/Data/SmoothShakeFreeDefault.preset
|
||||
uploadId: 656168
|
||||
@@ -0,0 +1,30 @@
|
||||
using UnityEngine;
|
||||
|
||||
namespace SmoothShakeFree
|
||||
{
|
||||
[CreateAssetMenu(fileName = "SmoothShakePreset", menuName = "Smooth Shake Free/Smooth Shake Preset", order = 1)]
|
||||
public class SmoothShakeFreePreset : ScriptableObject
|
||||
{
|
||||
[Header("Time Settings")]
|
||||
[Tooltip("Settings for the shake timing")]
|
||||
public TimeSettings timeSettings;
|
||||
|
||||
#if UNITY_2020
|
||||
[Header("Position Shake Settings")]
|
||||
[Tooltip("Settings for Position Shake")]
|
||||
public Shaker positionShake = new Shaker();
|
||||
|
||||
[Header("Rotation Shake Settings")]
|
||||
[Tooltip("Settings for Rotation Shake")]
|
||||
public Shaker rotationShake = new Shaker();
|
||||
#else
|
||||
[Header("Position Shake Settings")]
|
||||
[Tooltip("Settings for Position Shake")]
|
||||
public Shaker positionShake = new();
|
||||
|
||||
[Header("Rotation Shake Settings")]
|
||||
[Tooltip("Settings for Rotation Shake")]
|
||||
public Shaker rotationShake = new();
|
||||
#endif
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,18 @@
|
||||
fileFormatVersion: 2
|
||||
guid: e1e0b737a04a0c14db3ea96032bcb14c
|
||||
MonoImporter:
|
||||
externalObjects: {}
|
||||
serializedVersion: 2
|
||||
defaultReferences: []
|
||||
executionOrder: 0
|
||||
icon: {fileID: 2800000, guid: c0e8b27d7173b314fa78f14aa3686f8e, type: 3}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
AssetOrigin:
|
||||
serializedVersion: 1
|
||||
productId: 271263
|
||||
packageName: Smooth Shake Free
|
||||
packageVersion: 1.0.2
|
||||
assetPath: Assets/SmoothShakeFree/Data/SmoothShakeFreePreset.cs
|
||||
uploadId: 656168
|
||||
@@ -0,0 +1,30 @@
|
||||
using UnityEngine;
|
||||
|
||||
namespace SmoothShakeFree
|
||||
{
|
||||
[System.Serializable]
|
||||
public struct TimeSettings
|
||||
{
|
||||
[HideInInspector] public float fadeValue;
|
||||
|
||||
[Tooltip("Play this shake on start")]
|
||||
public bool enableOnStart;
|
||||
[Tooltip("Use an infinite holdduration (until stopped)")]
|
||||
public bool constantShake;
|
||||
|
||||
[Tooltip("How long the shake fade in should last")]
|
||||
public float fadeInDuration;
|
||||
[Tooltip("The curve to use for the shake fade in")]
|
||||
public AnimationCurve fadeInCurve;
|
||||
|
||||
[Tooltip("How long the shake should hold at full strength")]
|
||||
public float holdDuration;
|
||||
|
||||
[Tooltip("How long the shake fade out should last")]
|
||||
public float fadeOutDuration;
|
||||
[Tooltip("The curve to use for the shake fade out")]
|
||||
public AnimationCurve fadeOutCurve;
|
||||
public readonly float GetShakeDuration() => fadeInDuration + holdDuration + fadeOutDuration;
|
||||
}
|
||||
|
||||
}
|
||||
@@ -0,0 +1,18 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 98805097a78538347a9edff3148d94dc
|
||||
MonoImporter:
|
||||
externalObjects: {}
|
||||
serializedVersion: 2
|
||||
defaultReferences: []
|
||||
executionOrder: 0
|
||||
icon: {fileID: 2800000, guid: ce2446e8e0ad47b4c8554496daa9625e, type: 3}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
AssetOrigin:
|
||||
serializedVersion: 1
|
||||
productId: 271263
|
||||
packageName: Smooth Shake Free
|
||||
packageVersion: 1.0.2
|
||||
assetPath: Assets/SmoothShakeFree/Data/TimeSettings.cs
|
||||
uploadId: 656168
|
||||
@@ -0,0 +1,10 @@
|
||||
namespace SmoothShakeFree
|
||||
{
|
||||
public static class Utility
|
||||
{
|
||||
public static float Remap(float valueInput, float oldRangeMin, float oldRangeMax, float newRangeMin, float newRangeMax)
|
||||
{
|
||||
return newRangeMin + (valueInput - oldRangeMin) * (newRangeMax - newRangeMin) / (oldRangeMax - oldRangeMin);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,18 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 24edcbf108763074aaab22c3f0c9c6af
|
||||
MonoImporter:
|
||||
externalObjects: {}
|
||||
serializedVersion: 2
|
||||
defaultReferences: []
|
||||
executionOrder: 0
|
||||
icon: {fileID: 2800000, guid: ce2446e8e0ad47b4c8554496daa9625e, type: 3}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
AssetOrigin:
|
||||
serializedVersion: 1
|
||||
productId: 271263
|
||||
packageName: Smooth Shake Free
|
||||
packageVersion: 1.0.2
|
||||
assetPath: Assets/SmoothShakeFree/Data/Utility.cs
|
||||
uploadId: 656168
|
||||
Reference in New Issue
Block a user