[AI] Behavior Actions 시스템 추가
Ultraworked with [Sisyphus](https://github.com/code-yeonggu/oh-my-opencode) Co-authored-by: Sisyphus <clio-agent@sisyphuslabs.ai>
This commit is contained in:
@@ -0,0 +1,33 @@
|
||||
using System;
|
||||
using UnityEngine;
|
||||
using Unity.Behavior;
|
||||
using Unity.Properties;
|
||||
using Condition = Unity.Behavior.Condition;
|
||||
using Colosseum.Enemy;
|
||||
|
||||
namespace Colosseum.AI.BehaviorActions.Conditions
|
||||
{
|
||||
/// <summary>
|
||||
/// 체력이 지정된 비율 이하인지 확인합니다.
|
||||
/// </summary>
|
||||
[Serializable, GeneratePropertyBag]
|
||||
[NodeDescription(name: "Is Health Below", story: "Check if health is below [HealthPercent] percent", category: "Combat")]
|
||||
public partial class IsHealthBelowCondition : Condition
|
||||
{
|
||||
[SerializeReference]
|
||||
public BlackboardVariable<float> HealthPercent = new BlackboardVariable<float>(50f);
|
||||
|
||||
public override bool IsTrue()
|
||||
{
|
||||
EnemyBase enemy = GameObject.GetComponent<EnemyBase>();
|
||||
|
||||
if (enemy == null)
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
float currentHealthPercent = (enemy.CurrentHealth / enemy.MaxHealth) * 100f;
|
||||
return currentHealthPercent <= HealthPercent.Value;
|
||||
}
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user