VFX for abilities

dev-ali
Ali Sharoz 2 days ago
parent 3850e59fb5
commit e26bd70115

@ -0,0 +1,8 @@
fileFormatVersion: 2
guid: c865e48369a325f4784ecd8444d1ec51
folderAsset: yes
DefaultImporter:
externalObjects: {}
userData:
assetBundleName:
assetBundleVariant:

@ -0,0 +1,8 @@
fileFormatVersion: 2
guid: f348a2fb2f8a7fe4e82fb08818415884
folderAsset: yes
DefaultImporter:
externalObjects: {}
userData:
assetBundleName:
assetBundleVariant:

@ -0,0 +1,8 @@
fileFormatVersion: 2
guid: f991151302bbc8440bc158a1be7d008d
folderAsset: yes
DefaultImporter:
externalObjects: {}
userData:
assetBundleName:
assetBundleVariant:

@ -0,0 +1,8 @@
fileFormatVersion: 2
guid: e427a3233ad87024e9480ecb6a128456
labels:
- cartoonfx
- ground
- light
- particles
- toon

@ -0,0 +1,8 @@
fileFormatVersion: 2
guid: e6fdcf828c6e2b0449c56aec449fa3c5
folderAsset: yes
DefaultImporter:
externalObjects: {}
userData:
assetBundleName:
assetBundleVariant:

File diff suppressed because it is too large Load Diff

@ -0,0 +1,7 @@
fileFormatVersion: 2
guid: b2165fbc1d575ee4098e242f632ed259
DefaultImporter:
externalObjects: {}
userData:
assetBundleName:
assetBundleVariant:

@ -0,0 +1,66 @@
%YAML 1.1
%TAG !u! tag:unity3d.com,2011:
--- !u!850595691 &4890085278179872738
LightingSettings:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_Name: CFX1 DemoSettings
serializedVersion: 6
m_GIWorkflowMode: 1
m_EnableBakedLightmaps: 1
m_EnableRealtimeLightmaps: 0
m_RealtimeEnvironmentLighting: 1
m_BounceScale: 1
m_AlbedoBoost: 1
m_IndirectOutputScale: 1
m_UsingShadowmask: 0
m_BakeBackend: 0
m_LightmapMaxSize: 1024
m_BakeResolution: 50
m_Padding: 2
m_LightmapCompression: 0
m_AO: 0
m_AOMaxDistance: 1
m_CompAOExponent: 0
m_CompAOExponentDirect: 0
m_ExtractAO: 0
m_MixedBakeMode: 1
m_LightmapsBakeMode: 1
m_FilterMode: 1
m_LightmapParameters: {fileID: 15204, guid: 0000000000000000f000000000000000, type: 0}
m_ExportTrainingData: 0
m_TrainingDataDestination: TrainingData
m_RealtimeResolution: 1
m_ForceWhiteAlbedo: 0
m_ForceUpdates: 0
m_FinalGather: 0
m_FinalGatherRayCount: 1024
m_FinalGatherFiltering: 1
m_PVRCulling: 1
m_PVRSampling: 1
m_PVRDirectSampleCount: 32
m_PVRSampleCount: 512
m_PVREnvironmentSampleCount: 512
m_PVREnvironmentReferencePointCount: 2048
m_LightProbeSampleCountMultiplier: 4
m_PVRBounces: 2
m_PVRMinBounces: 2
m_PVREnvironmentImportanceSampling: 0
m_PVRFilteringMode: 2
m_PVRDenoiserTypeDirect: 0
m_PVRDenoiserTypeIndirect: 0
m_PVRDenoiserTypeAO: 0
m_PVRFilterTypeDirect: 0
m_PVRFilterTypeIndirect: 0
m_PVRFilterTypeAO: 0
m_PVRFilteringGaussRadiusDirect: 1
m_PVRFilteringGaussRadiusIndirect: 5
m_PVRFilteringGaussRadiusAO: 2
m_PVRFilteringAtrousPositionSigmaDirect: 0.5
m_PVRFilteringAtrousPositionSigmaIndirect: 2
m_PVRFilteringAtrousPositionSigmaAO: 1
m_PVRTiledBaking: 0
m_NumRaysToShootPerTexel: -1
m_RespectSceneVisibilityWhenBakingGI: 0

@ -0,0 +1,8 @@
fileFormatVersion: 2
guid: bada21239a0529b439536bfd0e91c874
NativeFormatImporter:
externalObjects: {}
mainObjectFileID: 4890085278179872738
userData:
assetBundleName:
assetBundleVariant:

@ -0,0 +1,8 @@
fileFormatVersion: 2
guid: 7a7171bf41aeb6949b08451fbcd42dd7
folderAsset: yes
DefaultImporter:
externalObjects: {}
userData:
assetBundleName:
assetBundleVariant:

@ -0,0 +1,8 @@
fileFormatVersion: 2
guid: ef74fe7f8dfc6894481d107231650819
folderAsset: yes
DefaultImporter:
externalObjects: {}
userData:
assetBundleName:
assetBundleVariant:

@ -0,0 +1,7 @@
fileFormatVersion: 2
guid: d56b3c7055d81cb44803b5d7db4b65e0
MonoImporter:
serializedVersion: 2
defaultReferences: []
executionOrder: 0
icon: {instanceID: 0}

@ -1,12 +1,12 @@
using System.Collections.Generic;
using UnityEngine;
using UnityEngine.Rendering;
#if UNITY_EDITOR
using UnityEditor;
#endif
namespace CartoonFX
{
[RequireComponent(typeof(ParticleSystem))]
public partial class CFXR_Effect : MonoBehaviour
{
[System.Serializable]
@ -49,17 +49,6 @@ namespace CartoonFX
static bool s_CallbackRegistered;
static List<CameraShake> s_CameraShakes = new List<CameraShake>();
#if UNITY_2019_1_OR_NEWER
static void OnPreRenderCamera_Static_URP(ScriptableRenderContext context, Camera cam)
{
OnPreRenderCamera_Static(cam);
}
static void OnPostRenderCamera_Static_URP(ScriptableRenderContext context, Camera cam)
{
OnPostRenderCamera_Static(cam);
}
#endif
static void OnPreRenderCamera_Static(Camera cam)
{
int count = s_CameraShakes.Count;
@ -86,27 +75,8 @@ namespace CartoonFX
if (!s_CallbackRegistered)
{
#if UNITY_2019_1_OR_NEWER
#if UNITY_2019_3_OR_NEWER
if (GraphicsSettings.currentRenderPipeline == null)
#else
if (GraphicsSettings.renderPipelineAsset == null)
#endif
{
// Built-in Render Pipeline
Camera.onPreRender += OnPreRenderCamera_Static;
Camera.onPostRender += OnPostRenderCamera_Static;
}
else
{
// URP
RenderPipelineManager.beginCameraRendering += OnPreRenderCamera_Static_URP;
RenderPipelineManager.endCameraRendering += OnPostRenderCamera_Static_URP;
}
#else
Camera.onPreRender += OnPreRenderCamera_Static;
Camera.onPostRender += OnPostRenderCamera_Static;
#endif
s_CallbackRegistered = true;
}
@ -118,27 +88,8 @@ namespace CartoonFX
if (s_CallbackRegistered && s_CameraShakes.Count == 0)
{
#if UNITY_2019_1_OR_NEWER
#if UNITY_2019_3_OR_NEWER
if (GraphicsSettings.currentRenderPipeline == null)
#else
if (GraphicsSettings.renderPipelineAsset == null)
#endif
{
// Built-in Render Pipeline
Camera.onPreRender -= OnPreRenderCamera_Static;
Camera.onPostRender -= OnPostRenderCamera_Static;
}
else
{
// URP
RenderPipelineManager.beginCameraRendering -= OnPreRenderCamera_Static_URP;
RenderPipelineManager.endCameraRendering -= OnPostRenderCamera_Static_URP;
}
#else
Camera.onPreRender -= OnPreRenderCamera_Static;
Camera.onPostRender -= OnPostRenderCamera_Static;
#endif
s_CallbackRegistered = false;
}
@ -160,8 +111,6 @@ namespace CartoonFX
{
camerasPreRenderPosition[cam] = cam.transform.localPosition;
if (Time.timeScale <= 0) return;
switch (shakeSpace)
{
case ShakeSpace.Screen: cam.transform.localPosition += cam.transform.rotation * shakeVector; break;
@ -275,7 +224,8 @@ namespace CartoonFX
var randomVec = new Vector3(Random.value, Random.value, Random.value);
var shakeVec = Vector3.Scale(randomVec, shakeStrength) * (Random.value > 0.5f ? -1 : 1);
shakeVector = shakeVec * shakeCurve.Evaluate(delta) * GLOBAL_CAMERA_SHAKE_MULTIPLIER;
shakeVector = Vector3.Lerp(Vector3.zero, shakeVec, shakeCurve.Evaluate(delta));
//shakeVector = shakeVec * shakeCurve.Evaluate(delta); // TODO this is the same?
}
else if (isShaking)
{

@ -3,17 +3,11 @@
// (c) 2012-2020 Jean Moreno
//--------------------------------------------------------------------------------------------------------------------------------
//--------------------------------------------------------------------------------------------------------------------------------
// Use the defines below to globally disable features:
//#define DISABLE_CAMERA_SHAKE
//#define DISABLE_LIGHTS
//#define DISABLE_CLEAR_BEHAVIOR
//--------------------------------------------------------------------------------------------------------------------------------
using UnityEngine;
#if UNITY_EDITOR
using UnityEditor;
@ -22,12 +16,8 @@ using UnityEditor;
namespace CartoonFX
{
[RequireComponent(typeof(ParticleSystem))]
[DisallowMultipleComponent]
public partial class CFXR_Effect : MonoBehaviour
{
// Change this value to easily tune the camera shake strength for all effects
const float GLOBAL_CAMERA_SHAKE_MULTIPLIER = 1.0f;
#if UNITY_EDITOR
[InitializeOnLoadMethod]
static void InitGlobalOptions()
@ -454,8 +444,6 @@ namespace CartoonFX
float time;
ParticleSystem rootParticleSystem;
[System.NonSerialized] MaterialPropertyBlock materialPropertyBlock;
[System.NonSerialized] Renderer particleRenderer;
// ================================================================================================================================
@ -495,12 +483,6 @@ namespace CartoonFX
#if !DISABLE_CLEAR_BEHAVIOR
startFrameOffset = GlobalStartFrameOffset++;
#endif
// Detect if world position needs to be passed to the shader
particleRenderer = this.GetComponent<ParticleSystemRenderer>();
if (particleRenderer.sharedMaterial != null && particleRenderer.sharedMaterial.IsKeywordEnabled("_CFXR_LIGHTING_WPOS_OFFSET"))
{
materialPropertyBlock = new MaterialPropertyBlock();
}
}
#endif
@ -565,12 +547,6 @@ namespace CartoonFX
}
}
#endif
if (materialPropertyBlock != null)
{
particleRenderer.GetPropertyBlock(materialPropertyBlock);
materialPropertyBlock.SetVector("_GameObjectWorldPosition", this.transform.position);
particleRenderer.SetPropertyBlock(materialPropertyBlock);
}
}
#endif
@ -692,19 +668,6 @@ namespace CartoonFX
return;
}
var renderer = this.GetComponent<ParticleSystemRenderer>();
if (renderer.sharedMaterial != null && renderer.sharedMaterial.IsKeywordEnabled("_CFXR_LIGHTING_WPOS_OFFSET"))
{
if (materialPropertyBlock == null)
{
materialPropertyBlock = new MaterialPropertyBlock();
}
renderer.GetPropertyBlock(materialPropertyBlock);
materialPropertyBlock.SetVector("_GameObjectWorldPosition", this.transform.position);
renderer.SetPropertyBlock(materialPropertyBlock);
}
// Need to track unwrapped time when playing back from Editor
// because the parentParticle.time will be reset at each loop
float delta = parentParticle.time - particleTime;

@ -1,11 +1,10 @@
//--------------------------------------------------------------------------------------------------------------------------------
// Cartoon FX
// (c) 2012-2022 Jean Moreno
// (c) 2012-2020 Jean Moreno
//--------------------------------------------------------------------------------------------------------------------------------
using System.Collections.Generic;
using UnityEngine;
using Object = UnityEngine.Object;
#if UNITY_EDITOR
using UnityEditor;
#endif
@ -15,38 +14,33 @@ namespace CartoonFX
[RequireComponent(typeof(ParticleSystem))]
public class CFXR_ParticleText : MonoBehaviour
{
[Header("Dynamic")]
[Tooltip("Allow changing the text at runtime with the 'UpdateText' method. If disabled, this script will be excluded from the build.")]
public bool isDynamic;
#if UNITY_EDITOR
[Header("Text")]
[SerializeField] string text;
[SerializeField] float size = 1f;
[SerializeField] float letterSpacing = 0.44f;
public string text;
public float size = 1f;
public float letterSpacing = 0.44f;
[Header("Colors")]
[SerializeField] Color backgroundColor = new Color(0, 0, 0, 1);
[SerializeField] Color color1 = new Color(1, 1, 1, 1);
[SerializeField] Color color2 = new Color(0, 0, 1, 1);
public Color backgroundColor = new Color(0, 0, 0, 1);
public Color color1 = new Color(1, 1, 1, 1);
public Color color2 = new Color(0, 0, 1, 1);
[Header("Delay")]
[SerializeField] float delay = 0.05f;
[SerializeField] bool cumulativeDelay = false;
[Range(0f, 2f)] [SerializeField] float compensateLifetime = 0;
public float delay = 0.05f;
public bool cumulativeDelay = false;
[Range(0f, 2f)] public float compensateLifetime = 0;
[Header("Misc")]
[SerializeField] float lifetimeMultiplier = 1f;
[Range(-90f, 90f)] [SerializeField] float rotation = -5f;
[SerializeField] float sortingFudgeOffset = 0.1f;
#pragma warning disable 0649
[SerializeField] CFXR_ParticleTextFontAsset font;
#pragma warning restore 0649
#if UNITY_EDITOR
[HideInInspector] [SerializeField] bool autoUpdateEditor = true;
public float lifetimeMultiplier = 1f;
[Range(-90f, 90f)] public float rotation = -5f;
public float sortingFudgeOffset = 0.1f;
public CFXR_ParticleTextFontAsset font;
public KeyCode refreshTextKey = KeyCode.R;
void OnValidate()
{
this.hideFlags = HideFlags.DontSaveInBuild;
if (text == null || font == null)
{
return;
@ -55,16 +49,7 @@ namespace CartoonFX
// parse text to only allow valid characters
List<char> allowed = new List<char>(font.CharSequence.ToCharArray());
allowed.Add(' ');
char[] chars;
switch (font.letterCase)
{
case CFXR_ParticleTextFontAsset.LetterCase.Lower: chars = text.ToLowerInvariant().ToCharArray(); break;
case CFXR_ParticleTextFontAsset.LetterCase.Upper: chars = text.ToUpperInvariant().ToCharArray(); break;
default:
case CFXR_ParticleTextFontAsset.LetterCase.Both: chars = text.ToCharArray(); break;
}
var chars = text.ToUpperInvariant().ToCharArray();
string newText = "";
foreach (var c in chars)
{
@ -73,149 +58,44 @@ namespace CartoonFX
newText += c;
}
}
text = newText;
// prevent negative or 0 size
size = Mathf.Max(0.001f, size);
// delay so that we are allowed to destroy GameObjects
if (autoUpdateEditor && !EditorApplication.isPlayingOrWillChangePlaymode)
{
EditorApplication.delayCall += () => { UpdateText(null); };
}
}
#endif
void Awake()
{
if (!isDynamic)
{
Destroy(this);
return;
}
InitializeFirstParticle();
}
float baseLifetime;
float baseScaleX;
float baseScaleY;
float baseScaleZ;
Vector3 basePivot;
void InitializeFirstParticle()
{
if (isDynamic && this.transform.childCount == 0)
{
throw new System.Exception("[CFXR_ParticleText] A disabled GameObject with a ParticleSystem component is required as the first child when 'isDyanmic' is enabled, so that its settings can be used as a base for the generated characters.");
}
var ps = isDynamic ? this.transform.GetChild(0).GetComponent<ParticleSystem>() : this.GetComponent<ParticleSystem>();
var main = ps.main;
baseLifetime = main.startLifetime.constant;
baseScaleX = main.startSizeXMultiplier;
baseScaleY = main.startSizeYMultiplier;
baseScaleZ = main.startSizeZMultiplier;
basePivot = ps.GetComponent<ParticleSystemRenderer>().pivot;
if (isDynamic)
{
basePivot.x = 0; // make sure to not offset the text horizontally
ps.gameObject.SetActive(false); // ensure first child is inactive
ps.gameObject.name = "MODEL";
}
}
public void UpdateText(
string newText = null,
float? newSize = null,
Color? newColor1 = null, Color? newColor2 = null, Color? newBackgroundColor = null,
float? newLifetimeMultiplier = null
)
{
#if UNITY_EDITOR
// Only allow updating text for GameObjects that aren't prefabs, since we are possibly destroying/adding GameObjects
if (this == null)
{
return;
}
var prefabInstanceStatus = PrefabUtility.GetPrefabInstanceStatus(this);
var prefabAssetType = PrefabUtility.GetPrefabAssetType(this);
if (!(prefabInstanceStatus == PrefabInstanceStatus.NotAPrefab && prefabAssetType == PrefabAssetType.NotAPrefab))
public void GenerateText()
{
if (text == null || font == null || !font.IsValid())
return;
}
if (!Application.isPlaying)
{
InitializeFirstParticle();
}
#endif
if (Application.isPlaying && !isDynamic)
{
throw new System.Exception("[CFXR_ParticleText] You cannot update the text at runtime if it's not marked as dynamic.");
}
if (newText != null)
// delete all children
int length = this.transform.childCount;
int overflow = 0;
while (this.transform.childCount > 0)
{
switch (font.letterCase)
Object.DestroyImmediate(this.transform.GetChild(0).gameObject);
overflow++;
if (overflow > 1000)
{
case CFXR_ParticleTextFontAsset.LetterCase.Lower:
newText = newText.ToLowerInvariant();
break;
case CFXR_ParticleTextFontAsset.LetterCase.Upper:
newText = newText.ToUpperInvariant();
// just in case...
Debug.LogError("Overflow!");
break;
}
// Verify that new text doesn't contain invalid characters
foreach (char c in newText)
{
if (char.IsWhiteSpace(c)) continue;
if (font.CharSequence.IndexOf(c) < 0)
{
throw new System.Exception("[CFXR_ParticleText] Invalid character supplied for the dynamic text: '" + c + "'\nThe allowed characters from the selected font are: " + font.CharSequence);
}
}
this.text = newText;
}
if (newSize != null) this.size = newSize.Value;
if (newColor1 != null) this.color1 = newColor1.Value;
if (newColor2 != null) this.color2 = newColor2.Value;
if (newBackgroundColor != null) this.backgroundColor = newBackgroundColor.Value;
if (newLifetimeMultiplier != null) this.lifetimeMultiplier = newLifetimeMultiplier.Value;
if (text == null || font == null || !font.IsValid())
{
return;
}
if (this.transform.childCount == 0)
// create one particle per character
if (!string.IsNullOrEmpty(text))
{
throw new System.Exception("[CFXR_ParticleText] A disabled GameObject with a ParticleSystem component is required as the first child when 'isDyanmic' is enabled, so that its settings can be used as a base for the generated characters.");
}
// process text and calculate total width offset
// calculate total width offset
float totalWidth = 0f;
int charCount = 0;
for (int i = 0; i < text.Length; i++)
for (int i = 1; i < text.Length; i++)
{
if (char.IsWhiteSpace(text[i]))
{
if (i > 0)
{
totalWidth += letterSpacing * size;
}
}
else
{
charCount++;
if (i > 0)
{
int index = font.CharSequence.IndexOf(text[i]);
var sprite = font.CharSprites[index];
@ -223,59 +103,9 @@ namespace CartoonFX
totalWidth += (charWidth * 0.01f + letterSpacing) * size;
}
}
}
#if UNITY_EDITOR
// delete all children in editor, to make sure we refresh the particle systems based on the first one
if (!Application.isPlaying)
{
int length = this.transform.childCount;
int overflow = 0;
while (this.transform.childCount > 1)
{
Object.DestroyImmediate(this.transform.GetChild(this.transform.childCount - 1).gameObject);
overflow++;
if (overflow > 1000)
{
// just in case...
Debug.LogError("Overflow!");
break;
}
}
}
#endif
if (charCount > 0)
{
// calculate needed instances
int childCount = this.transform.childCount - (isDynamic ? 1 : 0); // first one is the particle source and always deactivated
if (childCount < charCount)
{
// instantiate new letter GameObjects if needed
GameObject model = isDynamic ? this.transform.GetChild(0).gameObject : null;
for (int i = childCount; i < charCount; i++)
{
var newLetter = isDynamic ? Instantiate(model, this.transform) : new GameObject();
if (!isDynamic)
{
newLetter.transform.SetParent(this.transform);
newLetter.AddComponent<ParticleSystem>();
}
newLetter.transform.localPosition = Vector3.zero;
newLetter.transform.localRotation = Quaternion.identity;
}
}
// update each letter
float offset = totalWidth/2f;
totalWidth = 0f;
int currentChild = isDynamic ? 0 : -1;
// when not dynamic, we use CopySerialized to propagate the settings to the instances
var sourceParticle = isDynamic ? null : this.GetComponent<ParticleSystem>();
var sourceParticleRenderer = this.GetComponent<ParticleSystemRenderer>();
for (int i = 0; i < text.Length; i++)
{
var letter = text[i];
@ -285,7 +115,6 @@ namespace CartoonFX
}
else
{
currentChild++;
int index = font.CharSequence.IndexOf(text[i]);
var sprite = font.CharSprites[index];
@ -298,120 +127,121 @@ namespace CartoonFX
float charWidth = sprite.rect.width + font.CharKerningOffsets[index].post;
totalWidth += (charWidth * 0.01f + letterSpacing) * size;
// update particle system for this letter
var letterObj = this.transform.GetChild(currentChild).gameObject;
letterObj.name = letter.ToString();
// create gameobject with particle system
var letterObj = new GameObject(letter.ToString(), typeof(ParticleSystem));
letterObj.transform.SetParent(this.transform);
letterObj.transform.localPosition = Vector3.zero;
letterObj.transform.localRotation = Quaternion.identity;
var ps = letterObj.GetComponent<ParticleSystem>();
#if UNITY_EDITOR
if (!isDynamic)
{
var sourceParticle = this.GetComponent<ParticleSystem>();
EditorUtility.CopySerialized(sourceParticle, ps);
ps.gameObject.SetActive(true);
}
#endif
letterObj.name = letter.ToString();
var mainModule = ps.main;
mainModule.startSizeXMultiplier = baseScaleX * ratio;
mainModule.startSizeYMultiplier = baseScaleY * ratio;
mainModule.startSizeZMultiplier = baseScaleZ * ratio;
// set particle system parameters
var main = ps.main;
main.startSizeXMultiplier *= ratio;
main.startSizeYMultiplier *= ratio;
main.startSizeZMultiplier *= ratio;
ps.textureSheetAnimation.SetSprite(0, sprite);
mainModule.startRotation = Mathf.Deg2Rad * rotation;
mainModule.startColor = backgroundColor;
main.startRotation = Mathf.Deg2Rad * rotation;
main.startColor = backgroundColor;
var customData = ps.customData;
customData.enabled = true;
customData.SetColor(ParticleSystemCustomData.Custom1, color1);
customData.SetColor(ParticleSystemCustomData.Custom2, color2);
var cd = ps.customData;
cd.enabled = true;
cd.SetColor(ParticleSystemCustomData.Custom1, color1);
cd.SetColor(ParticleSystemCustomData.Custom2, color2);
if (cumulativeDelay)
{
mainModule.startDelay = delay * i;
mainModule.startLifetime = Mathf.LerpUnclamped(baseLifetime, baseLifetime + (delay * (text.Length - i)), compensateLifetime / lifetimeMultiplier);
main.startDelay = delay * i;
main.startLifetime = Mathf.LerpUnclamped(main.startLifetime.constant, main.startLifetime.constant + (delay * (text.Length-i)), compensateLifetime);
}
else
{
mainModule.startDelay = delay;
main.startDelay = delay;
}
mainModule.startLifetime = mainModule.startLifetime.constant * lifetimeMultiplier;
main.startLifetime = main.startLifetime.constant * lifetimeMultiplier;
// particle system renderer parameters
var particleRenderer = ps.GetComponent<ParticleSystemRenderer>();
#if UNITY_EDITOR
if (!isDynamic)
{
EditorUtility.CopySerialized(sourceParticleRenderer, particleRenderer);
}
#endif
particleRenderer.enabled = true;
particleRenderer.pivot = new Vector3(basePivot.x + position, basePivot.y, basePivot.z);
particleRenderer.sortingFudge += i * sortingFudgeOffset;
var psr = ps.GetComponent<ParticleSystemRenderer>();
var sourceParticleRenderer = this.GetComponent<ParticleSystemRenderer>();
EditorUtility.CopySerialized(sourceParticleRenderer, psr);
psr.enabled = true;
psr.pivot = new Vector3(psr.pivot.x + position, psr.pivot.y, psr.pivot.z);
psr.sortingFudge += i * sortingFudgeOffset;
}
}
}
// set active state for needed letters only
for (int i = 1, l = this.transform.childCount; i < l; i++)
// restart particle system
updateFrame = 0;
if (!editorUpdateSubscribed)
{
this.transform.GetChild(i).gameObject.SetActive(i <= charCount);
editorUpdateSubscribed = true;
EditorApplication.update += RestartParticleSystem;
}
}
#if UNITY_EDITOR
// automatically play the effect in Editor
if (!Application.isPlaying)
int updateFrame = 0;
bool editorUpdateSubscribed = false;
void RestartParticleSystem()
{
this.GetComponent<ParticleSystem>().Clear(true);
this.GetComponent<ParticleSystem>().Play(true);
var particleSystem = this.GetComponent<ParticleSystem>();
if (updateFrame == 0)
{
particleSystem.Play(true);
}
#endif
else if (updateFrame == 5)
{
particleSystem.time = 0f;
EditorApplication.update -= RestartParticleSystem;
editorUpdateSubscribed = false;
}
updateFrame++;
}
#endif
}
#if UNITY_EDITOR
[CustomEditor(typeof(CFXR_ParticleText))]
public class ParticleTextEditor : Editor
{
CFXR_ParticleText CastTarget
{
get { return (CFXR_ParticleText) this.target; }
}
GUIContent GUIContent_AutoUpdateToggle = new GUIContent("Auto-update", "Automatically regenerate the text when a property is changed.");
GUIContent GUIContent_UpdateTextButton = new GUIContent(" Update Text ", "Regenerate the text and create new letter GameObjects if needed.");
public override void OnInspectorGUI()
{
var prefab = PrefabUtility.GetPrefabInstanceStatus(target);
if (prefab != PrefabInstanceStatus.NotAPrefab)
{
EditorGUILayout.HelpBox("Cartoon FX Particle Text doesn't work on Prefab Instances, as it needs to destroy/create children GameObjects.\nYou can right-click on the object, and select \"Unpack Prefab\" to make it an independent Game Object.",
EditorGUILayout.HelpBox("Cartoon FX Particle Text doesn't work on Prefab Instances, as it needs to destroy/create children GameObjects.\nYou can right-click on the object, and select \"Unpack Prefab Completely\" to make it an independent Game Object.",
MessageType.Warning);
return;
}
base.OnInspectorGUI();
serializedObject.Update();
SerializedProperty autoUpdateBool = serializedObject.FindProperty("autoUpdateEditor");
GUILayout.Space(8);
GUILayout.BeginHorizontal();
{
GUILayout.FlexibleSpace();
autoUpdateBool.boolValue = GUILayout.Toggle(autoUpdateBool.boolValue, GUIContent_AutoUpdateToggle, GUILayout.Height(30));
if (GUILayout.Button(GUIContent_UpdateTextButton, GUILayout.Height(30)))
bool refresh = GUILayout.Button(" Refresh Text ", GUILayout.Height(30)) || GUI.changed;
GUILayout.EndHorizontal();
if (((CFXR_ParticleText)target).refreshTextKey != KeyCode.None && Event.current.type == EventType.KeyDown)
{
CastTarget.UpdateText(null);
if (Event.current.keyCode == ((CFXR_ParticleText)target).refreshTextKey)
{
Event.current.Use();
refresh = true;
}
}
GUILayout.EndHorizontal();
if (GUI.changed)
if (refresh)
{
serializedObject.ApplyModifiedProperties();
Undo.RecordObject(this.target, "Generate Particle Text");
(this.target as CFXR_ParticleText).GenerateText();
}
}
}

@ -14,15 +14,8 @@ namespace CartoonFX
{
public class CFXR_ParticleTextFontAsset : ScriptableObject
{
public enum LetterCase
{
Both,
Upper,
Lower
}
#if UNITY_EDITOR
public string CharSequence = "ABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789!?-.#@$ ";
public LetterCase letterCase = LetterCase.Upper;
public Sprite[] CharSprites;
public Kerning[] CharKerningOffsets;
@ -36,7 +29,7 @@ namespace CartoonFX
void OnValidate()
{
this.hideFlags = HideFlags.None;
this.hideFlags = HideFlags.DontSaveInBuild;
if (CharKerningOffsets == null || CharKerningOffsets.Length != CharSequence.Length)
{
@ -60,8 +53,7 @@ namespace CartoonFX
return valid;
}
#if UNITY_EDITOR
// [MenuItem("Tools/Create font asset")]
[MenuItem("Tools/Create font asset")]
static void CreateFontAsset()
{
var instance = CreateInstance<CFXR_ParticleTextFontAsset>();

@ -5,7 +5,6 @@
using System.Collections.Generic;
using UnityEngine;
using UnityEngine.Rendering;
using UnityEngine.UI;
namespace CartoonFX
@ -117,13 +116,11 @@ namespace CartoonFX
public Text labelEffect;
public Text labelIndex;
[Space]
public GameObject groundURP;
public GameObject groundBIRP;
GameObject ground;
public GameObject ground;
public Collider groundCollider;
public Transform demoCamera;
public MonoBehaviour bloom;
public float rotationSpeed = 10f;
public float zoomFactor = 1f;
bool slowMotion = false;
bool rotateCamera = false;
@ -131,8 +128,8 @@ namespace CartoonFX
//----------------------------------------------------------------------------------------------------------------------------
[System.NonSerialized] public GameObject currentEffect;
GameObject[] effectsList;
GameObject currentEffect;
int index = 0;
Vector3 camInitialPosition;
@ -146,21 +143,12 @@ namespace CartoonFX
var list = new List<GameObject>();
for (int i = 0; i < this.transform.childCount; i++)
{
var effect = this.transform.GetChild(i).gameObject;
list.Add(effect);
var cfxrEffect= effect.GetComponent<CFXR_Effect>();
if (cfxrEffect != null) cfxrEffect.clearBehavior = CFXR_Effect.ClearBehavior.Disable;
list.Add(this.transform.GetChild(i).gameObject);
}
effectsList = list.ToArray();
PlayAtIndex();
UpdateLabels();
bool isURP = GraphicsSettings.currentRenderPipeline != null;
ground = isURP ? groundURP : groundBIRP;
groundURP.SetActive(isURP);
groundBIRP.SetActive(!isURP);
}
void Update()
@ -238,11 +226,11 @@ namespace CartoonFX
float scroll = Input.GetAxis("Mouse ScrollWheel");
if (scroll != 0f)
{
Camera.main.transform.Translate(Vector3.forward * (scroll < 0f ? -1f : 1f) * zoomFactor, Space.Self);
Camera.main.transform.Translate(Vector3.forward * (scroll < 0f ? -1f : 1f), Space.Self);
}
}
public void PlayAtIndex()
void PlayAtIndex()
{
if (currentEffect != null)
{

@ -0,0 +1,8 @@
fileFormatVersion: 2
guid: 2076145b3bfdcca4193bfd3effd1400f
folderAsset: yes
DefaultImporter:
externalObjects: {}
userData:
assetBundleName:
assetBundleVariant:

@ -0,0 +1,8 @@
fileFormatVersion: 2
guid: 086093bf5c1cde94a82a35d3a10ed3cb
folderAsset: yes
DefaultImporter:
externalObjects: {}
userData:
assetBundleName:
assetBundleVariant:

@ -0,0 +1,8 @@
fileFormatVersion: 2
guid: 3e4d2179e984b8a40ae871f7f984ce54
folderAsset: yes
DefaultImporter:
externalObjects: {}
userData:
assetBundleName:
assetBundleVariant:

@ -0,0 +1,9 @@
fileFormatVersion: 2
guid: 0c6b44bc1c4ff034b907d51d04682992
timeCreated: 1504799664
licenseType: Store
NativeFormatImporter:
mainObjectFileID: 100100000
userData:
assetBundleName:
assetBundleVariant:

@ -0,0 +1,9 @@
fileFormatVersion: 2
guid: d9ff999f14db2c44ea3d654f7f7304ab
timeCreated: 1504799663
licenseType: Store
NativeFormatImporter:
mainObjectFileID: 100100000
userData:
assetBundleName:
assetBundleVariant:

@ -0,0 +1,8 @@
fileFormatVersion: 2
guid: 7b6bf11867d5895459390f7a4fb45b5e
folderAsset: yes
DefaultImporter:
externalObjects: {}
userData:
assetBundleName:
assetBundleVariant:

@ -0,0 +1,8 @@
fileFormatVersion: 2
guid: a6ef903b479ca2645b849fa01c6a7d63
folderAsset: yes
DefaultImporter:
externalObjects: {}
userData:
assetBundleName:
assetBundleVariant:

@ -0,0 +1,9 @@
fileFormatVersion: 2
guid: ddc205c0c8c9eca43be1bdcb38ef42e7
timeCreated: 1504707645
licenseType: Store
NativeFormatImporter:
mainObjectFileID: 100100000
userData:
assetBundleName:
assetBundleVariant:

@ -0,0 +1,8 @@
fileFormatVersion: 2
guid: 472d68cea808e2e4ba2a8d7b9ea3b6ff
folderAsset: yes
DefaultImporter:
externalObjects: {}
userData:
assetBundleName:
assetBundleVariant:

@ -0,0 +1,8 @@
fileFormatVersion: 2
guid: 26bca93eeb22b2946a9e4a559e4cb465
folderAsset: yes
DefaultImporter:
externalObjects: {}
userData:
assetBundleName:
assetBundleVariant:

@ -0,0 +1,148 @@
using UnityEngine;
using System.Collections;
using System.Collections.Generic;
using System.Text.RegularExpressions;
// Script handling the Demo scene of CartoonFX particles.
public class CFX2_Demo : MonoBehaviour
{
public bool orderedSpawns = true;
public float step = 1.0f;
public float range = 5.0f;
private float order = -5.0f;
public Material groundMat, waterMat;
public GameObject[] ParticleExamples;
private int exampleIndex;
private string randomSpawnsDelay = "0.5";
private bool randomSpawns;
private bool slowMo;
void OnMouseDown()
{
RaycastHit hit = new RaycastHit();
if(this.GetComponent<Collider>().Raycast(Camera.main.ScreenPointToRay(Input.mousePosition), out hit, 9999f))
{
GameObject particle = spawnParticle();
particle.transform.position = hit.point + particle.transform.position;
}
}
private GameObject spawnParticle()
{
GameObject particles = (GameObject)Instantiate(ParticleExamples[exampleIndex]);
particles.transform.position = new Vector3(0,particles.transform.position.y,0);
#if UNITY_3_5
particles.SetActiveRecursively(true);
#else
particles.SetActive(true);
for(int i = 0; i < particles.transform.childCount; i++)
particles.transform.GetChild(i).gameObject.SetActive(true);
#endif
return particles;
}
void OnGUI()
{
GUILayout.BeginArea(new Rect(5,20,Screen.width-10,60));
GUILayout.BeginHorizontal();
GUILayout.Label("Effect");
if(GUILayout.Button("<"))
{
prevParticle();
}
GUILayout.Label(ParticleExamples[exampleIndex].name, GUILayout.Width(210));
if(GUILayout.Button(">"))
{
nextParticle();
}
GUILayout.Label("Click on the ground to spawn selected particles", GUILayout.Width(150));
if(GUILayout.Button(CFX_Demo_RotateCamera.rotating ? "Pause Camera" : "Rotate Camera"))
{
CFX_Demo_RotateCamera.rotating = !CFX_Demo_RotateCamera.rotating;
}
if(GUILayout.Button(randomSpawns ? "Stop Random Spawns" : "Start Random Spawns", GUILayout.Width(140)))
{
randomSpawns = !randomSpawns;
if(randomSpawns) StartCoroutine("RandomSpawnsCoroutine");
else StopCoroutine("RandomSpawnsCoroutine");
}
randomSpawnsDelay = GUILayout.TextField(randomSpawnsDelay, 10, GUILayout.Width(42));
randomSpawnsDelay = Regex.Replace(randomSpawnsDelay, @"[^0-9.]", "");
if(GUILayout.Button(this.GetComponent<Renderer>().enabled ? "Hide Ground" : "Show Ground", GUILayout.Width(90)))
{
this.GetComponent<Renderer>().enabled = !this.GetComponent<Renderer>().enabled;
}
if(GUILayout.Button(slowMo ? "Normal Speed" : "Slow Motion", GUILayout.Width(100)))
{
slowMo = !slowMo;
if(slowMo) Time.timeScale = 0.33f;
else Time.timeScale = 1.0f;
}
GUILayout.EndHorizontal();
GUILayout.EndArea();
}
IEnumerator RandomSpawnsCoroutine()
{
LOOP:
GameObject particles = spawnParticle();
if(orderedSpawns)
{
particles.transform.position = this.transform.position + new Vector3(order,particles.transform.position.y,0);
order -= step;
if(order < -range) order = range;
}
else particles.transform.position = this.transform.position + new Vector3(Random.Range(-range,range),0,Random.Range(-range,range)) + new Vector3(0,particles.transform.position.y,0);
yield return new WaitForSeconds(float.Parse(randomSpawnsDelay));
goto LOOP;
}
void Update()
{
if(Input.GetKeyDown(KeyCode.LeftArrow))
{
prevParticle();
}
else if(Input.GetKeyDown(KeyCode.RightArrow))
{
nextParticle();
}
}
private void prevParticle()
{
exampleIndex--;
if(exampleIndex < 0) exampleIndex = ParticleExamples.Length - 1;
if(ParticleExamples[exampleIndex].name.Contains("Splash") || ParticleExamples[exampleIndex].name.Contains("Skim"))
this.GetComponent<Renderer>().material = waterMat;
else
this.GetComponent<Renderer>().material = groundMat;
}
private void nextParticle()
{
exampleIndex++;
if(exampleIndex >= ParticleExamples.Length) exampleIndex = 0;
if(ParticleExamples[exampleIndex].name.Contains("Splash") || ParticleExamples[exampleIndex].name.Contains("Skim"))
this.GetComponent<Renderer>().material = waterMat;
else
this.GetComponent<Renderer>().material = groundMat;
}
}

@ -0,0 +1,11 @@
fileFormatVersion: 2
guid: b89446a500d6ec54788d5bd056a68979
MonoImporter:
externalObjects: {}
serializedVersion: 2
defaultReferences: []
executionOrder: 0
icon: {instanceID: 0}
userData:
assetBundleName:
assetBundleVariant:

@ -0,0 +1,38 @@
using UnityEngine;
using System.Collections;
using System.Collections.Generic;
using System.Text.RegularExpressions;
// Cartoon FX - (c) 2015 Jean Moreno
//
// Script handling looped effect in the Demo Scene, so that they eventually stop
[RequireComponent(typeof(ParticleSystem))]
public class CFX_AutoStopLoopedEffect : MonoBehaviour
{
public float effectDuration = 2.5f;
private float d;
void OnEnable()
{
d = effectDuration;
}
void Update()
{
if(d > 0)
{
d -= Time.deltaTime;
if(d <= 0)
{
this.GetComponent<ParticleSystem>().Stop(true);
CFX_Demo_Translate translation = this.gameObject.GetComponent<CFX_Demo_Translate>();
if(translation != null)
{
translation.enabled = false;
}
}
}
}
}

@ -0,0 +1,8 @@
fileFormatVersion: 2
guid: d9c4e89389fa607479b0744ec6611490
MonoImporter:
serializedVersion: 2
defaultReferences: []
executionOrder: 0
icon: {instanceID: 0}
userData:

@ -0,0 +1,191 @@
using UnityEngine;
using System.Collections;
using System.Collections.Generic;
using System.Text.RegularExpressions;
// Cartoon FX - (c) 2015 Jean Moreno
// Script handling the Demo scene of CartoonFX particles.
public class CFX_Demo : MonoBehaviour
{
public bool orderedSpawns = true;
public float step = 1.0f;
public float range = 5.0f;
private float order = -5.0f;
public Material groundMat, waterMat;
public GameObject[] ParticleExamples;
private Dictionary<string,float> ParticlesYOffsetD = new Dictionary<string, float>
{
{"CFX_ElectricGround", 0.15f},
{"CFX_ElectricityBall", 1.0f},
{"CFX_ElectricityBolt", 1.0f},
{"CFX_Explosion", 2.0f},
{"CFX_SmallExplosion", 1.5f},
{"CFX_SmokeExplosion", 2.5f},
{"CFX_Flame", 1.0f},
{"CFX_DoubleFlame", 1.0f},
{"CFX_Hit", 1.0f},
{"CFX_CircularLightWall", 0.05f},
{"CFX_LightWall", 0.05f},
{"CFX_Flash", 2.0f},
{"CFX_Poof", 1.5f},
{"CFX_Virus", 1.0f},
{"CFX_SmokePuffs", 2.0f},
{"CFX_Slash", 1.0f},
{"CFX_Splash", 0.05f},
{"CFX_Fountain", 0.05f},
{"CFX_Ripple", 0.05f},
{"CFX_Magic", 2.0f},
{"CFX_SoftStar", 1.0f},
{"CFX_SpikyAura_Sphere", 1.0f},
{"CFX_Firework", 2.4f},
{"CFX_GroundA", 0.05f},
};
private int exampleIndex;
private string randomSpawnsDelay = "0.5";
private bool randomSpawns;
private bool slowMo;
void OnMouseDown()
{
RaycastHit hit = new RaycastHit();
if(this.GetComponent<Collider>().Raycast(Camera.main.ScreenPointToRay(Input.mousePosition), out hit, 9999f))
{
GameObject particle = spawnParticle();
particle.transform.position = hit.point + particle.transform.position;
}
}
private GameObject spawnParticle()
{
GameObject particles = (GameObject)Instantiate(ParticleExamples[exampleIndex]);
#if UNITY_3_5
particles.SetActiveRecursively(true);
#else
particles.SetActive(true);
for(int i = 0; i < particles.transform.childCount; i++)
particles.transform.GetChild(i).gameObject.SetActive(true);
#endif
float Y = 0.0f;
foreach(KeyValuePair<string,float> kvp in ParticlesYOffsetD)
{
if(particles.name.StartsWith(kvp.Key))
{
Y = kvp.Value;
break;
}
}
particles.transform.position = new Vector3(0,Y,0);
return particles;
}
void OnGUI()
{
GUILayout.BeginArea(new Rect(5,20,Screen.width-10,30));
GUILayout.BeginHorizontal();
GUILayout.Label("Effect", GUILayout.Width(50));
if(GUILayout.Button("<",GUILayout.Width(20)))
{
prevParticle();
}
GUILayout.Label(ParticleExamples[exampleIndex].name, GUILayout.Width(190));
if(GUILayout.Button(">",GUILayout.Width(20)))
{
nextParticle();
}
GUILayout.Label("Click on the ground to spawn selected particles");
if(GUILayout.Button(CFX_Demo_RotateCamera.rotating ? "Pause Camera" : "Rotate Camera", GUILayout.Width(140)))
{
CFX_Demo_RotateCamera.rotating = !CFX_Demo_RotateCamera.rotating;
}
if(GUILayout.Button(randomSpawns ? "Stop Random Spawns" : "Start Random Spawns", GUILayout.Width(140)))
{
randomSpawns = !randomSpawns;
if(randomSpawns) StartCoroutine("RandomSpawnsCoroutine");
else StopCoroutine("RandomSpawnsCoroutine");
}
randomSpawnsDelay = GUILayout.TextField(randomSpawnsDelay, 10, GUILayout.Width(42));
randomSpawnsDelay = Regex.Replace(randomSpawnsDelay, @"[^0-9.]", "");
if(GUILayout.Button(this.GetComponent<Renderer>().enabled ? "Hide Ground" : "Show Ground", GUILayout.Width(90)))
{
this.GetComponent<Renderer>().enabled = !this.GetComponent<Renderer>().enabled;
}
if(GUILayout.Button(slowMo ? "Normal Speed" : "Slow Motion", GUILayout.Width(100)))
{
slowMo = !slowMo;
if(slowMo) Time.timeScale = 0.33f;
else Time.timeScale = 1.0f;
}
GUILayout.EndHorizontal();
GUILayout.EndArea();
}
IEnumerator RandomSpawnsCoroutine()
{
LOOP:
GameObject particles = spawnParticle();
if(orderedSpawns)
{
particles.transform.position = this.transform.position + new Vector3(order,particles.transform.position.y,0);
order -= step;
if(order < -range) order = range;
}
else particles.transform.position = this.transform.position + new Vector3(Random.Range(-range,range),0,Random.Range(-range,range)) + new Vector3(0,particles.transform.position.y,0);
yield return new WaitForSeconds(float.Parse(randomSpawnsDelay));
goto LOOP;
}
void Update()
{
if(Input.GetKeyDown(KeyCode.LeftArrow))
{
prevParticle();
}
else if(Input.GetKeyDown(KeyCode.RightArrow))
{
nextParticle();
}
}
private void prevParticle()
{
exampleIndex--;
if(exampleIndex < 0) exampleIndex = ParticleExamples.Length - 1;
if(ParticleExamples[exampleIndex].name.Contains("Splash") || ParticleExamples[exampleIndex].name == "CFX_Ripple" || ParticleExamples[exampleIndex].name == "CFX_Fountain")
this.GetComponent<Renderer>().material = waterMat;
else
this.GetComponent<Renderer>().material = groundMat;
}
private void nextParticle()
{
exampleIndex++;
if(exampleIndex >= ParticleExamples.Length) exampleIndex = 0;
if(ParticleExamples[exampleIndex].name.Contains("Splash") || ParticleExamples[exampleIndex].name == "CFX_Ripple" || ParticleExamples[exampleIndex].name == "CFX_Fountain")
this.GetComponent<Renderer>().material = waterMat;
else
this.GetComponent<Renderer>().material = groundMat;
}
}

@ -0,0 +1,7 @@
fileFormatVersion: 2
guid: 8469526271e317d469f107c0a3240521
MonoImporter:
serializedVersion: 2
defaultReferences: []
executionOrder: 0
icon: {instanceID: 0}

@ -0,0 +1,239 @@
using UnityEngine;
using UnityEngine.UI;
using System.Collections;
using System.Collections.Generic;
using System.Text.RegularExpressions;
// Cartoon FX - (c) 2015 - Jean Moreno
//
// Script handling the Demo scene of the Cartoon FX Packs
public class CFX_Demo_New : MonoBehaviour
{
public Renderer groundRenderer;
public Collider groundCollider;
[Space]
[Space]
public Image slowMoBtn;
public Text slowMoLabel;
public Image camRotBtn;
public Text camRotLabel;
public Image groundBtn;
public Text groundLabel;
[Space]
public Text EffectLabel;
public Text EffectIndexLabel;
//-------------------------------------------------------------
private GameObject[] ParticleExamples;
private int exampleIndex;
private bool slowMo;
private Vector3 defaultCamPosition;
private Quaternion defaultCamRotation;
private List<GameObject> onScreenParticles = new List<GameObject>();
//-------------------------------------------------------------
void Awake()
{
List<GameObject> particleExampleList = new List<GameObject>();
int nbChild = this.transform.childCount;
for(int i = 0; i < nbChild; i++)
{
GameObject child = this.transform.GetChild(i).gameObject;
particleExampleList.Add(child);
}
particleExampleList.Sort( delegate(GameObject o1, GameObject o2) { return o1.name.CompareTo(o2.name); } );
ParticleExamples = particleExampleList.ToArray();
defaultCamPosition = Camera.main.transform.position;
defaultCamRotation = Camera.main.transform.rotation;
StartCoroutine("CheckForDeletedParticles");
UpdateUI();
}
void Update()
{
if(Input.GetKeyDown(KeyCode.LeftArrow))
{
prevParticle();
}
else if(Input.GetKeyDown(KeyCode.RightArrow))
{
nextParticle();
}
else if(Input.GetKeyDown(KeyCode.Delete))
{
destroyParticles();
}
if(Input.GetMouseButtonDown(0))
{
RaycastHit hit = new RaycastHit();
if(groundCollider.Raycast(Camera.main.ScreenPointToRay(Input.mousePosition), out hit, 9999f))
{
GameObject particle = spawnParticle();
particle.transform.position = hit.point + particle.transform.position;
}
}
float scroll = Input.GetAxis("Mouse ScrollWheel");
if(scroll != 0f)
{
Camera.main.transform.Translate(Vector3.forward * (scroll < 0f ? -1f : 1f), Space.Self);
}
if(Input.GetMouseButtonDown(2))
{
Camera.main.transform.position = defaultCamPosition;
Camera.main.transform.rotation = defaultCamRotation;
}
}
//-------------------------------------------------------------
// MESSAGES
public void OnToggleGround()
{
var c = Color.white;
groundRenderer.enabled = !groundRenderer.enabled;
c.a = groundRenderer.enabled ? 1f : 0.33f;
groundBtn.color = c;
groundLabel.color = c;
}
public void OnToggleCamera()
{
var c = Color.white;
CFX_Demo_RotateCamera.rotating = !CFX_Demo_RotateCamera.rotating;
c.a = CFX_Demo_RotateCamera.rotating ? 1f : 0.33f;
camRotBtn.color = c;
camRotLabel.color = c;
}
public void OnToggleSlowMo()
{
var c = Color.white;
slowMo = !slowMo;
if(slowMo)
{
Time.timeScale = 0.33f;
c.a = 1f;
}
else
{
Time.timeScale = 1.0f;
c.a = 0.33f;
}
slowMoBtn.color = c;
slowMoLabel.color = c;
}
public void OnPreviousEffect()
{
prevParticle();
}
public void OnNextEffect()
{
nextParticle();
}
//-------------------------------------------------------------
// UI
private void UpdateUI()
{
EffectLabel.text = ParticleExamples[exampleIndex].name;
EffectIndexLabel.text = string.Format("{0}/{1}", (exampleIndex+1).ToString("00"), ParticleExamples.Length.ToString("00"));
}
//-------------------------------------------------------------
// SYSTEM
private GameObject spawnParticle()
{
GameObject particles = (GameObject)Instantiate(ParticleExamples[exampleIndex]);
particles.transform.position = new Vector3(0,particles.transform.position.y,0);
#if UNITY_3_5
particles.SetActiveRecursively(true);
#else
particles.SetActive(true);
// for(int i = 0; i < particles.transform.childCount; i++)
// particles.transform.GetChild(i).gameObject.SetActive(true);
#endif
ParticleSystem ps = particles.GetComponent<ParticleSystem>();
#if UNITY_5_5_OR_NEWER
if (ps != null)
{
var main = ps.main;
if (main.loop)
{
ps.gameObject.AddComponent<CFX_AutoStopLoopedEffect>();
ps.gameObject.AddComponent<CFX_AutoDestructShuriken>();
}
}
#else
if(ps != null && ps.loop)
{
ps.gameObject.AddComponent<CFX_AutoStopLoopedEffect>();
ps.gameObject.AddComponent<CFX_AutoDestructShuriken>();
}
#endif
onScreenParticles.Add(particles);
return particles;
}
IEnumerator CheckForDeletedParticles()
{
while(true)
{
yield return new WaitForSeconds(5.0f);
for(int i = onScreenParticles.Count - 1; i >= 0; i--)
{
if(onScreenParticles[i] == null)
{
onScreenParticles.RemoveAt(i);
}
}
}
}
private void prevParticle()
{
exampleIndex--;
if(exampleIndex < 0) exampleIndex = ParticleExamples.Length - 1;
UpdateUI();
}
private void nextParticle()
{
exampleIndex++;
if(exampleIndex >= ParticleExamples.Length) exampleIndex = 0;
UpdateUI();
}
private void destroyParticles()
{
for(int i = onScreenParticles.Count - 1; i >= 0; i--)
{
if(onScreenParticles[i] != null)
{
GameObject.Destroy(onScreenParticles[i]);
}
onScreenParticles.RemoveAt(i);
}
}
}

@ -0,0 +1,8 @@
fileFormatVersion: 2
guid: 8b17383a625e88348a99a6eeef772d40
MonoImporter:
serializedVersion: 2
defaultReferences: []
executionOrder: 0
icon: {instanceID: 0}
userData:

@ -0,0 +1,16 @@
using UnityEngine;
using System.Collections;
// Cartoon FX - (c) 2015 Jean Moreno
public class CFX_Demo_RandomDir : MonoBehaviour
{
public Vector3 min = new Vector3(0,0,0);
public Vector3 max = new Vector3(0,360,0);
void Start ()
{
this.transform.eulerAngles = new Vector3(Random.Range(min.x,max.x),Random.Range(min.y,max.y),Random.Range(min.z,max.z));
}
}

@ -0,0 +1,7 @@
fileFormatVersion: 2
guid: 27666076fd6e86245aa62dfd9e943d6c
MonoImporter:
serializedVersion: 2
defaultReferences: []
executionOrder: 0
icon: {instanceID: 0}

@ -0,0 +1,30 @@
using UnityEngine;
using System.Collections;
// Cartoon FX - (c) 2015 Jean Moreno
public class CFX_Demo_RandomDirectionTranslate : MonoBehaviour
{
public float speed = 30.0f;
public Vector3 baseDir = Vector3.zero;
public Vector3 axis = Vector3.forward;
public bool gravity;
private Vector3 dir;
void Start ()
{
dir = new Vector3(Random.Range(0.0f,360.0f),Random.Range(0.0f,360.0f),Random.Range(0.0f,360.0f)).normalized;
dir.Scale(axis);
dir += baseDir;
}
void Update ()
{
this.transform.Translate(dir * speed * Time.deltaTime);
if(gravity)
{
this.transform.Translate(Physics.gravity * Time.deltaTime);
}
}
}

@ -0,0 +1,7 @@
fileFormatVersion: 2
guid: 83982eed39974834bada258fbddd1e72
MonoImporter:
serializedVersion: 2
defaultReferences: []
executionOrder: 0
icon: {instanceID: 0}

@ -0,0 +1,18 @@
using UnityEngine;
using System.Collections;
// Cartoon FX - (c) 2015 Jean Moreno
public class CFX_Demo_RotateCamera : MonoBehaviour
{
static public bool rotating = true;
public float speed = 30.0f;
public Transform rotationCenter;
void Update ()
{
if(rotating)
transform.RotateAround(rotationCenter.position, Vector3.up, speed*Time.deltaTime);
}
}

@ -0,0 +1,7 @@
fileFormatVersion: 2
guid: f71e90e62dfae594490eb4d9b611f930
MonoImporter:
serializedVersion: 2
defaultReferences: []
executionOrder: 0
icon: {instanceID: 0}

@ -0,0 +1,25 @@
using UnityEngine;
using System.Collections;
// Cartoon FX - (c) 2015, Jean Moreno
public class CFX_Demo_Translate : MonoBehaviour
{
public float speed = 30.0f;
public Vector3 rotation = Vector3.forward;
public Vector3 axis = Vector3.forward;
public bool gravity;
private Vector3 dir;
void Start ()
{
dir = new Vector3(Random.Range(0.0f,360.0f),Random.Range(0.0f,360.0f),Random.Range(0.0f,360.0f));
dir.Scale(rotation);
this.transform.localEulerAngles = dir;
}
void Update ()
{
this.transform.Translate(axis * speed * Time.deltaTime, Space.Self);
}
}

@ -0,0 +1,8 @@
fileFormatVersion: 2
guid: 1e42ac40a6fba2e4d94a0070ef45cea1
MonoImporter:
serializedVersion: 2
defaultReferences: []
executionOrder: 0
icon: {instanceID: 0}
userData:

@ -0,0 +1,8 @@
fileFormatVersion: 2
guid: 87c964e7d27f4764393e36054e147f1b
folderAsset: yes
DefaultImporter:
externalObjects: {}
userData:
assetBundleName:
assetBundleVariant:

@ -0,0 +1,65 @@
#if UNITY_EDITOR
// 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 or GameObject about its usage
using UnityEngine;
using UnityEditor;
using System.Collections;
[CustomEditor(typeof(CFX_InspectorHelp))]
public class CFX_InspectorHelpEditor : Editor
{
private CFX_InspectorHelp inspHelp { get { return (this.target as CFX_InspectorHelp); } }
public override void OnInspectorGUI ()
{
if(inspHelp.Locked)
{
ShowHelpGUI();
}
else
{
EditorStyles.textField.wordWrap = true;
inspHelp.Title = EditorGUILayout.TextField(inspHelp.Title);
inspHelp.HelpText = EditorGUILayout.TextArea(inspHelp.HelpText);
inspHelp.MsgType = (int)((MessageType)EditorGUILayout.EnumPopup("Message Type", (MessageType)inspHelp.MsgType));
EditorGUILayout.HelpBox("Use the contextual menu (right click or cog icon) on this Component to enable editing back", MessageType.Warning);
if(GUILayout.Button("Lock Message", GUILayout.Height(30)))
{
inspHelp.Locked = true;
}
if(GUI.changed)
{
EditorUtility.SetDirty(inspHelp);
}
GUILayout.Space(12);
EditorGUILayout.LabelField("MESSAGE PREVIEW:", EditorStyles.largeLabel);
ShowHelpGUI();
}
}
private void ShowHelpGUI()
{
GUILayout.Space(12);
if(!string.IsNullOrEmpty(inspHelp.Title))
{
EditorGUILayout.LabelField(inspHelp.Title, EditorStyles.boldLabel);
}
EditorGUILayout.HelpBox(inspHelp.HelpText, (MessageType)inspHelp.MsgType);
GUILayout.Space(12);
}
}
#endif

@ -0,0 +1,8 @@
fileFormatVersion: 2
guid: 5fefbc813de49524d89e5fcce98dc957
MonoImporter:
serializedVersion: 2
defaultReferences: []
executionOrder: 0
icon: {instanceID: 0}
userData:

@ -0,0 +1,193 @@
using UnityEngine;
using UnityEditor;
using System.Collections;
// Cartoon FX - (c) 2012-2016 Jean Moreno
// CFX Spawn System Editor interface
[CustomEditor(typeof(CFX_SpawnSystem))]
public class CFX_SpawnSystemEditor : Editor
{
private SerializedProperty _hideObjectsInHierarchy;
private SerializedProperty p_hideObjectsInHierarchy
{
get
{
if(_hideObjectsInHierarchy == null)
_hideObjectsInHierarchy = this.serializedObject.FindProperty("hideObjectsInHierarchy");
return _hideObjectsInHierarchy;
}
}
private SerializedProperty _onlyGetInactiveObjects;
private SerializedProperty p_onlyGetInactiveObjects
{
get
{
if(_onlyGetInactiveObjects == null)
_onlyGetInactiveObjects = this.serializedObject.FindProperty("onlyGetInactiveObjects");
return _onlyGetInactiveObjects;
}
}
private SerializedProperty _instantiateIfNeeded;
private SerializedProperty p_instantiateIfNeeded
{
get
{
if(_instantiateIfNeeded == null)
_instantiateIfNeeded = this.serializedObject.FindProperty("instantiateIfNeeded");
return _instantiateIfNeeded;
}
}
private SerializedProperty _spawnAsChildren;
private SerializedProperty p_spawnAsChildren
{
get
{
if(_spawnAsChildren == null)
_spawnAsChildren = this.serializedObject.FindProperty("spawnAsChildren");
return _spawnAsChildren;
}
}
private GUIContent guiContent = new GUIContent();
private GUIContent getGuiContent(string label, string tooltip = null)
{
guiContent.text = label;
guiContent.tooltip = tooltip;
return guiContent;
}
// GUI ----------------------------------------------------------------------------------------------------------------------------------------------------
public override void OnInspectorGUI()
{
//Options
EditorGUI.BeginChangeCheck();
#if UNITY_4_2
EditorGUIUtility.LookLikeControls(230f);
#else
float labelWidth = EditorGUIUtility.labelWidth;
EditorGUIUtility.labelWidth = 230f;
#endif
EditorGUILayout.PropertyField(p_hideObjectsInHierarchy, getGuiContent("Hide preloaded objects in Hierarchy", "Will prevent the preloaded instances to show in the Hierarchy"));
EditorGUILayout.PropertyField(p_spawnAsChildren, getGuiContent("Spawn as children of this GameObject", "Will place the preloaded instances under this GameObject, for better organization of the Hierarchy"));
EditorGUILayout.PropertyField(p_onlyGetInactiveObjects, getGuiContent("Only retrieve inactive GameObjects", "Will only return preloaded instances if they are inactive.\nThis means that you have to deactivate the GameObject before being able to reuse it\n(this is already handled on Cartoon FX effects with the CFX_AutoDestructShuriken script)"));
bool guiEnabled = GUI.enabled;
GUI.enabled = p_onlyGetInactiveObjects.boolValue;
EditorGUILayout.PropertyField(p_instantiateIfNeeded, getGuiContent("Instantiate new instances if needed", "If no active GameObject is found in the preloaded list, then instantiate new ones as needed"));
GUI.enabled = guiEnabled;
#if !UNITY_4_2
EditorGUIUtility.labelWidth = labelWidth;
#endif
if(EditorGUI.EndChangeCheck())
{
serializedObject.ApplyModifiedProperties();
}
//Drag/drop Prefabs
GUI.SetNextControlName("DragDropBox");
EditorGUILayout.HelpBox("Drag GameObjects you want to preload here!\n\nTIP:\nUse the Inspector Lock at the top right to be able to drag multiple objects at once!", MessageType.None);
Rect dropRect = GUILayoutUtility.GetLastRect();
for(int i = 0; i < (this.target as CFX_SpawnSystem).objectsToPreload.Length; i++)
{
GUILayout.BeginHorizontal();
EditorGUI.BeginChangeCheck();
GameObject obj = (GameObject)EditorGUILayout.ObjectField((this.target as CFX_SpawnSystem).objectsToPreload[i], typeof(GameObject), true);
if(EditorGUI.EndChangeCheck())
{
#if UNITY_4_2
Undo.RegisterUndo(target, "change Spawn System object to preload");
#else
Undo.RecordObject(target, "change Spawn System object to preload");
#endif
(this.target as CFX_SpawnSystem).objectsToPreload[i] = obj;
}
EditorGUILayout.LabelField(new GUIContent("times","Number of times to copy the effect\nin the pool, i.e. the max number of\ntimes the object will be used\nsimultaneously"), GUILayout.Width(40));
EditorGUI.BeginChangeCheck();
int nb = EditorGUILayout.IntField("", (this.target as CFX_SpawnSystem).objectsToPreloadTimes[i], GUILayout.Width(50));
if(nb < 1)
nb = 1;
if(EditorGUI.EndChangeCheck())
{
#if UNITY_4_2
Undo.RegisterUndo(target, "change Spawn System preload count");
#else
Undo.RecordObject(target, "change Spawn System preload count");
#endif
(this.target as CFX_SpawnSystem).objectsToPreloadTimes[i] = nb;
}
if(GUI.changed)
{
EditorUtility.SetDirty(target);
}
if(GUILayout.Button("X", EditorStyles.miniButton, GUILayout.Width(24)))
{
Object preloadedObject = (this.target as CFX_SpawnSystem).objectsToPreload[i];
string objectName = (preloadedObject == null) ? "" : preloadedObject.name;
#if UNITY_4_2
Undo.RegisterUndo(target, string.Format("remove {0} from Spawn System", objectName));
#else
Undo.RecordObject(target, string.Format("remove {0} from Spawn System", objectName));
#endif
ArrayUtility.RemoveAt<GameObject>(ref (this.target as CFX_SpawnSystem).objectsToPreload, i);
ArrayUtility.RemoveAt<int>(ref (this.target as CFX_SpawnSystem).objectsToPreloadTimes, i);
EditorUtility.SetDirty(target);
}
GUILayout.EndHorizontal();
}
if((Event.current.type == EventType.DragPerform || Event.current.type == EventType.DragUpdated)
&& dropRect.Contains(Event.current.mousePosition))
{
DragAndDrop.visualMode = DragAndDropVisualMode.Copy;
if(Event.current.type == EventType.DragPerform)
{
foreach(Object o in DragAndDrop.objectReferences)
{
if(o is GameObject)
{
bool already = false;
foreach(GameObject otherObj in (this.target as CFX_SpawnSystem).objectsToPreload)
{
if(o == otherObj)
{
already = true;
Debug.LogWarning("CFX_SpawnSystem: Object has already been added: " + o.name);
break;
}
}
if(!already)
{
#if UNITY_4_2
Undo.RegisterUndo(target, string.Format("add {0} to Spawn System", o.name));
#else
Undo.RecordObject(target, string.Format("add {0} to Spawn System", o.name));
#endif
ArrayUtility.Add<GameObject>(ref (this.target as CFX_SpawnSystem).objectsToPreload, (GameObject)o);
ArrayUtility.Add<int>(ref (this.target as CFX_SpawnSystem).objectsToPreloadTimes, 1);
EditorUtility.SetDirty(target);
}
}
}
}
}
}
}

@ -0,0 +1,7 @@
fileFormatVersion: 2
guid: a20330d93336f2245901dbd9a34b88f8
MonoImporter:
serializedVersion: 2
defaultReferences: []
executionOrder: 0
icon: {instanceID: 0}

@ -0,0 +1,8 @@
fileFormatVersion: 2
guid: e1a4e99f62e1b4b40ac0a423acf7c903
folderAsset: yes
DefaultImporter:
externalObjects: {}
userData:
assetBundleName:
assetBundleVariant:

@ -0,0 +1,8 @@
fileFormatVersion: 2
guid: 87d63f8e8fee02f4bb750ed717e60ebf
folderAsset: yes
DefaultImporter:
externalObjects: {}
userData:
assetBundleName:
assetBundleVariant:

@ -0,0 +1,28 @@
%YAML 1.1
%TAG !u! tag:unity3d.com,2011:
--- !u!21 &2100000
Material:
serializedVersion: 6
m_ObjectHideFlags: 0
m_PrefabParentObject: {fileID: 0}
m_PrefabInternal: {fileID: 0}
m_Name: CFXM3_AuraRays ADD
m_Shader: {fileID: 10720, guid: 0000000000000000f000000000000000, type: 0}
m_ShaderKeywords:
m_LightmapFlags: 4
m_EnableInstancingVariants: 0
m_CustomRenderQueue: -1
stringTagMap: {}
disabledShaderPasses: []
m_SavedProperties:
serializedVersion: 3
m_TexEnvs:
- _MainTex:
m_Texture: {fileID: 2800000, guid: 13807a919991cfe44b57d7db2be003d8, type: 3}
m_Scale: {x: 1, y: 1}
m_Offset: {x: 0, y: 0}
m_Floats:
- _InvFade: 1
m_Colors:
- _Color: {r: 1, g: 1, b: 1, a: 1}
- _TintColor: {r: 0.5, g: 0.5, b: 0.5, a: 0.5}

@ -0,0 +1,4 @@
fileFormatVersion: 2
guid: 77e3cbacb5b834b42a5ccfe9ad151923
NativeFormatImporter:
userData:

@ -0,0 +1,31 @@
%YAML 1.1
%TAG !u! tag:unity3d.com,2011:
--- !u!21 &2100000
Material:
serializedVersion: 6
m_ObjectHideFlags: 0
m_PrefabParentObject: {fileID: 0}
m_PrefabInternal: {fileID: 0}
m_Name: CFXM3_GlowDot ADD
m_Shader: {fileID: 10720, guid: 0000000000000000f000000000000000, type: 0}
m_ShaderKeywords:
m_LightmapFlags: 4
m_EnableInstancingVariants: 0
m_CustomRenderQueue: -1
stringTagMap: {}
disabledShaderPasses: []
m_SavedProperties:
serializedVersion: 3
m_TexEnvs:
- _MainTex:
m_Texture: {fileID: 2800000, guid: ae3fa1042e1f4b245970c609dd6952c4, type: 3}
m_Scale: {x: 1, y: 1}
m_Offset: {x: 0, y: 0}
m_Floats:
- _InvFade: 1
m_Colors:
- _Color: {r: 1, g: 1, b: 1, a: 1}
- _TintColor: {r: 1, g: 1, b: 1, a: 1}
--- !u!1002 &2100001
EditorExtensionImpl:
serializedVersion: 6

@ -0,0 +1,4 @@
fileFormatVersion: 2
guid: 64787e354b16ddf41ab85b12fe15dbff
NativeFormatImporter:
userData:

@ -0,0 +1,28 @@
%YAML 1.1
%TAG !u! tag:unity3d.com,2011:
--- !u!21 &2100000
Material:
serializedVersion: 6
m_ObjectHideFlags: 0
m_PrefabParentObject: {fileID: 0}
m_PrefabInternal: {fileID: 0}
m_Name: CFXM3_GlowStar ADD
m_Shader: {fileID: 10720, guid: 0000000000000000f000000000000000, type: 0}
m_ShaderKeywords:
m_LightmapFlags: 4
m_EnableInstancingVariants: 0
m_CustomRenderQueue: -1
stringTagMap: {}
disabledShaderPasses: []
m_SavedProperties:
serializedVersion: 3
m_TexEnvs:
- _MainTex:
m_Texture: {fileID: 2800000, guid: 6cfb04d83be10e549887ebb5340a46f9, type: 3}
m_Scale: {x: 1, y: 1}
m_Offset: {x: 0, y: 0}
m_Floats:
- _InvFade: 1
m_Colors:
- _Color: {r: 1, g: 1, b: 1, a: 1}
- _TintColor: {r: 0.5, g: 0.5, b: 0.5, a: 0.5}

@ -0,0 +1,4 @@
fileFormatVersion: 2
guid: 0053b65302e6f7649b1c013c4c41906b
NativeFormatImporter:
userData:

@ -0,0 +1,8 @@
fileFormatVersion: 2
guid: a6f7d0d209faadf4a8689fea1929013e
folderAsset: yes
DefaultImporter:
externalObjects: {}
userData:
assetBundleName:
assetBundleVariant:

@ -0,0 +1,28 @@
%YAML 1.1
%TAG !u! tag:unity3d.com,2011:
--- !u!21 &2100000
Material:
serializedVersion: 6
m_ObjectHideFlags: 0
m_PrefabParentObject: {fileID: 0}
m_PrefabInternal: {fileID: 0}
m_Name: CFXM3_IceBulk ADD
m_Shader: {fileID: 10720, guid: 0000000000000000f000000000000000, type: 0}
m_ShaderKeywords:
m_LightmapFlags: 4
m_EnableInstancingVariants: 0
m_CustomRenderQueue: -1
stringTagMap: {}
disabledShaderPasses: []
m_SavedProperties:
serializedVersion: 3
m_TexEnvs:
- _MainTex:
m_Texture: {fileID: 2800000, guid: 8ec934b6b46a3424c961170abc530b6f, type: 3}
m_Scale: {x: 1, y: 1}
m_Offset: {x: 0, y: 0}
m_Floats:
- _InvFade: 1
m_Colors:
- _Color: {r: 1, g: 1, b: 1, a: 1}
- _TintColor: {r: 0.5, g: 0.5, b: 0.5, a: 0.23529412}

@ -0,0 +1,4 @@
fileFormatVersion: 2
guid: b85bac8660bfec243b2385f00819aa04
NativeFormatImporter:
userData:

@ -0,0 +1,28 @@
%YAML 1.1
%TAG !u! tag:unity3d.com,2011:
--- !u!21 &2100000
Material:
serializedVersion: 6
m_ObjectHideFlags: 0
m_PrefabParentObject: {fileID: 0}
m_PrefabInternal: {fileID: 0}
m_Name: CFXM3_IceSmoke ADD
m_Shader: {fileID: 10720, guid: 0000000000000000f000000000000000, type: 0}
m_ShaderKeywords:
m_LightmapFlags: 4
m_EnableInstancingVariants: 0
m_CustomRenderQueue: -1
stringTagMap: {}
disabledShaderPasses: []
m_SavedProperties:
serializedVersion: 3
m_TexEnvs:
- _MainTex:
m_Texture: {fileID: 2800000, guid: 8d5678f01a805b84eafa29e231b62e70, type: 3}
m_Scale: {x: 1, y: 1}
m_Offset: {x: 0, y: 0}
m_Floats:
- _InvFade: 1
m_Colors:
- _Color: {r: 1, g: 1, b: 1, a: 1}
- _TintColor: {r: 0.5, g: 0.5, b: 0.5, a: 0.23529412}

@ -0,0 +1,4 @@
fileFormatVersion: 2
guid: 0bae96837733cfe40ad617e2bc581c34
NativeFormatImporter:
userData:

@ -0,0 +1,31 @@
%YAML 1.1
%TAG !u! tag:unity3d.com,2011:
--- !u!21 &2100000
Material:
serializedVersion: 6
m_ObjectHideFlags: 0
m_PrefabParentObject: {fileID: 0}
m_PrefabInternal: {fileID: 0}
m_Name: CFXM3_IceSmoke Intense ADD
m_Shader: {fileID: 10720, guid: 0000000000000000f000000000000000, type: 0}
m_ShaderKeywords:
m_LightmapFlags: 4
m_EnableInstancingVariants: 0
m_CustomRenderQueue: -1
stringTagMap: {}
disabledShaderPasses: []
m_SavedProperties:
serializedVersion: 3
m_TexEnvs:
- _MainTex:
m_Texture: {fileID: 2800000, guid: 8d5678f01a805b84eafa29e231b62e70, type: 3}
m_Scale: {x: 1, y: 1}
m_Offset: {x: 0, y: 0}
m_Floats:
- _InvFade: 1
m_Colors:
- _Color: {r: 1, g: 1, b: 1, a: 1}
- _TintColor: {r: 1, g: 1, b: 1, a: 0.5019608}
--- !u!1002 &2100001
EditorExtensionImpl:
serializedVersion: 6

@ -0,0 +1,4 @@
fileFormatVersion: 2
guid: dbc0726520a1c2a4ea1190e959325a4b
NativeFormatImporter:
userData:

@ -0,0 +1,8 @@
fileFormatVersion: 2
guid: 8c0b7ddf850d2c7449a1ae688cdb0378
folderAsset: yes
DefaultImporter:
externalObjects: {}
userData:
assetBundleName:
assetBundleVariant:

@ -0,0 +1,8 @@
fileFormatVersion: 2
guid: 4eec49c450c64394b93925a83d0bf149
folderAsset: yes
DefaultImporter:
externalObjects: {}
userData:
assetBundleName:
assetBundleVariant:

@ -0,0 +1,30 @@
%YAML 1.1
%TAG !u! tag:unity3d.com,2011:
--- !u!21 &2100000
Material:
serializedVersion: 6
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_Name: CFX_Anim_Electricity_Add
m_Shader: {fileID: 200, guid: 0000000000000000f000000000000000, type: 0}
m_ShaderKeywords:
m_LightmapFlags: 4
m_EnableInstancingVariants: 0
m_DoubleSidedGI: 0
m_CustomRenderQueue: -1
stringTagMap: {}
disabledShaderPasses: []
m_SavedProperties:
serializedVersion: 3
m_TexEnvs:
- _MainTex:
m_Texture: {fileID: 2800000, guid: 67b0a4cd4c72b86469e7ca179598fcaf, type: 3}
m_Scale: {x: 1, y: 1}
m_Offset: {x: 0, y: 0}
m_Floats:
- _InvFade: 1
m_Colors:
- _Color: {r: 1, g: 1, b: 1, a: 1}
- _TintColor: {r: 1, g: 1, b: 1, a: 0.5}

@ -0,0 +1,2 @@
fileFormatVersion: 2
guid: fcb97c6faf083ca4f978210036f3832b

@ -0,0 +1,8 @@
fileFormatVersion: 2
guid: 545d633ab98aa144bae8082018b89e3b
folderAsset: yes
DefaultImporter:
externalObjects: {}
userData:
assetBundleName:
assetBundleVariant:

@ -0,0 +1,35 @@
%YAML 1.1
%TAG !u! tag:unity3d.com,2011:
--- !u!21 &2100000
Material:
serializedVersion: 3
m_ObjectHideFlags: 0
m_PrefabParentObject: {fileID: 0}
m_PrefabInternal: {fileID: 0}
m_Name: CFX_ElectricBolt_Add
m_Shader: {fileID: 200, guid: 0000000000000000f000000000000000, type: 0}
m_ShaderKeywords: []
m_SavedProperties:
serializedVersion: 2
m_TexEnvs:
data:
first:
name: _MainTex
second:
m_Texture: {fileID: 2800000, guid: 347a4af640f58824d8438fae9b34a012, type: 3}
m_Scale: {x: 1, y: 1}
m_Offset: {x: 0, y: 0}
m_Floats:
data:
first:
name: _InvFade
second: 1
m_Colors:
data:
first:
name: _Color
second: {r: 1, g: 1, b: 1, a: 1}
data:
first:
name: _TintColor
second: {r: .5, g: .5, b: .5, a: .5}

@ -0,0 +1,2 @@
fileFormatVersion: 2
guid: 9c36c09a0f6dd93458248f001ebce5ab

@ -0,0 +1,35 @@
%YAML 1.1
%TAG !u! tag:unity3d.com,2011:
--- !u!21 &2100000
Material:
serializedVersion: 3
m_ObjectHideFlags: 0
m_PrefabParentObject: {fileID: 0}
m_PrefabInternal: {fileID: 0}
m_Name: CFX_Sparkles_Add
m_Shader: {fileID: 200, guid: 0000000000000000f000000000000000, type: 0}
m_ShaderKeywords: []
m_SavedProperties:
serializedVersion: 2
m_TexEnvs:
data:
first:
name: _MainTex
second:
m_Texture: {fileID: 2800000, guid: a070c34b838259a4eb4338c1c5b753b3, type: 3}
m_Scale: {x: 1, y: 1}
m_Offset: {x: 0, y: 0}
m_Floats:
data:
first:
name: _InvFade
second: 1
m_Colors:
data:
first:
name: _Color
second: {r: 1, g: 1, b: 1, a: 1}
data:
first:
name: _TintColor
second: {r: .5, g: .5, b: .5, a: .5}

@ -0,0 +1,2 @@
fileFormatVersion: 2
guid: f70f45ac7c9fb644c9a039b7d3aab297

@ -0,0 +1,8 @@
fileFormatVersion: 2
guid: c29ee406928386e4d86d6ab379efe507
folderAsset: yes
DefaultImporter:
externalObjects: {}
userData:
assetBundleName:
assetBundleVariant:

@ -0,0 +1,49 @@
%YAML 1.1
%TAG !u! tag:unity3d.com,2011:
--- !u!21 &2100000
Material:
serializedVersion: 8
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_Name: CFX2_Glow Soft
m_Shader: {fileID: 200, guid: 0000000000000000f000000000000000, type: 0}
m_Parent: {fileID: 0}
m_ModifiedSerializedProperties: 0
m_ValidKeywords: []
m_InvalidKeywords: []
m_LightmapFlags: 4
m_EnableInstancingVariants: 0
m_DoubleSidedGI: 0
m_CustomRenderQueue: -1
stringTagMap: {}
disabledShaderPasses: []
m_LockedProperties:
m_SavedProperties:
serializedVersion: 3
m_TexEnvs:
- _BumpMap:
m_Texture: {fileID: 2800000, guid: 0b178db3c9e8755499da46a52e53ce76, type: 3}
m_Scale: {x: 1, y: 1}
m_Offset: {x: 0, y: 0}
- _MainTex:
m_Texture: {fileID: 2800000, guid: 8a75e78ce03d6bf4aa7ab9b759c2ca32, type: 3}
m_Scale: {x: 1, y: 1}
m_Offset: {x: 0, y: 0}
- _Mask:
m_Texture: {fileID: 0}
m_Scale: {x: 1, y: 1}
m_Offset: {x: 0, y: 0}
m_Ints: []
m_Floats:
- _InvFade: 0.7322388
- _TexCoordScrollX: 1
- _TexCoordScrollY: 1
m_Colors:
- _Color: {r: 1, g: 1, b: 1, a: 1}
- _TintColor: {r: 0.5, g: 0.5, b: 0.5, a: 0.5}
m_BuildTextureStacks: []
--- !u!1002 &2100001
EditorExtensionImpl:
serializedVersion: 6

@ -0,0 +1,8 @@
fileFormatVersion: 2
guid: b6a4ebddb006a4a4bb0bea6365c7512a
NativeFormatImporter:
externalObjects: {}
mainObjectFileID: 0
userData:
assetBundleName:
assetBundleVariant:

@ -0,0 +1,38 @@
%YAML 1.1
%TAG !u! tag:unity3d.com,2011:
--- !u!21 &2100000
Material:
serializedVersion: 3
m_ObjectHideFlags: 0
m_PrefabParentObject: {fileID: 0}
m_PrefabInternal: {fileID: 0}
m_Name: CFX_WhiteCircle
m_Shader: {fileID: 202, guid: 0000000000000000f000000000000000, type: 0}
m_ShaderKeywords: []
m_SavedProperties:
serializedVersion: 2
m_TexEnvs:
data:
first:
name: _MainTex
second:
m_Texture: {fileID: 2800000, guid: 7b11eec997e4c3044a59e4a2ff710b4e, type: 3}
m_Scale: {x: 1, y: 1}
m_Offset: {x: 0, y: 0}
m_Floats:
data:
first:
name: _InvFade
second: 1
m_Colors:
data:
first:
name: _Color
second: {r: 1, g: 1, b: 1, a: 1}
data:
first:
name: _TintColor
second: {r: .5, g: .5, b: .5, a: .235294119}
--- !u!1002 &2100001
EditorExtensionImpl:
serializedVersion: 6

@ -0,0 +1,2 @@
fileFormatVersion: 2
guid: 1fdeac39b28b45742b821b6c8acff998

@ -0,0 +1,8 @@
fileFormatVersion: 2
guid: 18f3ccd1122d115498938bdd93b0a6db
folderAsset: yes
DefaultImporter:
externalObjects: {}
userData:
assetBundleName:
assetBundleVariant:

@ -0,0 +1,35 @@
%YAML 1.1
%TAG !u! tag:unity3d.com,2011:
--- !u!21 &2100000
Material:
serializedVersion: 3
m_ObjectHideFlags: 0
m_PrefabParentObject: {fileID: 0}
m_PrefabInternal: {fileID: 0}
m_Name: CFX_RayRounded
m_Shader: {fileID: 202, guid: 0000000000000000f000000000000000, type: 0}
m_ShaderKeywords: []
m_SavedProperties:
serializedVersion: 2
m_TexEnvs:
data:
first:
name: _MainTex
second:
m_Texture: {fileID: 2800000, guid: 80afd895097ad144893ad78943aaf475, type: 3}
m_Scale: {x: 1, y: 1}
m_Offset: {x: 0, y: 0}
m_Floats:
data:
first:
name: _InvFade
second: .642985046
m_Colors:
data:
first:
name: _Color
second: {r: 1, g: 1, b: 1, a: 1}
data:
first:
name: _TintColor
second: {r: .5, g: .5, b: .5, a: .5}

@ -0,0 +1,2 @@
fileFormatVersion: 2
guid: 7cd73ef8e5a31a244a672ae32c0f6ddb

@ -0,0 +1,8 @@
fileFormatVersion: 2
guid: 478658f3c44239740a565a63edec7e70
folderAsset: yes
DefaultImporter:
externalObjects: {}
userData:
assetBundleName:
assetBundleVariant:

@ -0,0 +1,16 @@
using UnityEngine;
using System.Collections;
// Cartoon FX - (c) 2013,2014 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,11 @@
fileFormatVersion: 2
guid: 27a58d422b4911f42bd5bd9d8caf6f8f
MonoImporter:
externalObjects: {}
serializedVersion: 2
defaultReferences: []
executionOrder: 0
icon: {instanceID: 0}
userData:
assetBundleName:
assetBundleVariant:

@ -0,0 +1,44 @@
using UnityEngine;
using System.Collections;
// Cartoon FX - (c) 2015 Jean Moreno
// Automatically destructs an object when it has stopped emitting particles and when they have all disappeared from the screen.
// Check is performed every 0.5 seconds to not query the particle system's state every frame.
// (only deactivates the object if the OnlyDeactivate flag is set, automatically used with CFX Spawn System)
[RequireComponent(typeof(ParticleSystem))]
public class CFX_AutoDestructShuriken : MonoBehaviour
{
// If true, deactivate the object instead of destroying it
public bool OnlyDeactivate;
void OnEnable()
{
StartCoroutine("CheckIfAlive");
}
IEnumerator CheckIfAlive ()
{
ParticleSystem ps = this.GetComponent<ParticleSystem>();
while(true && ps != null)
{
yield return new WaitForSeconds(0.5f);
if(!ps.IsAlive(true))
{
if(OnlyDeactivate)
{
#if UNITY_3_5
this.gameObject.SetActiveRecursively(false);
#else
this.gameObject.SetActive(false);
#endif
}
else
GameObject.Destroy(this.gameObject);
break;
}
}
}
}

@ -0,0 +1,7 @@
fileFormatVersion: 2
guid: 6fd2e8874f60266498a388d7229a1bac
MonoImporter:
serializedVersion: 2
defaultReferences: []
executionOrder: 0
icon: {instanceID: 0}

@ -0,0 +1,20 @@
using UnityEngine;
using System.Collections;
// Cartoon FX - (c) 2015 Jean Moreno
// Indefinitely rotates an object at a constant speed
public class CFX_AutoRotate : MonoBehaviour
{
// Rotation speed & axis
public Vector3 rotation;
// Rotation space
public Space space = Space.Self;
void Update()
{
this.transform.Rotate(rotation * Time.deltaTime, space);
}
}

@ -0,0 +1,7 @@
fileFormatVersion: 2
guid: b78c1ba9facacbd48b8e1d9a4fb3ee0d
MonoImporter:
serializedVersion: 2
defaultReferences: []
executionOrder: 0
icon: {instanceID: 0}

@ -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,7 @@
fileFormatVersion: 2
guid: aeafe347c69d67e41b5deb895305e834
MonoImporter:
serializedVersion: 2
defaultReferences: []
executionOrder: 0
icon: {instanceID: 0}

@ -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,8 @@
fileFormatVersion: 2
guid: 79c859f5f7a87c8438b7a5e91d7f499e
MonoImporter:
serializedVersion: 2
defaultReferences: []
executionOrder: 0
icon: {instanceID: 0}
userData:

@ -0,0 +1,65 @@
using UnityEngine;
using System.Collections;
// Cartoon FX - (c) 2015 Jean Moreno
// Decreases a light's intensity over time.
[RequireComponent(typeof(Light))]
public class CFX_LightIntensityFade : MonoBehaviour
{
// Duration of the effect.
public float duration = 1.0f;
// Delay of the effect.
public float delay = 0.0f;
/// Final intensity of the light.
public float finalIntensity = 0.0f;
// Base intensity, automatically taken from light parameters.
private float baseIntensity;
// If <c>true</c>, light will destructs itself on completion of the effect
public bool autodestruct;
private float p_lifetime = 0.0f;
private float p_delay;
void Start()
{
baseIntensity = GetComponent<Light>().intensity;
}
void OnEnable()
{
p_lifetime = 0.0f;
p_delay = delay;
if(delay > 0) GetComponent<Light>().enabled = false;
}
void Update ()
{
if(p_delay > 0)
{
p_delay -= Time.deltaTime;
if(p_delay <= 0)
{
GetComponent<Light>().enabled = true;
}
return;
}
if(p_lifetime/duration < 1.0f)
{
GetComponent<Light>().intensity = Mathf.Lerp(baseIntensity, finalIntensity, p_lifetime/duration);
p_lifetime += Time.deltaTime;
}
else
{
if(autodestruct)
GameObject.Destroy(this.gameObject);
}
}
}

@ -0,0 +1,7 @@
fileFormatVersion: 2
guid: c2255468ea97f384a9ebbb13e497e050
MonoImporter:
serializedVersion: 2
defaultReferences: []
executionOrder: 0
icon: {instanceID: 0}

@ -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,7 @@
fileFormatVersion: 2
guid: 275fc5543f4e43c48a8b9ce3c3b559e0
MonoImporter:
serializedVersion: 2
defaultReferences: []
executionOrder: 0
icon: {instanceID: 0}

Some files were not shown because too many files have changed in this diff Show More

Loading…
Cancel
Save