alot of stuff i forgot to commit

This commit is contained in:
Sylvia 2026-06-24 22:09:38 -07:00
parent fc2329a873
commit b8d516e734
60 changed files with 7397 additions and 64 deletions

View file

@ -1,19 +1,28 @@
using System;
using System.Collections;
using System.Collections.Generic;
using DamageNumbersPro;
using Unity.Mathematics;
using UnityEngine;
public class EntityStats : MonoBehaviour
{
[Header("Identification")]
public string name;
public Sprite icon; //only if applicable...
public Entity thisEntity;
[Header("Health")]
public float health;
public float maxHealth;
public DamageNumber damageNumbers;
[Header("Health UI")]
public Transform healthBar;
[Header("Stats")]
public float speed;
public float jumpPower;
[Header("State")]
public bool isStalled;
public bool abilitiesDisabled;
[Header("Ground Detection")]
[SerializeField] private Transform groundCheck;
[SerializeField] private LayerMask groundLayer;
@ -38,6 +47,14 @@ public class EntityStats : MonoBehaviour
{
health -= damage;
StartCoroutine(DamageVisual());
if (damageNumbers)
{
damageNumbers.Spawn(transform.position, damage.ToString());
}
if (healthBar)
{
UpdateHealthBar();
}
if (health <= 0)
{
thisEntity.OnDeath();
@ -64,4 +81,9 @@ public class EntityStats : MonoBehaviour
{
return Physics2D.OverlapCircle(groundCheck.position, 0.05f, groundLayer);
}
public void UpdateHealthBar()
{
healthBar.transform.localScale = new Vector3(math.clamp(health / maxHealth, 0f, 1f), 1f, 1f);
}
}