using Godot; using System; // // Data that plant stores during runtime // public partial class RuntimePlantData : Node2D, IEntity { [Export] private int _maxHP; private int _hp; [Export] private int _line; public int Hp => _hp; public int MaxHp => _maxHP; public int Line => _line; public PlantResource Resource; public override void _Ready() { _hp = _maxHP; } public void Heal(int amount) { _hp += amount; if (MaxHp > 0) { _hp = MaxHp; } } public void TakeDamage(int amount) { _hp -= amount; if (_hp <= 0) { Kill(); } } public void Kill() { LevelController.Instance.Pools.EntityField[Resource.Layer].Remove(GlobalPosition); QueueFree(); } }