Files
UltimateFishing/Assets/Scripts/Assembly-CSharp/Particle_force.cs
2026-02-21 16:45:37 +08:00

32 lines
889 B
C#

using UnityEngine;
public class Particle_force : MonoBehaviour
{
private float t;
private void Start()
{
base.transform.eulerAngles = new Vector3(Random.Range(-40f, -60f), Random.Range(-180f, 180f), 0f);
GetComponent<Rigidbody>().AddRelativeForce(Vector3.forward * 20f * Random.Range(0.75f, 1.5f));
}
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 > 2f)
{
Object.Destroy(base.gameObject);
}
}
private void FixedUpdate()
{
GetComponent<Rigidbody>().AddForce(-Vector3.up / 4f);
}
}