moved stuff to a different entity script

This commit is contained in:
Sylvia 2026-06-09 18:46:33 -07:00
parent f4344c4700
commit a0bfc600ef
14 changed files with 497 additions and 189 deletions

View file

@ -0,0 +1,42 @@
using System;
using System.Collections.Generic;
using UnityEngine;
public class EntityStats : MonoBehaviour
{
public Entity thisEntity;
[Header("Health")]
public float health;
public float maxHealth;
[Header("Stats")]
public float speed;
public float jumpPower;
[Header("Ground Detection")]
[SerializeField] private Transform groundCheck;
[SerializeField] private LayerMask groundLayer;
[Header("Attack Origin")]
public Transform attackOriginPoint;
public Transform attackOriginCenter;
[Header("Abilities")]
public List<Ability> abilities = new();
[Header("Cache")]
public Rigidbody2D rb;
public void TakeDamage(float damage)
{
health -= damage;
if (health <= 0)
{
thisEntity.OnDeath();
}
}
public void Heal(float healing)
{
health += healing;
health = Math.Clamp(health, 0, maxHealth);
}
public bool OnGround()
{
return Physics2D.OverlapCircle(groundCheck.position, 0.05f, groundLayer);
}
}