/
RealMotya
/
Platformer
Обзор
Документация
Войти
/
RealMotya
/
Platformer
Код
Запросы
0
Задачи
Вики
Пакеты
0
Релизы
0
CI/CD
Аналитика
Безопасность
master
Assets/_Scripts/Dragon.cs
58 строк
1 KB
VR4\IT-Cube28
Fear: добавил босса
29 янв 2026, 10:37
29 янв 2026, 10:37
ebc6168
Код
Авторство
О чём код?
using UnityEngine; using UnityEngine.Splines; using UnityEngine.UI; public class Dragon : Enemy { public GameObject fireballPrefab; public Transform fireballPoint; public Image healthImage; public SplineAnimate splineAnimate; public GameObject victoryImage; private new void Start() { base.Start(); InvokeRepeating("Fire", 2f, 2f); } private void Fire() { GameObject fireball = Instantiate(fireballPrefab, fireballPoint.position, Quaternion.identity); } public override void Death() { base.Death(); healthImage.gameObject.SetActive(false); victoryImage.SetActive(true); } public override void GetDamage(int damage) { if (_isImmortal == true) { return; } base.GetDamage(damage); animator.SetTrigger("Blink"); healthImage.fillAmount = _health / 10f; if (_health < 5 && splineAnimate.Duration != 10) { float time = splineAnimate.ElapsedTime; splineAnimate.Duration /=2; splineAnimate.ElapsedTime = time / 2; } } void Update() { } }