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

53 lines
1.2 KiB
C#

using UnityEngine;
public class smoke_force : MonoBehaviour
{
private float t1;
private float t;
public float delay = 0.7f;
private bool expl;
public float force_k = 1f;
private void explo()
{
expl = true;
base.transform.eulerAngles = new Vector3(Random.Range(-50f, -85f), Random.Range(-180f, 180f), 0f);
GetComponent<Rigidbody>().AddRelativeForce(Vector3.forward * 50f * force_k * Random.Range(0.9f, 1.1f));
}
private void Update()
{
t1 += Time.deltaTime;
if (t1 >= delay)
{
t += Time.deltaTime;
if (t > 3f)
{
MonoBehaviour.print(GetComponent<ParticleSystem>().startSize);
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 > 7f)
{
Object.Destroy(base.gameObject);
}
}
}
private void FixedUpdate()
{
if (t1 >= delay)
{
if (!expl)
{
explo();
}
GetComponent<Rigidbody>().AddForce(-Vector3.up / 4f);
}
}
}