This commit is contained in:
SoulliesOfficial
2026-04-01 12:23:27 -04:00
parent aff7ac0e03
commit c3b1561375
933 changed files with 114333 additions and 119360 deletions

View File

@@ -2,151 +2,151 @@
// Available at the Unity Asset Store - http://u3d.as/y3X
Shader "UI/Demo/Color Picker"
{
Properties
{
[PerRendererData] _MainTex ("Sprite Texture", 2D) = "white" {}
_Color ("Tint", Color) = (1,1,1,1)
Properties
{
[PerRendererData] _MainTex ("Sprite Texture", 2D) = "white" {}
_Color ("Tint", Color) = (1,1,1,1)
_StencilComp ("Stencil Comparison", Float) = 8
_Stencil ("Stencil ID", Float) = 0
_StencilOp ("Stencil Operation", Float) = 0
_StencilWriteMask ("Stencil Write Mask", Float) = 255
_StencilReadMask ("Stencil Read Mask", Float) = 255
_StencilComp ("Stencil Comparison", Float) = 8
_Stencil ("Stencil ID", Float) = 0
_StencilOp ("Stencil Operation", Float) = 0
_StencilWriteMask ("Stencil Write Mask", Float) = 255
_StencilReadMask ("Stencil Read Mask", Float) = 255
_ColorMask ("Color Mask", Float) = 15
_ColorMask ("Color Mask", Float) = 15
[Toggle(UNITY_UI_ALPHACLIP)] _UseUIAlphaClip ("Use Alpha Clip", Float) = 0
[ASEEnd]_Brightness("Brightness", Float) = 1
[HideInInspector] _texcoord( "", 2D ) = "white" {}
[Toggle(UNITY_UI_ALPHACLIP)] _UseUIAlphaClip ("Use Alpha Clip", Float) = 0
[ASEEnd]_Brightness("Brightness", Float) = 1
[HideInInspector] _texcoord( "", 2D ) = "white" {}
}
}
SubShader
{
LOD 0
SubShader
{
LOD 0
Tags
{
"Queue"="Transparent" "IgnoreProjector"="True" "RenderType"="Transparent" "PreviewType"="Plane" "CanUseSpriteAtlas"="True"
}
Stencil
{
Ref [_Stencil]
ReadMask [_StencilReadMask]
WriteMask [_StencilWriteMask]
Comp [_StencilComp]
Pass [_StencilOp]
}
Tags { "Queue"="Transparent" "IgnoreProjector"="True" "RenderType"="Transparent" "PreviewType"="Plane" "CanUseSpriteAtlas"="True" }
Stencil
{
Ref [_Stencil]
ReadMask [_StencilReadMask]
WriteMask [_StencilWriteMask]
Comp [_StencilComp]
Pass [_StencilOp]
}
Cull Off
Lighting Off
ZWrite Off
ZTest [unity_GUIZTestMode]
Blend SrcAlpha OneMinusSrcAlpha
ColorMask [_ColorMask]
Cull Off
Lighting Off
ZWrite Off
ZTest [unity_GUIZTestMode]
Blend SrcAlpha OneMinusSrcAlpha
ColorMask [_ColorMask]
Pass
{
Name "Default"
CGPROGRAM
#ifndef UNITY_SETUP_STEREO_EYE_INDEX_POST_VERTEX
#define UNITY_SETUP_STEREO_EYE_INDEX_POST_VERTEX(input)
#endif
#pragma vertex vert
#pragma fragment frag
#pragma target 3.0
Pass
{
Name "Default"
CGPROGRAM
#ifndef UNITY_SETUP_STEREO_EYE_INDEX_POST_VERTEX
#define UNITY_SETUP_STEREO_EYE_INDEX_POST_VERTEX(input)
#endif
#pragma vertex vert
#pragma fragment frag
#pragma target 3.0
#include "UnityCG.cginc"
#include "UnityUI.cginc"
#include "UnityCG.cginc"
#include "UnityUI.cginc"
#pragma multi_compile __ UNITY_UI_CLIP_RECT
#pragma multi_compile __ UNITY_UI_ALPHACLIP
#define ASE_NEEDS_FRAG_COLOR
#pragma multi_compile __ UNITY_UI_CLIP_RECT
#pragma multi_compile __ UNITY_UI_ALPHACLIP
struct appdata_t
{
float4 vertex : POSITION;
float4 color : COLOR;
float2 texcoord : TEXCOORD0;
UNITY_VERTEX_INPUT_INSTANCE_ID
};
#define ASE_NEEDS_FRAG_COLOR
struct v2f
{
float4 vertex : SV_POSITION;
fixed4 color : COLOR;
half2 texcoord : TEXCOORD0;
float4 worldPosition : TEXCOORD1;
UNITY_VERTEX_INPUT_INSTANCE_ID
UNITY_VERTEX_OUTPUT_STEREO
};
uniform fixed4 _Color;
uniform fixed4 _TextureSampleAdd;
uniform float4 _ClipRect;
uniform sampler2D _MainTex;
uniform float _Brightness;
uniform float4 _MainTex_ST;
float3 HSVToRGB( float3 c )
{
float4 K = float4( 1.0, 2.0 / 3.0, 1.0 / 3.0, 3.0 );
float3 p = abs( frac( c.xxx + K.xyz ) * 6.0 - K.www );
return c.z * lerp( K.xxx, saturate( p - K.xxx ), c.y );
}
struct appdata_t
{
float4 vertex : POSITION;
float4 color : COLOR;
float2 texcoord : TEXCOORD0;
UNITY_VERTEX_INPUT_INSTANCE_ID
};
struct v2f
{
float4 vertex : SV_POSITION;
fixed4 color : COLOR;
half2 texcoord : TEXCOORD0;
float4 worldPosition : TEXCOORD1;
UNITY_VERTEX_INPUT_INSTANCE_ID
UNITY_VERTEX_OUTPUT_STEREO
};
uniform fixed4 _Color;
uniform fixed4 _TextureSampleAdd;
uniform float4 _ClipRect;
uniform sampler2D _MainTex;
uniform float _Brightness;
uniform float4 _MainTex_ST;
float3 HSVToRGB(float3 c)
{
float4 K = float4(1.0, 2.0 / 3.0, 1.0 / 3.0, 3.0);
float3 p = abs(frac(c.xxx + K.xyz) * 6.0 - K.www);
return c.z * lerp(K.xxx, saturate(p - K.xxx), c.y);
}
v2f vert(appdata_t IN)
{
v2f OUT;
UNITY_SETUP_INSTANCE_ID(IN);
v2f vert( appdata_t IN )
{
v2f OUT;
UNITY_SETUP_INSTANCE_ID( IN );
UNITY_INITIALIZE_VERTEX_OUTPUT_STEREO(OUT);
UNITY_TRANSFER_INSTANCE_ID(IN, OUT);
OUT.worldPosition = IN.vertex;
UNITY_TRANSFER_INSTANCE_ID(IN, OUT);
OUT.worldPosition = IN.vertex;
OUT.worldPosition.xyz += float3( 0, 0, 0 ) ;
OUT.vertex = UnityObjectToClipPos(OUT.worldPosition);
OUT.texcoord = IN.texcoord;
OUT.color = IN.color * _Color;
return OUT;
}
OUT.worldPosition.xyz += float3(0, 0, 0);
OUT.vertex = UnityObjectToClipPos(OUT.worldPosition);
fixed4 frag(v2f IN ) : SV_Target
{
UNITY_SETUP_INSTANCE_ID( IN );
UNITY_SETUP_STEREO_EYE_INDEX_POST_VERTEX( IN );
OUT.texcoord = IN.texcoord;
OUT.color = IN.color * _Color;
return OUT;
}
fixed4 frag(v2f IN) : SV_Target
{
UNITY_SETUP_INSTANCE_ID(IN);
UNITY_SETUP_STEREO_EYE_INDEX_POST_VERTEX(IN);
float2 texCoord1 = IN.texcoord.xy * float2(1, 1) + float2(0, 0);
float3 hsvTorgb2 = HSVToRGB(float3(texCoord1.x, texCoord1.y, _Brightness));
float2 uv_MainTex = IN.texcoord.xy * _MainTex_ST.xy + _MainTex_ST.zw;
float4 appendResult3 = (float4(hsvTorgb2, tex2D(_MainTex, uv_MainTex).a));
half4 color = (IN.color * appendResult3);
#ifdef UNITY_UI_CLIP_RECT
float2 texCoord1 = IN.texcoord.xy * float2( 1,1 ) + float2( 0,0 );
float3 hsvTorgb2 = HSVToRGB( float3(texCoord1.x,texCoord1.y,_Brightness) );
float2 uv_MainTex = IN.texcoord.xy * _MainTex_ST.xy + _MainTex_ST.zw;
float4 appendResult3 = (float4(hsvTorgb2 , tex2D( _MainTex, uv_MainTex ).a));
half4 color = ( IN.color * appendResult3 );
#ifdef UNITY_UI_CLIP_RECT
color.a *= UnityGet2DClipping(IN.worldPosition.xy, _ClipRect);
#endif
#ifdef UNITY_UI_ALPHACLIP
clip (color.a - 0.001);
#endif
#ifdef UNITY_UI_ALPHACLIP
clip(color.a - 0.001);
#endif
return color;
}
ENDCG
}
}
Fallback Off
return color;
}
ENDCG
}
}
Fallback Off
}
/*ASEBEGIN
Version=19002

View File

@@ -8,3 +8,10 @@ ShaderImporter:
userData:
assetBundleName:
assetBundleVariant:
AssetOrigin:
serializedVersion: 1
productId: 158988
packageName: Sprite Shaders Ultimate
packageVersion: 6.22
assetPath: Assets/OtherPlugins/Sprite Shaders Ultimate/Demo/Scripts/Color Pick.shader
uploadId: 845852

View File

@@ -9,3 +9,10 @@ MonoImporter:
userData:
assetBundleName:
assetBundleVariant:
AssetOrigin:
serializedVersion: 1
productId: 158988
packageName: Sprite Shaders Ultimate
packageVersion: 6.22
assetPath: Assets/OtherPlugins/Sprite Shaders Ultimate/Demo/Scripts/Demo_Camera.cs
uploadId: 845852

View File

@@ -1,6 +1,8 @@
using System.Collections;
using System.Collections.Generic;
using UnityEngine;
using UnityEngine.EventSystems;
using UnityEngine.UI;
using UnityEngine.EventSystems;
namespace SpriteShadersUltimate.Demo
{
@@ -8,22 +10,22 @@ namespace SpriteShadersUltimate.Demo
{
public Material targetMaterial;
public string propertyName;
private Slider brightnessSlider;
private RectTransform colorArea;
private Image dotImage;
private RectTransform dotRect;
private bool isDragging;
RectTransform colorArea;
Slider brightnessSlider;
RectTransform dotRect;
Image dotImage;
private bool isHovered;
bool isHovered;
bool isDragging;
private float lastHue;
private float lastSaturation;
private float maxBrightness;
float lastHue;
float lastSaturation;
float maxBrightness;
private void Start()
void Start()
{
if (brightnessSlider == null || colorArea == null)
if(brightnessSlider == null || colorArea == null)
{
//References:
colorArea = transform.Find("Color Area").GetComponent<RectTransform>();
@@ -32,42 +34,37 @@ namespace SpriteShadersUltimate.Demo
dotImage = dotRect.GetComponent<Image>();
//Initialize:
dotImage.material = Instantiate(dotImage.material);
dotImage.material = Instantiate<Material>(dotImage.material);
}
}
private void Update()
void Update()
{
Vector2 mousePosition = default;
RectTransformUtility.ScreenPointToLocalPointInRectangle(colorArea, Input.mousePosition, Camera.main,
out mousePosition);
RectTransformUtility.ScreenPointToLocalPointInRectangle(colorArea, Input.mousePosition, Camera.main, out mousePosition);
if (isHovered && Input.GetMouseButtonDown(0))
if (mousePosition.x > -colorArea.sizeDelta.x * 0.5f && mousePosition.x < colorArea.sizeDelta.x * 0.5f &&
mousePosition.y > -colorArea.sizeDelta.y * 0.5f && mousePosition.y < colorArea.sizeDelta.y * 0.5f)
isDragging = true;
if (isDragging)
{
if (!Input.GetMouseButton(0)) isDragging = false;
if (mousePosition.x > -colorArea.sizeDelta.x * 0.5f && mousePosition.x < colorArea.sizeDelta.x * 0.5f && mousePosition.y > -colorArea.sizeDelta.y * 0.5f && mousePosition.y < colorArea.sizeDelta.y * 0.5f)
{
isDragging = true;
}
}
var colorRange = (mousePosition + colorArea.sizeDelta * 0.5f) / colorArea.sizeDelta;
var hue = Mathf.Clamp01(colorRange.x);
var saturation = Mathf.Clamp01(colorRange.y);
if(isDragging)
{
if(Input.GetMouseButton(0) == false)
{
isDragging = false;
}
Vector2 colorRange = (mousePosition + colorArea.sizeDelta * 0.5f) / colorArea.sizeDelta;
float hue = Mathf.Clamp01(colorRange.x);
float saturation = Mathf.Clamp01(colorRange.y);
UpdateColor(hue, saturation);
}
}
public void OnPointerEnter(PointerEventData eventData)
{
isHovered = true;
}
public void OnPointerExit(PointerEventData eventData)
{
isHovered = false;
}
public void SetTarget(Material newMaterial, string newProperty, string shaderName)
{
Start();
@@ -78,16 +75,18 @@ namespace SpriteShadersUltimate.Demo
LoadColor(targetMaterial.GetColor(propertyName));
//Title:
var displayString = newProperty.Replace("_" + shaderName.Replace(" ", ""), "");
var displayChars = displayString.ToCharArray();
string displayString = newProperty.Replace("_" + shaderName.Replace(" ", ""), "");
char[] displayChars = displayString.ToCharArray();
displayString = "";
for (var c = 0; c < displayChars.Length; c++)
for(int c = 0; c < displayChars.Length; c++)
{
if (c > 0 && displayChars[c].ToString().ToUpper() == displayChars[c].ToString()) displayString += " ";
if(c > 0 && displayChars[c].ToString().ToUpper() == displayChars[c].ToString())
{
displayString += " ";
}
displayString += displayChars[c];
}
transform.Find("Title").GetComponent<Text>().text = displayString;
}
@@ -100,10 +99,14 @@ namespace SpriteShadersUltimate.Demo
maxBrightness = Mathf.Ceil(value * 0.5f) * 4f + 5f;
if (value <= 1f)
if(value <= 1f)
{
brightnessSlider.SetValueWithoutNotify(value * 0.5f);
}
else
{
brightnessSlider.SetValueWithoutNotify(0.5f + (value - 1f) / maxBrightness);
}
UpdateColor(hue, saturation);
}
@@ -113,23 +116,38 @@ namespace SpriteShadersUltimate.Demo
lastHue = hue;
lastSaturation = saturation;
dotRect.anchoredPosition =
new Vector2(Mathf.Clamp(colorArea.sizeDelta.x * hue, 5, colorArea.sizeDelta.x - 5),
Mathf.Clamp(colorArea.sizeDelta.y * saturation, 5, colorArea.sizeDelta.y - 5));
dotRect.anchoredPosition = new Vector2(Mathf.Clamp(colorArea.sizeDelta.x * hue, 5, colorArea.sizeDelta.x - 5), Mathf.Clamp(colorArea.sizeDelta.y * saturation, 5, colorArea.sizeDelta.y - 5));
dotImage.color = Color.HSVToRGB(hue, saturation, 1f);
var value = Mathf.Min(brightnessSlider.value * 2f, 1) +
Mathf.Max((brightnessSlider.value - 0.5f) * maxBrightness, 0);
float value = Mathf.Min(brightnessSlider.value * 2f, 1) + Mathf.Max((brightnessSlider.value - 0.5f) * maxBrightness, 0);
dotImage.materialForRendering.SetFloat("_Brightness", value);
if (targetMaterial != null) targetMaterial.SetColor(propertyName, Color.HSVToRGB(hue, saturation, value));
if(targetMaterial != null)
{
targetMaterial.SetColor(propertyName, Color.HSVToRGB(hue, saturation, value));
}
}
public void SliderChanged()
{
if (Mathf.Abs(brightnessSlider.value - 0.5f) < 0.05f) brightnessSlider.SetValueWithoutNotify(0.5f);
if (Mathf.Abs(brightnessSlider.value - 0.5f) < 0.05f)
{
brightnessSlider.SetValueWithoutNotify(0.5f);
}
UpdateColor(lastHue, lastSaturation);
}
public void OnPointerEnter(PointerEventData eventData)
{
isHovered = true;
}
public void OnPointerExit(PointerEventData eventData)
{
isHovered = false;
}
}
}

View File

@@ -9,3 +9,10 @@ MonoImporter:
userData:
assetBundleName:
assetBundleVariant:
AssetOrigin:
serializedVersion: 1
productId: 158988
packageName: Sprite Shaders Ultimate
packageVersion: 6.22
assetPath: Assets/OtherPlugins/Sprite Shaders Ultimate/Demo/Scripts/Demo_ColorPicker.cs
uploadId: 845852

View File

@@ -9,3 +9,10 @@ MonoImporter:
userData:
assetBundleName:
assetBundleVariant:
AssetOrigin:
serializedVersion: 1
productId: 158988
packageName: Sprite Shaders Ultimate
packageVersion: 6.22
assetPath: Assets/OtherPlugins/Sprite Shaders Ultimate/Demo/Scripts/Demo_Display.cs
uploadId: 845852

View File

@@ -1,3 +1,5 @@
using System.Collections;
using System.Collections.Generic;
using UnityEngine;
namespace SpriteShadersUltimate.Demo
@@ -5,28 +7,28 @@ namespace SpriteShadersUltimate.Demo
public class Demo_DisplayTitle : MonoBehaviour
{
public Transform target;
private RectTransform rectParent;
private RectTransform rectTransform;
RectTransform rectTransform;
RectTransform rectParent;
private void Start()
void Start()
{
rectTransform = GetComponent<RectTransform>();
rectParent = transform.parent.GetComponent<RectTransform>();
}
private void LateUpdate()
void LateUpdate()
{
Vector3 screenPosition = RectTransformUtility.WorldToScreenPoint(Camera.main, target.position);
Vector2 rectPosition;
RectTransformUtility.ScreenPointToLocalPointInRectangle(rectParent, screenPosition, Camera.main,
out rectPosition);
RectTransformUtility.ScreenPointToLocalPointInRectangle(rectParent, screenPosition, Camera.main, out rectPosition);
rectTransform.anchoredPosition = rectPosition;
transform.localScale = target.lossyScale;
}
}
}
}

View File

@@ -9,3 +9,10 @@ MonoImporter:
userData:
assetBundleName:
assetBundleVariant:
AssetOrigin:
serializedVersion: 1
productId: 158988
packageName: Sprite Shaders Ultimate
packageVersion: 6.22
assetPath: Assets/OtherPlugins/Sprite Shaders Ultimate/Demo/Scripts/Demo_DisplayTitle.cs
uploadId: 845852

View File

@@ -9,3 +9,10 @@ MonoImporter:
userData:
assetBundleName:
assetBundleVariant:
AssetOrigin:
serializedVersion: 1
productId: 158988
packageName: Sprite Shaders Ultimate
packageVersion: 6.22
assetPath: Assets/OtherPlugins/Sprite Shaders Ultimate/Demo/Scripts/Demo_FloatPicker.cs
uploadId: 845852

View File

@@ -9,3 +9,10 @@ MonoImporter:
userData:
assetBundleName:
assetBundleVariant:
AssetOrigin:
serializedVersion: 1
productId: 158988
packageName: Sprite Shaders Ultimate
packageVersion: 6.22
assetPath: Assets/OtherPlugins/Sprite Shaders Ultimate/Demo/Scripts/Demo_GUI.cs
uploadId: 845852

View File

@@ -9,3 +9,10 @@ MonoImporter:
userData:
assetBundleName:
assetBundleVariant:
AssetOrigin:
serializedVersion: 1
productId: 158988
packageName: Sprite Shaders Ultimate
packageVersion: 6.22
assetPath: Assets/OtherPlugins/Sprite Shaders Ultimate/Demo/Scripts/Demo_Player.cs
uploadId: 845852

View File

@@ -1,3 +1,4 @@
using System.Collections;
using System.Collections.Generic;
using UnityEngine;
@@ -7,22 +8,25 @@ namespace SpriteShadersUltimate.Demo
{
public static Demo_Shaders instance;
public static float zoomFactor;
private Vector3 currentPosition;
private GameObject environmentGO;
private List<SpriteRenderer> environmentSprites;
GameObject environmentGO;
List<SpriteRenderer> environmentSprites;
Vector3 currentPosition;
private float lastZoomFactor;
float lastZoomFactor;
private void Awake()
void Awake()
{
//Reference:
instance = this;
//Environment:
var environment = GameObject.Find("Environment").transform;
Transform environment = GameObject.Find("Environment").transform;
environmentSprites = new List<SpriteRenderer>();
foreach (var sr in environment.GetComponentsInChildren<SpriteRenderer>()) environmentSprites.Add(sr);
foreach(SpriteRenderer sr in environment.GetComponentsInChildren<SpriteRenderer>())
{
environmentSprites.Add(sr);
}
environmentGO = environment.gameObject;
//Initialize:
@@ -32,7 +36,7 @@ namespace SpriteShadersUltimate.Demo
lastZoomFactor = -1000;
}
private void Update()
void Update()
{
//Zoom Factor:
if (Demo_Display.selected != null)
@@ -47,27 +51,33 @@ namespace SpriteShadersUltimate.Demo
}
//Scale:
var scale = 1f + 6.2f * zoomFactor;
float scale = 1f + 6.2f * zoomFactor;
transform.localScale = new Vector3(scale, scale, 1);
if (zoomFactor != lastZoomFactor)
{
//Environment:
var alpha = Mathf.Clamp01((zoomFactor - 0.75f) / 0.25f);
foreach (var sprite in environmentSprites)
float alpha = Mathf.Clamp01((zoomFactor - 0.75f) / 0.25f);
foreach (SpriteRenderer sprite in environmentSprites)
{
var color = sprite.color;
Color color = sprite.color;
color.a = alpha;
sprite.color = color;
}
if (alpha > 0f)
if(alpha > 0f)
{
if (!environmentGO.activeSelf) environmentGO.SetActive(true);
if(!environmentGO.activeSelf)
{
environmentGO.SetActive(true);
}
}
else
{
if (environmentGO.activeSelf) environmentGO.SetActive(false);
if (environmentGO.activeSelf)
{
environmentGO.SetActive(false);
}
}
//Other:
@@ -75,18 +85,18 @@ namespace SpriteShadersUltimate.Demo
}
//Position:
if (Demo_Display.selected != null)
if(Demo_Display.selected != null)
{
currentPosition = Vector3.Lerp(currentPosition, -Demo_Display.selected.transform.localPosition,
Time.unscaledDeltaTime * 10f);
currentPosition = Vector3.Lerp(currentPosition, -Demo_Display.selected.transform.localPosition, Time.unscaledDeltaTime * 10f);
}
else
{
var movement = 0f;
if (AllowMovement())
float movement = 0f;
if(AllowMovement())
{
movement = 2f * (Screen.width * 0.5f - Input.mousePosition.x) / Screen.width;
if (Mathf.Abs(movement) < 0.6f)
movement = 2f * (Screen.width * 0.5f - Input.mousePosition.x) / (float)Screen.width;
if(Mathf.Abs(movement) < 0.6f)
{
movement = 0;
}
@@ -102,16 +112,18 @@ namespace SpriteShadersUltimate.Demo
}
}
currentPosition = Vector3.Lerp(currentPosition, new Vector3(currentPosition.x + movement, 0, 0),
Time.unscaledDeltaTime * 14f / scale);
currentPosition = Vector3.Lerp(currentPosition, new Vector3(currentPosition.x + movement, 0, 0), Time.unscaledDeltaTime * 14f / scale);
}
transform.position = currentPosition * scale;
//Controls:
if (Demo_Display.selected != null)
if(Demo_Display.selected != null)
{
if (Input.GetKeyDown(KeyCode.Escape))
{
Demo_Display.selected.Deselect();
}
}
}
public bool AllowMovement()
@@ -124,4 +136,4 @@ namespace SpriteShadersUltimate.Demo
return zoomFactor > 0.9f;
}
}
}
}

View File

@@ -9,3 +9,10 @@ MonoImporter:
userData:
assetBundleName:
assetBundleVariant:
AssetOrigin:
serializedVersion: 1
productId: 158988
packageName: Sprite Shaders Ultimate
packageVersion: 6.22
assetPath: Assets/OtherPlugins/Sprite Shaders Ultimate/Demo/Scripts/Demo_Shaders.cs
uploadId: 845852

View File

@@ -9,3 +9,10 @@ MonoImporter:
userData:
assetBundleName:
assetBundleVariant:
AssetOrigin:
serializedVersion: 1
productId: 158988
packageName: Sprite Shaders Ultimate
packageVersion: 6.22
assetPath: Assets/OtherPlugins/Sprite Shaders Ultimate/Demo/Scripts/Demo_SpriteFader.cs
uploadId: 845852

View File

@@ -1,79 +1,104 @@
using System;
using System.Collections;
using System.Collections.Generic;
using UnityEngine;
using UnityEngine.UI;
using UnityEngine.EventSystems;
namespace SpriteShadersUltimate.Demo
{
public class Demo_Trigger : MonoBehaviour
{
public List<Demo_TriggerEvent> events;
private ShaderFaderSSU fader;
ShaderFaderSSU fader;
private void Start()
public List<Demo_TriggerEvent> events;
void Start()
{
fader = GetComponent<ShaderFaderSSU>();
}
private void OnTriggerEnter2D(Collider2D collision)
{
if (collision.name == "Player") ChangeState(true);
if(collision.name == "Player")
{
ChangeState(true);
}
}
private void OnTriggerExit2D(Collider2D collision)
{
if (collision.name == "Player") ChangeState(false);
if (collision.name == "Player")
{
ChangeState(false);
}
}
public void ChangeState(bool isActive)
{
if (fader != null) fader.isFaded = isActive;
if (fader != null)
{
fader.isFaded = isActive;
}
if (events != null && isActive)
foreach (var demoEvent in events)
{
foreach (Demo_TriggerEvent demoEvent in events)
{
StartCoroutine(PlayEvent(demoEvent));
}
}
}
private IEnumerator PlayEvent(Demo_TriggerEvent demoEvent)
IEnumerator PlayEvent(Demo_TriggerEvent demoEvent)
{
yield return new WaitForSeconds(demoEvent.delay);
demoEvent.Play(transform);
}
}
[Serializable]
[System.Serializable]
public class Demo_TriggerEvent
{
[Header("Delay:")] public float delay;
[Header("Change Fader:")] public ShaderFaderSSU fader;
[Header("Delay:")]
public float delay;
[Header("Change Fader:")]
public ShaderFaderSSU fader;
public bool faderState;
public bool negateState;
[Header("Snap Player:")] public bool snapPlayer;
[Header("Snap Player:")]
public bool snapPlayer;
public bool isRelative;
public Vector3 snapPosition;
[Header("Hurt Player:")] public bool hurtPlayer;
[Header("Hurt Player:")]
public bool hurtPlayer;
public Vector2 velocity;
public void Play(Transform source)
{
if (fader != null)
if(fader != null)
{
if (negateState)
if(negateState)
{
fader.isFaded = !fader.isFaded;
}
else
{
fader.isFaded = faderState;
}
}
if (snapPlayer)
if(snapPlayer)
{
Demo_Player.instance.SnapPosition(isRelative ? source.position + snapPosition : snapPosition);
}
if (hurtPlayer) Demo_Player.instance.GetHurt(velocity);
if(hurtPlayer)
{
Demo_Player.instance.GetHurt(velocity);
}
}
}
}

View File

@@ -9,3 +9,10 @@ MonoImporter:
userData:
assetBundleName:
assetBundleVariant:
AssetOrigin:
serializedVersion: 1
productId: 158988
packageName: Sprite Shaders Ultimate
packageVersion: 6.22
assetPath: Assets/OtherPlugins/Sprite Shaders Ultimate/Demo/Scripts/Demo_Trigger.cs
uploadId: 845852

View File

@@ -9,3 +9,10 @@ MonoImporter:
userData:
assetBundleName:
assetBundleVariant:
AssetOrigin:
serializedVersion: 1
productId: 158988
packageName: Sprite Shaders Ultimate
packageVersion: 6.22
assetPath: Assets/OtherPlugins/Sprite Shaders Ultimate/Demo/Scripts/Demo_VectorFollow.cs
uploadId: 845852

View File

@@ -9,3 +9,10 @@ MonoImporter:
userData:
assetBundleName:
assetBundleVariant:
AssetOrigin:
serializedVersion: 1
productId: 158988
packageName: Sprite Shaders Ultimate
packageVersion: 6.22
assetPath: Assets/OtherPlugins/Sprite Shaders Ultimate/Demo/Scripts/Demo_VectorPicker.cs
uploadId: 845852