Files
Ultimate-Fishing-Simulator-…/Assets/Scripts/Assembly-CSharp/DeformationManager.cs
2026-03-04 09:37:33 +08:00

60 lines
1.0 KiB
C#

using UnityEngine;
using UnityEngine.Rendering.HighDefinition;
public class DeformationManager : MonoBehaviour
{
private float startTime;
private float currentTime;
public float defaultAmplitude = 0.075f;
private float amplitude;
public float defaultSpeed = 0.5f;
private float speed;
private void Awake()
{
if (speed == 0f)
{
speed = defaultSpeed;
}
if (amplitude == 0f)
{
amplitude = defaultAmplitude;
}
}
private void OnEnable()
{
startTime = Time.realtimeSinceStartup;
base.transform.localScale = Vector3.zero;
}
private void Update()
{
currentTime = Time.realtimeSinceStartup - startTime;
float num = Mathf.Clamp01(currentTime * speed);
if (num >= 1f)
{
base.gameObject.SetActive(value: false);
currentTime = 0f;
amplitude = defaultAmplitude;
}
base.transform.localScale = new Vector3(num + 0.1f, 1f, num + 0.1f);
GetComponent<WaterDeformer>().amplitude = (1f - num) * amplitude;
}
public void SetAmplitude(float f)
{
amplitude = f;
}
public void SetSpeed(float f)
{
speed = f;
}
}