/
TON618OFF
/
Unity-Project-RTU
Обзор
Документация
Войти
/
TON618OFF
/
Unity-Project-RTU
Код
Запросы
0
Задачи
Вики
Пакеты
0
Релизы
0
Аналитика
Безопасность
master
Library/PackageCache/com.unity.testtools.codecoverage@1.2.6/Samples~/Tutorial/Asteroids/Scripts/Weapons/LaserController.cs
36 строк
851 B
TON618OFF
release
03 окт 2024, 22:20
03 окт 2024, 22:20
7c70e9f
Код
Авторство
О чём код?
using UnityEngine; public class LaserController : BaseProjectile { public bool isActive = true; public float duration = 0.75f; private void Update() { if (!GameManager.IsPaused) { if (isActive) Expand(); else Shrink(); duration -= Time.deltaTime; if (duration <= 0.0f) isActive = false; } } private void Expand() { if (transform.localScale.y <= 25.0f) transform.localScale += Vector3.up * Time.deltaTime * 75.0f; } private void Shrink() { transform.localScale -= Vector3.up * Time.deltaTime * 75.0f; transform.position += transform.up * Time.deltaTime * 75.0f; if (transform.localScale.y <= 0.0f) Destroy(gameObject); } }