27 lines
782 B
C#
27 lines
782 B
C#
using UnityEngine;
|
|
|
|
public class Particle_force_No_Gravity : MonoBehaviour
|
|
{
|
|
private float t;
|
|
|
|
private void Start()
|
|
{
|
|
base.transform.eulerAngles = new Vector3(Random.Range(-90f, 90f), Random.Range(-180f, 180f), 0f);
|
|
GetComponent<Rigidbody>().AddRelativeForce(Vector3.forward * 30f);
|
|
}
|
|
|
|
private void Update()
|
|
{
|
|
t += Time.deltaTime;
|
|
if (t > 1f)
|
|
{
|
|
GetComponent<ParticleSystem>().startSize += (0f - GetComponent<ParticleSystem>().startSize) / 30f;
|
|
GetComponent<ParticleSystem>().startColor += (new Color(GetComponent<ParticleSystem>().startColor.r, GetComponent<ParticleSystem>().startColor.g, GetComponent<ParticleSystem>().startColor.b, 0f) - GetComponent<ParticleSystem>().startColor) / 10f;
|
|
}
|
|
if (t > 2.5f)
|
|
{
|
|
Object.Destroy(base.gameObject);
|
|
}
|
|
}
|
|
}
|