You cannot select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

35 lines
1.1 KiB
C#

using MalbersAnimations.Events;
using UnityEngine;
using UnityEngine.Events;
namespace MalbersAnimations.Controller.AI
{
[CreateAssetMenu(menuName = "Malbers Animations/Pluggable AI/Tasks/Invoke Event")]
public class InvokeEventTask : MTask
{
public override string DisplayName => "General/Invoke Event";
[Space, Tooltip("Send the Animal as the Event Parameter or the Target")]
public Affected send = Affected.Self;
public GameObjectEvent Raise = new GameObjectEvent();
public override void StartTask(MAnimalBrain brain, int index)
{
switch (send)
{
case Affected.Self:
Raise.Invoke(brain.Animal.gameObject);
break;
case Affected.Target:
Raise.Invoke(brain.Target.gameObject);
break;
default:
break;
}
brain.TaskDone(index);
}
void Reset() { Description = "Raise the Event when the Task start. Use this only for Scriptable Assets."; }
}
}