BloodAndGore/Assets/Scripts/AI/AIBehaviour.cs

24 lines
664 B
C#

using UnityEngine;
using Saltosion.OneWeapon.Enemies;
namespace Saltosion.OneWeapon.AI {
public abstract class AIBehaviour : MonoBehaviour {
[HideInInspector]
public string CurrentStatus = "";
/* Returns whether or not Execute() should be called this frame */
public abstract bool CanBehave();
public abstract void Execute();
/* Calls Execute() if CanBehave() returns true, and then returns the resultof CanBehave() */
public bool TryExecute() {
bool Result = CanBehave();
if (Result) {
Execute();
}
return Result;
}
}
}