23 lines
619 B
C#
23 lines
619 B
C#
using UnityEngine;
|
|
|
|
public class WaveExpander : MonoBehaviour
|
|
{
|
|
public float expandSpeed = 15f;
|
|
public float maxRadius = 20f;
|
|
private float currentRadius = 0f;
|
|
|
|
void Update()
|
|
{
|
|
currentRadius += expandSpeed * Time.deltaTime;
|
|
|
|
// Отправляем данные в шейдер!
|
|
Shader.SetGlobalVector("_WaveCenter", transform.position);
|
|
Shader.SetGlobalFloat("_WaveRadius", currentRadius);
|
|
|
|
if (currentRadius >= maxRadius)
|
|
{
|
|
Shader.SetGlobalFloat("_WaveRadius", 0f);
|
|
Destroy(gameObject);
|
|
}
|
|
}
|
|
} |