그 보스 페이즈? 노션 보고 잘 만들어주세요

TMP는 깃에서 없애야 하는데 저 할 줄 모르니까
알아서 잘 해보시고
어자피 프로젝트 크기 5메가바이트도 안 넘으니까
굳이굳이 할 필요 없으심
즐
전 자러감ㅋㅋ
This commit is contained in:
김도환
2026-05-09 00:14:27 +09:00
parent f1213cd247
commit c5421de715
59 changed files with 817 additions and 242 deletions

View File

@@ -1,45 +1,45 @@
using Unicorn.Game.Hitbox;
using Unicorn.Hitbox;
using UnityEngine;
using NotImplementedException = System.NotImplementedException;
namespace Unicorn.Game
namespace Unicorn
{
public partial class LivingEntity : MonoBehaviour
{
private Rigidbody2D _rb;
public float health = 20.0f;
private Rigidbody2D Rb { get; set; }
private bool _invulnerable = false;
private void Start()
{
_rb = TryGetComponent(out Rigidbody2D rb) ? rb : null;
Rb = TryGetComponent(out Rigidbody2D rb) ? rb : null;
}
private void OnTriggerEnter2D(Collider2D other)
{
if (_rb == null) return;
if (Rb == null) return;
var transformPosition = other.transform.position - transform.position;
_rb.linearVelocity = Vector2.zero;
_rb.AddForce(transformPosition.normalized * health, ForceMode2D.Impulse);
Rb.linearVelocity = Vector2.zero;
Rb.AddForce(transformPosition.normalized * health, ForceMode2D.Impulse);
}
public void Damage(DamageInfo info)
{
health -= info.damage;
if (_invulnerable) return;
health -= info.Damage;
OnDamaged(info);
if (health <= 0.0f) OnDeath();
}
protected virtual void OnDeath()
{
throw new NotImplementedException();
}
protected virtual void OnDeath() { }
public Rigidbody2D Rb => _rb;
protected virtual void OnDamaged(DamageInfo info)
protected virtual void OnDamaged(DamageInfo info) { }
protected virtual void OnKnockback(DamageInfo info)
{
throw new NotImplementedException();
var dir = transform.position - info.HitPoint;
Rb.AddForce(dir.normalized * info.KnockbackForce, ForceMode2D.Impulse);
}
}
}