Files
Gen_Hack-and-Slash-Roguelit…/Client/Assets/Scripts/Parsing/ConditionFunctions.cs

33 lines
966 B
C#
Raw Normal View History

using Data;
2025-08-28 16:20:24 +08:00
namespace Parsing
{
public static class ConditionFunctions
{
public static bool EntityHealth(Entity.Entity entity, int minHealth)
{
return entity.attributes.health >= minHealth;
}
public static bool HasEnemyInSight(Entity.Entity entity)
{
2025-08-28 16:20:24 +08:00
return Managers.EntityManage.Instance.ExistsHostile(entity.currentDimensionId, entity.entityPrefab);
}
public static bool HasWeapon(Entity.Entity entity)
{
return entity.GetCurrentWeapon() != null;
}
public static bool HasRangedWeapon(Entity.Entity entity)
{
var weapon = entity.GetCurrentWeapon();
return weapon is { Type: WeaponType.Ranged };
}
public static bool HasMeleeWeapon(Entity.Entity entity)
{
var weapon = entity.GetCurrentWeapon();
return weapon is { Type: WeaponType.Melee };
}
}
}