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

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

@@ -14,6 +14,15 @@ namespace Code.Example.Platformer.Entity
[SerializeField] protected Animator animator;
[SerializeField] protected SpriteRenderer spriteRenderer;
[SerializeField] private Vector2 groundPoint;
private EntityHealth _health;
private PlatformerEntityData _data;
public void SetData(PlatformerEntityData data)
{
_data = data;
_health = new(data.maxHealth);
}
protected bool onGround;
@@ -29,7 +38,9 @@ namespace Code.Example.Platformer.Entity
{
onGround = CheckGround();
animator.SetBool(OnGround, onGround);
Move();
if(rigidbody2D.linearVelocity.x is > 0.01f or < -0.01f) HandleFlipX();
}
@@ -40,5 +51,7 @@ namespace Code.Example.Platformer.Entity
}
protected abstract void Move();
public virtual void GetDamage(int damage) => _health.GiveDamage(damage);
}
}