[AI] 보스 스킬 사용 액션 추가
- UseSkillAction: Behavior Tree에서 스킬 사용을 위한 액션 노드 - Melee_Slash_Boss: 보스 근접 공격 스킬 데이터 - Melee_Slash_Boss_0: 스킬 대미지 효과 (부채꼴 범위) Ultraworked with [Sisyphus](https://github.com/code-yeongyu/oh-my-opencode) Co-authored-by: Sisyphus <clio-agent@sisyphuslabs.ai>
This commit is contained in:
69
Assets/Scripts/AI/BehaviorActions/Actions/UseSkillAction.cs
Normal file
69
Assets/Scripts/AI/BehaviorActions/Actions/UseSkillAction.cs
Normal file
@@ -0,0 +1,69 @@
|
||||
using System;
|
||||
using Colosseum.Skills;
|
||||
using Unity.Behavior;
|
||||
using UnityEngine;
|
||||
using Action = Unity.Behavior.Action;
|
||||
using Unity.Properties;
|
||||
|
||||
/// <summary>
|
||||
/// 지정된 스킬을 사용하는 Behavior Tree Action.
|
||||
/// 스킬 실행이 완료될 때까지 Running 상태를 유지합니다.
|
||||
/// </summary>
|
||||
[Serializable, GeneratePropertyBag]
|
||||
[NodeDescription(name: "Use Skill", story: "[스킬] 사용", category: "Action", id: "799f1e8cfafa78b2d52ef61a6bbb29b9")]
|
||||
public partial class UseSkillAction : Action
|
||||
{
|
||||
[SerializeReference] public BlackboardVariable<SkillData> 스킬;
|
||||
|
||||
private SkillController skillController;
|
||||
|
||||
protected override Status OnStart()
|
||||
{
|
||||
// 스킬 데이터 확인
|
||||
if (스킬?.Value == null)
|
||||
{
|
||||
Debug.LogWarning("[UseSkillAction] 스킬이 null입니다.");
|
||||
return Status.Failure;
|
||||
}
|
||||
|
||||
// SkillController 컴포넌트 가져오기
|
||||
skillController = GameObject.GetComponent<SkillController>();
|
||||
if (skillController == null)
|
||||
{
|
||||
Debug.LogWarning($"[UseSkillAction] SkillController를 찾을 수 없습니다: {GameObject.name}");
|
||||
return Status.Failure;
|
||||
}
|
||||
|
||||
// 스킬 실행 시도
|
||||
bool success = skillController.ExecuteSkill(스킬.Value);
|
||||
if (!success)
|
||||
{
|
||||
// 이미 다른 스킬 사용 중이거나 쿨타임
|
||||
return Status.Failure;
|
||||
}
|
||||
|
||||
return Status.Running;
|
||||
}
|
||||
|
||||
protected override Status OnUpdate()
|
||||
{
|
||||
// SkillController가 해제된 경우
|
||||
if (skillController == null)
|
||||
{
|
||||
return Status.Failure;
|
||||
}
|
||||
|
||||
// 스킬 애니메이션이 종료되면 성공
|
||||
if (!skillController.IsPlayingAnimation)
|
||||
{
|
||||
return Status.Success;
|
||||
}
|
||||
|
||||
return Status.Running;
|
||||
}
|
||||
|
||||
protected override void OnEnd()
|
||||
{
|
||||
skillController = null;
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user