CapersProject/Assets/02.Scripts/BehaviorTree/Npc/Customer/Action/OrderFail.cs

28 lines
726 B
C#
Raw Normal View History

2024-09-30 12:05:19 +00:00
using System;
using BehaviorDesigner.Runtime.Tasks;
using BlueWater.Interfaces;
using BlueWater.Players.Tycoons;
using Action = BehaviorDesigner.Runtime.Tasks.Action;
namespace BlueWater.BehaviorTrees.Actions
{
[TaskCategory("Custom/Npc/Customer")]
[Serializable]
public class OrderFail : Action
{
private TycoonPlayer _tycoonPlayer;
public override void OnAwake()
{
_tycoonPlayer = GameManager.Instance.CurrentTycoonPlayer;
}
public override TaskStatus OnUpdate()
{
var damageable = _tycoonPlayer.GetComponent<IDamageable>();
damageable?.TakeDamage(1);
return TaskStatus.Success;
}
}
}