Платформер враги, инфраструктура, герой

This commit is contained in:
ThomasCharester committed 2026-03-09 16:28:40 +03:00
1 parent 28125eb382
commit 93819c1dd3
61 files changed
+1463 -423

No files matched your search

@@ -0,0 +1,27 @@
namespace Code.Example.Platformer.Entity
{
public class EntityHealth
{
private int _health, _maxHealth;
public bool IsDead { get; private set; }
public EntityHealth(int initialHealth)
{
_health = initialHealth;
}
public void GiveDamage(int damage)
{
_health -= damage;
if(_health <= 0) IsDead = true;
}
public void Heal(int heal)
{
if (IsDead) return;
if (_health + heal > _maxHealth) _health = _maxHealth;
else _health += heal;
}
}
}