| @@ -0,0 +1,16 @@ | ||
| using UnityEngine; | ||
| using System.Collections; | ||
|
|
||
| // Cartoon FX - (c) 2015 Jean Moreno | ||
|
|
||
| // Indefinitely rotates an object at a constant speed | ||
|
|
||
| public class CFX2_AutoRotate : MonoBehaviour | ||
| { | ||
| public Vector3 speed = new Vector3(0,40f,0); | ||
|
|
||
| void Update () | ||
| { | ||
| transform.Rotate(speed * Time.deltaTime); | ||
| } | ||
| } |
| @@ -0,0 +1,18 @@ | ||
| using UnityEngine; | ||
| using System.Collections; | ||
|
|
||
| // Cartoon FX - (c) 2015 Jean Moreno | ||
|
|
||
| // Automatically destroys the GameObject when there are no children left. | ||
|
|
||
| public class CFX_AutodestructWhenNoChildren : MonoBehaviour | ||
| { | ||
| // Update is called once per frame | ||
| void Update () | ||
| { | ||
| if( transform.childCount == 0) | ||
| { | ||
| GameObject.Destroy(this.gameObject); | ||
| } | ||
| } | ||
| } |
| @@ -0,0 +1,22 @@ | ||
| // Cartoon FX - (c) 2015, Jean Moreno | ||
|
|
||
| // Help Component that can be added to any GameObject or Prefab | ||
| // Can be useful if you want to add comments to a particular prefab about | ||
| // its usage | ||
|
|
||
| using UnityEngine; | ||
| using System.Collections; | ||
|
|
||
| public class CFX_InspectorHelp : MonoBehaviour | ||
| { | ||
| public bool Locked; | ||
| public string Title; | ||
| public string HelpText; | ||
| public int MsgType; | ||
|
|
||
| [ContextMenu("Unlock editing")] | ||
| void Unlock() | ||
| { | ||
| this.Locked = false; | ||
| } | ||
| } |
| @@ -0,0 +1,37 @@ | ||
| using UnityEngine; | ||
| using System.Collections; | ||
|
|
||
| // Cartoon FX - (c) 2015, Jean Moreno | ||
|
|
||
| // Drag/Drop this script on a Particle System (or an object having Particle System objects as children) to prevent a Shuriken bug | ||
| // where a system would emit at its original instantiated position before being translated, resulting in particles in-between | ||
| // the two positions. | ||
| // Possibly a threading bug from Unity (as of 3.5.4) | ||
|
|
||
| public class CFX_ShurikenThreadFix : MonoBehaviour | ||
| { | ||
| private ParticleSystem[] systems; | ||
|
|
||
| void OnEnable() | ||
| { | ||
| systems = GetComponentsInChildren<ParticleSystem>(); | ||
|
|
||
| foreach(ParticleSystem ps in systems) | ||
| { | ||
| ps.Stop(true); | ||
| ps.Clear(true); | ||
| } | ||
|
|
||
| StartCoroutine("WaitFrame"); | ||
| } | ||
|
|
||
| IEnumerator WaitFrame() | ||
| { | ||
| yield return null; | ||
|
|
||
| foreach(ParticleSystem ps in systems) | ||
| { | ||
| ps.Play(true); | ||
| } | ||
| } | ||
| } |
| @@ -0,0 +1,121 @@ | ||
| Shader "Cartoon FX/Particles Alpha Blended Add" | ||
| { | ||
| Properties | ||
| { | ||
| _TintColor ("Tint Color", Color) = (0.5,0.5,0.5,0.5) | ||
| _MainTex ("Particle Texture", 2D) = "white" {} | ||
| _InvFade ("Soft Particles Factor", Range(0.01,3.0)) = 1.0 | ||
| } | ||
|
|
||
| Category | ||
| { | ||
| Tags { "Queue"="Transparent" "IgnoreProjector"="True" "RenderType"="Transparent" } | ||
| Blend SrcAlpha OneMinusSrcAlpha | ||
| AlphaTest Greater .01 | ||
| ColorMask RGB | ||
| Cull Off Lighting Off ZWrite Off | ||
| BindChannels | ||
| { | ||
| Bind "Color", color | ||
| Bind "Vertex", vertex | ||
| Bind "TexCoord", texcoord | ||
| } | ||
|
|
||
| // ---- Fragment program cards | ||
| SubShader | ||
| { | ||
| Pass | ||
| { | ||
|
|
||
| CGPROGRAM | ||
| #pragma vertex vert | ||
| #pragma fragment frag | ||
| #pragma fragmentoption ARB_precision_hint_fastest | ||
| #pragma multi_compile_particles | ||
|
|
||
| #include "UnityCG.cginc" | ||
|
|
||
| sampler2D _MainTex; | ||
| fixed4 _TintColor; | ||
|
|
||
| struct appdata_t | ||
| { | ||
| float4 vertex : POSITION; | ||
| fixed4 color : COLOR; | ||
| float2 texcoord : TEXCOORD0; | ||
| }; | ||
|
|
||
| struct v2f | ||
| { | ||
| float4 vertex : POSITION; | ||
| fixed4 color : COLOR; | ||
| float2 texcoord : TEXCOORD0; | ||
| #ifdef SOFTPARTICLES_ON | ||
| float4 projPos : TEXCOORD1; | ||
| #endif | ||
| }; | ||
|
|
||
| float4 _MainTex_ST; | ||
|
|
||
| v2f vert (appdata_t v) | ||
| { | ||
| v2f o; | ||
| o.vertex = mul(UNITY_MATRIX_MVP, v.vertex); | ||
| #ifdef SOFTPARTICLES_ON | ||
| o.projPos = ComputeScreenPos (o.vertex); | ||
| COMPUTE_EYEDEPTH(o.projPos.z); | ||
| #endif | ||
| o.color = v.color; | ||
| o.texcoord = TRANSFORM_TEX(v.texcoord,_MainTex); | ||
| return o; | ||
| } | ||
|
|
||
| sampler2D _CameraDepthTexture; | ||
| float _InvFade; | ||
|
|
||
| fixed4 frag (v2f i) : COLOR | ||
| { | ||
| #ifdef SOFTPARTICLES_ON | ||
| float sceneZ = LinearEyeDepth (UNITY_SAMPLE_DEPTH(tex2Dproj(_CameraDepthTexture, UNITY_PROJ_COORD(i.projPos)))); | ||
| float partZ = i.projPos.z; | ||
| float fade = saturate (_InvFade * (sceneZ-partZ)); | ||
| i.color.a *= fade; | ||
| #endif | ||
| fixed4 c = 4.0f * i.color * _TintColor * tex2D(_MainTex, i.texcoord); | ||
| c.rgb += (_TintColor.rgb * 0.8f); | ||
| return c; | ||
| } | ||
| ENDCG | ||
| } | ||
| } | ||
|
|
||
| // ---- Dual texture cards | ||
| SubShader | ||
| { | ||
| Pass | ||
| { | ||
| SetTexture [_MainTex] | ||
| { | ||
| constantColor [_TintColor] | ||
| combine constant * primary | ||
| } | ||
| SetTexture [_MainTex] | ||
| { | ||
| combine texture * previous DOUBLE | ||
| } | ||
| } | ||
| } | ||
|
|
||
| // ---- Single texture cards (does not do color tint) | ||
| SubShader | ||
| { | ||
| Pass | ||
| { | ||
| SetTexture [_MainTex] | ||
| { | ||
| combine texture * primary | ||
| } | ||
| } | ||
| } | ||
| } | ||
| } |
| @@ -0,0 +1,108 @@ | ||
| Shader "Cartoon FX/Alpha Blended Tint" | ||
| { | ||
| Properties | ||
| { | ||
| _TintColor ("Tint Color", Color) = (0.5,0.5,0.5,0.5) | ||
| _MainTex ("Particle Texture", 2D) = "white" {} | ||
| } | ||
|
|
||
| Category | ||
| { | ||
| Tags { "Queue"="Transparent" "IgnoreProjector"="True" "RenderType"="Transparent" } | ||
| Blend SrcAlpha OneMinusSrcAlpha | ||
| AlphaTest Greater .01 | ||
| ColorMask RGB | ||
| Cull Off Lighting Off ZWrite Off | ||
| BindChannels | ||
| { | ||
| Bind "Color", color | ||
| Bind "Vertex", vertex | ||
| Bind "TexCoord", texcoord | ||
| } | ||
|
|
||
| // ---- Fragment program cards | ||
| SubShader | ||
| { | ||
| Pass | ||
| { | ||
|
|
||
| CGPROGRAM | ||
| #pragma vertex vert | ||
| #pragma fragment frag | ||
| #pragma fragmentoption ARB_precision_hint_fastest | ||
| #pragma multi_compile_particles | ||
|
|
||
| #include "UnityCG.cginc" | ||
|
|
||
| sampler2D _MainTex; | ||
| fixed4 _TintColor; | ||
|
|
||
| struct appdata_t | ||
| { | ||
| float4 vertex : POSITION; | ||
| float3 normal : NORMAL; | ||
| fixed4 color : COLOR; | ||
| float2 texcoord : TEXCOORD0; | ||
| }; | ||
|
|
||
| struct v2f | ||
| { | ||
| float4 vertex : POSITION; | ||
| float3 normal : TEXCOORD3; | ||
| fixed4 color : COLOR; | ||
| float2 texcoord : TEXCOORD0; | ||
| }; | ||
|
|
||
| float4 _MainTex_ST; | ||
|
|
||
| v2f vert (appdata_t v) | ||
| { | ||
| v2f o; | ||
| o.vertex = mul(UNITY_MATRIX_MVP, v.vertex); | ||
| o.color = v.color; | ||
| o.texcoord = TRANSFORM_TEX(v.texcoord,_MainTex); | ||
| o.normal = v.normal; | ||
|
|
||
| return o; | ||
| } | ||
|
|
||
| sampler2D _CameraDepthTexture; | ||
|
|
||
| fixed4 frag (v2f i) : COLOR | ||
| { | ||
| return 2.0f * i.color * _TintColor * tex2D(_MainTex, i.texcoord).a; | ||
| } | ||
| ENDCG | ||
| } | ||
| } | ||
|
|
||
| // ---- Dual texture cards | ||
| SubShader | ||
| { | ||
| Pass | ||
| { | ||
| SetTexture [_MainTex] | ||
| { | ||
| constantColor [_TintColor] | ||
| combine constant * primary | ||
| } | ||
| SetTexture [_MainTex] | ||
| { | ||
| combine texture * previous DOUBLE | ||
| } | ||
| } | ||
| } | ||
|
|
||
| // ---- Single texture cards (does not do color tint) | ||
| SubShader | ||
| { | ||
| Pass | ||
| { | ||
| SetTexture [_MainTex] | ||
| { | ||
| combine texture * primary | ||
| } | ||
| } | ||
| } | ||
| } | ||
| } |
| @@ -0,0 +1,41 @@ | ||
| // Simplified Additive Particle shader. Differences from regular Additive Particle one: | ||
| // - no Tint color | ||
| // - no Smooth particle support | ||
| // - no AlphaTest | ||
| // - no ColorMask | ||
|
|
||
| // Cartoon FX difference: | ||
| // - uses Alpha8 monochrome textures to save up on texture memory size | ||
|
|
||
| Shader "Cartoon FX/Particles Additive Alpha8" | ||
| { | ||
| Properties | ||
| { | ||
| _MainTex ("Particle Texture (Alpha8)", 2D) = "white" {} | ||
| } | ||
|
|
||
| Category | ||
| { | ||
| Tags { "Queue"="Transparent" "IgnoreProjector"="True" "RenderType"="Transparent" } | ||
| Blend SrcAlpha One | ||
| Cull Off Lighting Off ZWrite Off Fog { Color (0,0,0,0) } | ||
|
|
||
| BindChannels | ||
| { | ||
| Bind "Color", color | ||
| Bind "Vertex", vertex | ||
| Bind "TexCoord", texcoord | ||
| } | ||
|
|
||
| SubShader | ||
| { | ||
| Pass | ||
| { | ||
| SetTexture [_MainTex] | ||
| { | ||
| combine primary, texture * primary | ||
| } | ||
| } | ||
| } | ||
| } | ||
| } |
| @@ -0,0 +1,80 @@ | ||
| %YAML 1.1 | ||
| %TAG !u! tag:unity3d.com,2011: | ||
| --- !u!1 &100000 | ||
| GameObject: | ||
| m_ObjectHideFlags: 0 | ||
| m_PrefabParentObject: {fileID: 0} | ||
| m_PrefabInternal: {fileID: 100100000} | ||
| serializedVersion: 4 | ||
| m_Component: | ||
| - 4: {fileID: 400000} | ||
| - 114: {fileID: 11400002} | ||
| - 114: {fileID: 11400000} | ||
| m_Layer: 0 | ||
| m_Name: SpawnSystem Template | ||
| m_TagString: Untagged | ||
| m_Icon: {fileID: 0} | ||
| m_NavMeshLayer: 0 | ||
| m_StaticEditorFlags: 0 | ||
| m_IsActive: 1 | ||
| --- !u!4 &400000 | ||
| Transform: | ||
| m_ObjectHideFlags: 1 | ||
| m_PrefabParentObject: {fileID: 0} | ||
| m_PrefabInternal: {fileID: 100100000} | ||
| m_GameObject: {fileID: 100000} | ||
| m_LocalRotation: {x: 0, y: 0, z: 0, w: 1} | ||
| m_LocalPosition: {x: 0, y: 0, z: 0} | ||
| m_LocalScale: {x: 1, y: 1, z: 1} | ||
| m_Children: [] | ||
| m_Father: {fileID: 0} | ||
| --- !u!114 &11400000 | ||
| MonoBehaviour: | ||
| m_ObjectHideFlags: 1 | ||
| m_PrefabParentObject: {fileID: 0} | ||
| m_PrefabInternal: {fileID: 100100000} | ||
| m_GameObject: {fileID: 100000} | ||
| m_Enabled: 1 | ||
| m_EditorHideFlags: 0 | ||
| m_Script: {fileID: 11500000, guid: ec1683be71e02f548b9023d92d51ac31, type: 3} | ||
| m_Name: | ||
| m_EditorClassIdentifier: | ||
| objectsToPreload: [] | ||
| objectsToPreloadTimes: | ||
| hideObjectsInHierarchy: 0 | ||
| --- !u!114 &11400002 | ||
| MonoBehaviour: | ||
| m_ObjectHideFlags: 1 | ||
| m_PrefabParentObject: {fileID: 0} | ||
| m_PrefabInternal: {fileID: 100100000} | ||
| m_GameObject: {fileID: 100000} | ||
| m_Enabled: 1 | ||
| m_EditorHideFlags: 0 | ||
| m_Script: {fileID: 11500000, guid: 79c859f5f7a87c8438b7a5e91d7f499e, type: 3} | ||
| m_Name: | ||
| m_EditorClassIdentifier: | ||
| Locked: 1 | ||
| Title: SPAWN SYSTEM TEMPLATE | ||
| HelpText: 'Drop this template in your Scene and drag/drop the effect Prefabs you | ||
| want to preload on the CFX_SpawnSystem inspector. | ||
| You can then use: | ||
| CFX_SpawnSystem.GetNextObject(prefab); | ||
| to get instances from the pool, where prefab is a reference to any Prefab you | ||
| dropped on the CFX_SpawnSystem inspector.' | ||
| MsgType: 1 | ||
| --- !u!1001 &100100000 | ||
| Prefab: | ||
| m_ObjectHideFlags: 1 | ||
| serializedVersion: 2 | ||
| m_Modification: | ||
| m_TransformParent: {fileID: 0} | ||
| m_Modifications: [] | ||
| m_RemovedComponents: [] | ||
| m_ParentPrefab: {fileID: 0} | ||
| m_RootGameObject: {fileID: 100000} | ||
| m_IsPrefabParent: 1 | ||
| m_IsExploded: 1 |