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.

33 lines
1011 B
C#

using UnityEngine;
namespace MalbersAnimations.Controller.AI
{
[CreateAssetMenu(menuName = "Malbers Animations/Pluggable AI/Tasks/Set Stance")]
public class SetStanceTask : MTask
{
public override string DisplayName => "Animal/Set Stance";
[Space, Tooltip("Apply the Task to the Animal(Self) or the Target(Target)")]
public Affected affect = Affected.Self;
public StanceID stance;
public override void StartTask(MAnimalBrain brain, int index)
{
switch (affect)
{
case Affected.Self:
Stance_Set(brain.Animal);
break;
case Affected.Target:
Stance_Set(brain.TargetAnimal);
break;
}
brain.TaskDone(index);
}
public void Stance_Set(MAnimal animal) => animal?.Stance_Set(stance);
void Reset() => Description = "Set a stance on the Animal";
}
}