-
Notifications
You must be signed in to change notification settings - Fork 14
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
108 changed files
with
12,916 additions
and
42 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,52 @@ | ||
using System; | ||
|
||
namespace SKCell | ||
{ | ||
public class SKVariableMonitor<T> where T : IEquatable<T> | ||
{ | ||
/// <summary> | ||
/// Called when the value of the monitored variable changes. | ||
/// </summary> | ||
public Action<T> onValueChanged; | ||
|
||
private T _currentValue; | ||
private Func<T> _valueProvider; | ||
|
||
/// <summary> | ||
/// Create a value monitor. | ||
/// <para>Example: SKVariableMonitor m = new SKVariableMonitor(()=>myInt);</para> | ||
/// </summary> | ||
/// <param name="valueProvider"></param> | ||
/// <exception cref="ArgumentNullException"></exception> | ||
public SKVariableMonitor(Func<T> valueProvider) | ||
{ | ||
if (valueProvider == null) | ||
throw new ArgumentNullException(nameof(valueProvider)); | ||
|
||
_valueProvider = valueProvider; | ||
_currentValue = _valueProvider(); | ||
|
||
SKCore.Tick000 += MonitorUpdate; | ||
} | ||
|
||
public T GetValue() | ||
{ | ||
return _valueProvider(); | ||
} | ||
public void Dispose() | ||
{ | ||
SKCore.Tick000 -= MonitorUpdate; | ||
} | ||
|
||
private void MonitorUpdate() | ||
{ | ||
T newValue = _valueProvider(); | ||
|
||
if (!_currentValue.Equals(newValue)) | ||
{ | ||
_currentValue = newValue; | ||
onValueChanged?.Invoke(newValue); | ||
} | ||
} | ||
} | ||
} |
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,115 @@ | ||
%YAML 1.1 | ||
%TAG !u! tag:unity3d.com,2011: | ||
--- !u!1 &2885297536444466575 | ||
GameObject: | ||
m_ObjectHideFlags: 0 | ||
m_CorrespondingSourceObject: {fileID: 0} | ||
m_PrefabInstance: {fileID: 0} | ||
m_PrefabAsset: {fileID: 0} | ||
serializedVersion: 6 | ||
m_Component: | ||
- component: {fileID: 2885297536444466563} | ||
- component: {fileID: 2885297536444466560} | ||
- component: {fileID: 2885297536444466561} | ||
- component: {fileID: 2885297536444466574} | ||
m_Layer: 0 | ||
m_Name: CartoonGrass | ||
m_TagString: Untagged | ||
m_Icon: {fileID: 0} | ||
m_NavMeshLayer: 0 | ||
m_StaticEditorFlags: 0 | ||
m_IsActive: 1 | ||
--- !u!4 &2885297536444466563 | ||
Transform: | ||
m_ObjectHideFlags: 0 | ||
m_CorrespondingSourceObject: {fileID: 0} | ||
m_PrefabInstance: {fileID: 0} | ||
m_PrefabAsset: {fileID: 0} | ||
m_GameObject: {fileID: 2885297536444466575} | ||
m_LocalRotation: {x: 0, y: 0, z: 0, w: 1} | ||
m_LocalPosition: {x: 0, y: -0.46, z: -12.95} | ||
m_LocalScale: {x: 1.4243, y: 1.4243, z: 1.4243} | ||
m_ConstrainProportionsScale: 0 | ||
m_Children: [] | ||
m_Father: {fileID: 0} | ||
m_RootOrder: 0 | ||
m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0} | ||
--- !u!33 &2885297536444466560 | ||
MeshFilter: | ||
m_ObjectHideFlags: 0 | ||
m_CorrespondingSourceObject: {fileID: 0} | ||
m_PrefabInstance: {fileID: 0} | ||
m_PrefabAsset: {fileID: 0} | ||
m_GameObject: {fileID: 2885297536444466575} | ||
m_Mesh: {fileID: -2432090755550338912, guid: 7a25e5447362e6d4589466b024b61060, type: 3} | ||
--- !u!23 &2885297536444466561 | ||
MeshRenderer: | ||
m_ObjectHideFlags: 0 | ||
m_CorrespondingSourceObject: {fileID: 0} | ||
m_PrefabInstance: {fileID: 0} | ||
m_PrefabAsset: {fileID: 0} | ||
m_GameObject: {fileID: 2885297536444466575} | ||
m_Enabled: 1 | ||
m_CastShadows: 1 | ||
m_ReceiveShadows: 1 | ||
m_DynamicOccludee: 1 | ||
m_StaticShadowCaster: 0 | ||
m_MotionVectors: 1 | ||
m_LightProbeUsage: 1 | ||
m_ReflectionProbeUsage: 1 | ||
m_RayTracingMode: 2 | ||
m_RayTraceProcedural: 0 | ||
m_RenderingLayerMask: 1 | ||
m_RendererPriority: 0 | ||
m_Materials: | ||
- {fileID: 0} | ||
m_StaticBatchInfo: | ||
firstSubMesh: 0 | ||
subMeshCount: 0 | ||
m_StaticBatchRoot: {fileID: 0} | ||
m_ProbeAnchor: {fileID: 0} | ||
m_LightProbeVolumeOverride: {fileID: 0} | ||
m_ScaleInLightmap: 1 | ||
m_ReceiveGI: 1 | ||
m_PreserveUVs: 0 | ||
m_IgnoreNormalsForChartDetection: 0 | ||
m_ImportantGI: 0 | ||
m_StitchLightmapSeams: 1 | ||
m_SelectedEditorRenderState: 3 | ||
m_MinimumChartSize: 4 | ||
m_AutoUVMaxDistance: 0.5 | ||
m_AutoUVMaxAngle: 89 | ||
m_LightmapParameters: {fileID: 0} | ||
m_SortingLayerID: 0 | ||
m_SortingLayer: 0 | ||
m_SortingOrder: 0 | ||
m_AdditionalVertexStreams: {fileID: 0} | ||
--- !u!114 &2885297536444466574 | ||
MonoBehaviour: | ||
m_ObjectHideFlags: 0 | ||
m_CorrespondingSourceObject: {fileID: 0} | ||
m_PrefabInstance: {fileID: 0} | ||
m_PrefabAsset: {fileID: 0} | ||
m_GameObject: {fileID: 2885297536444466575} | ||
m_Enabled: 1 | ||
m_EditorHideFlags: 0 | ||
m_Script: {fileID: 11500000, guid: 86f9715811d19c5419d667aca46d42ac, type: 3} | ||
m_Name: | ||
m_EditorClassIdentifier: | ||
updateOnPlay: 1 | ||
_TopColor: {r: 0.51, g: 1, b: 0.47, a: 1} | ||
_BottomColor: {r: 0.04, g: 0.31, b: 0.13, a: 1} | ||
_TintColor: {r: 0.77, g: 1, b: 0.467, a: 1} | ||
_TintColor2: {r: 0.21, g: 0.42, b: 0.51, a: 1} | ||
_Tint: 0.53 | ||
_Tint2: 0.77 | ||
_Bend: 0.2 | ||
_BladeWidth: 0.05 | ||
_BladeWidthRandom: 0.02 | ||
_BladeHeight: 0.52 | ||
_BladeHeightRandom: 0.22 | ||
_BladeCurve: 2 | ||
_BladeForward: 0.06 | ||
_BladeForwardRandom: 0.09 | ||
_WindFrequency: {x: 0.08, y: 0.08, z: 0, w: 0} | ||
_WindStrength: 0.5 |
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,70 @@ | ||
Shader "SKCell/Dissolve_0" | ||
{ | ||
Properties | ||
{ | ||
_Color ("Color Tint", Color) = (1,1,1,1) | ||
_HighlightColor ("Highlight Color", Color) = (0.9,0.8,0.7,1) | ||
_MainTex ("Texture", 2D) = "white" {} | ||
_Noise ("Noise", 2D) = "white" {} | ||
_Threshold ("Threshold", range(0,1)) = 0.5 | ||
_HighlightThreshold ("Highlight Threshold", float) =1 | ||
} | ||
SubShader | ||
{ | ||
Tags { "RenderType"="Transparent" } | ||
Blend SrcAlpha OneMinusSrcAlpha | ||
LOD 100 | ||
|
||
Pass | ||
{ | ||
CGPROGRAM | ||
#pragma vertex vert | ||
#pragma fragment frag | ||
|
||
#include "UnityCG.cginc" | ||
|
||
struct appdata | ||
{ | ||
float4 vertex : POSITION; | ||
float2 uv : TEXCOORD0; | ||
}; | ||
|
||
struct v2f | ||
{ | ||
float2 uv : TEXCOORD0; | ||
float2 noiseuv : TEXCOORD1; | ||
float4 vertex : SV_POSITION; | ||
}; | ||
|
||
sampler2D _MainTex; | ||
sampler2D _Noise; | ||
float4 _MainTex_ST; | ||
float4 _Noise_ST; | ||
fixed4 _Color; | ||
fixed4 _HighlightColor; | ||
|
||
float _Threshold; | ||
float _HighlightThreshold; | ||
|
||
v2f vert (appdata v) | ||
{ | ||
v2f o; | ||
o.vertex = UnityObjectToClipPos(v.vertex); | ||
o.uv = TRANSFORM_TEX(v.uv, _MainTex); | ||
o.noiseuv = TRANSFORM_TEX(v.uv, _Noise); | ||
return o; | ||
} | ||
|
||
fixed4 frag (v2f i) : SV_Target | ||
{ | ||
fixed4 col = tex2D(_MainTex, i.uv) * _Color; | ||
fixed4 noiseTex = tex2D(_Noise,i.noiseuv); | ||
fixed noiseDiff = pow(saturate(noiseTex.r- _Threshold)/ _HighlightThreshold, 5); | ||
clip(noiseTex.r- _Threshold); | ||
col = lerp(col, _HighlightColor, saturate(1 - noiseDiff)) ; | ||
return col; | ||
} | ||
ENDCG | ||
} | ||
} | ||
} |
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
Oops, something went wrong.