23 lines
732 B
C#
23 lines
732 B
C#
using Schema;
|
|
using UnityEngine;
|
|
using VOID.ScriptableObjects.Abilities;
|
|
|
|
namespace VOID.Generic.AI.Schema.Actions
|
|
{
|
|
[Description("Gets basic attack ability from this unit and save it as blackboard variable")]
|
|
[Category(SchemaCategory.ThisUnit)]
|
|
public class GetAttackAbility : Action
|
|
{
|
|
[SerializeField, WriteOnly] public BlackboardEntrySelector<BasicAbility> _saveTo;
|
|
|
|
public override NodeStatus Tick(object nodeMemory, SchemaAgent agent)
|
|
{
|
|
var thisUnit = ((UnitObjectSchemaAgent)agent).unit;
|
|
|
|
_saveTo.value = thisUnit.unitAbilityBook.attackAbility;
|
|
if (!_saveTo.value) return NodeStatus.Failure;
|
|
|
|
return NodeStatus.Success;
|
|
}
|
|
}
|
|
} |