Stable version

This commit is contained in:
Kasutaja
2023-04-30 14:23:57 +03:00
parent cdbdbc28c4
commit 294d6117e3
1861 changed files with 1697361 additions and 6747 deletions

View File

@@ -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;
}
}
}
}

View File

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

View File

@@ -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);
}
}

View File

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

View File

@@ -0,0 +1,39 @@
using UnityEngine;
using System.Collections;
// Cartoon FX - (c) 2015 Jean Moreno
// Randomly changes a light's intensity over time.
[RequireComponent(typeof(Light))]
public class CFX_LightFlicker : MonoBehaviour
{
// Loop flicker effect
public bool loop;
// Perlin scale: makes the flicker more or less smooth
public float smoothFactor = 1f;
/// Max intensity will be: baseIntensity + addIntensity
public float addIntensity = 1.0f;
private float minIntensity;
private float maxIntensity;
private float baseIntensity;
void Awake()
{
baseIntensity = GetComponent<Light>().intensity;
}
void OnEnable()
{
minIntensity = baseIntensity;
maxIntensity = minIntensity + addIntensity;
}
void Update ()
{
GetComponent<Light>().intensity = Mathf.Lerp(minIntensity, maxIntensity, Mathf.PerlinNoise(Time.time * smoothFactor, 0f));
}
}

View File

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

View File

@@ -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);
}
}
}

View File

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