+ SingleRoll 로직 수정 (간헐적으로 무한루프에 빠져서 멈추는 경우가 있었는데, 지금도 있는지 계속 해봐야 암) + StunParticle Stop() + Clear()로 스턴이 끝나면 즉시 파티클 종료
43 lines
1.1 KiB
C#
43 lines
1.1 KiB
C#
using System;
|
|
using BehaviorDesigner.Runtime.Tasks;
|
|
using BlueWater.Interfaces;
|
|
using UnityEngine;
|
|
using Action = BehaviorDesigner.Runtime.Tasks.Action;
|
|
|
|
namespace BlueWater.BehaviorTrees.Enemies.Bosses.Actions
|
|
{
|
|
[TaskCategory("Custom/Enemy/Boss")]
|
|
[Serializable]
|
|
public class SelfStun : Action
|
|
{
|
|
[SerializeField]
|
|
private float _stunDuration = 4f;
|
|
|
|
private IStunnable _iStunnable;
|
|
private float _elapsedTime;
|
|
|
|
public override void OnAwake()
|
|
{
|
|
_iStunnable = transform.GetComponent<IStunnable>();
|
|
}
|
|
|
|
public override void OnStart()
|
|
{
|
|
_iStunnable?.Stun(_stunDuration);
|
|
_elapsedTime = 0f;
|
|
}
|
|
|
|
public override TaskStatus OnUpdate()
|
|
{
|
|
if (_iStunnable == null)
|
|
{
|
|
Debug.Log("_iStunnable을 찾을 수 없습니다.");
|
|
return TaskStatus.Success;
|
|
}
|
|
|
|
_elapsedTime += Time.deltaTime;
|
|
|
|
return _elapsedTime <= _stunDuration ? TaskStatus.Running : TaskStatus.Success;
|
|
}
|
|
}
|
|
} |