added boss (final commit)

This commit is contained in:
MrTorex committed 2026-02-07 13:34:37 +03:00
1 parent ff19b0461e
commit 0a1cecfb4a
71 files changed
+1953 -144

No files matched your search

@@ -0,0 +1,41 @@
using Code.Gameplay.Player;
using UnityEngine;
namespace Code.Gameplay.Enemies
{
public class FeatherProjectile : MonoBehaviour
{
[SerializeField] private float _speed = 6f;
[SerializeField] private float _lifetime = 3f;
[SerializeField] private LayerMask _playerLayer;
private Vector2 _direction;
private float _timer;
public void Launch(float angle)
{
var rad = angle * Mathf.Deg2Rad;
_direction = new Vector2(Mathf.Cos(rad), Mathf.Sin(rad));
transform.rotation = Quaternion.Euler(0, 0, angle);
}
private void Update()
{
transform.Translate(_direction * (_speed * Time.deltaTime), Space.World);
var hit = Physics2D.OverlapCircle(transform.position, 0.4f, _playerLayer);
if (hit && hit.CompareTag("Player"))
{
hit.GetComponent<PlayerHealth>()?.TakeDamage();
Destroy(gameObject);
}
_timer += Time.deltaTime;
if (_timer > _lifetime)
{
Destroy(gameObject);
}
}
}
}