2019-08-03 17:36:17 +02:00
|
|
|
|
using UnityEngine;
|
2019-08-14 16:17:48 +02:00
|
|
|
|
using Saltosion.OneWeapon.Enemies;
|
2019-08-03 17:36:17 +02:00
|
|
|
|
|
|
|
|
|
namespace Saltosion.OneWeapon.AI {
|
2019-08-04 15:44:44 +02:00
|
|
|
|
public abstract class AIBehaviour : MonoBehaviour {
|
2019-08-14 18:05:41 +02:00
|
|
|
|
[HideInInspector]
|
2019-08-04 15:44:44 +02:00
|
|
|
|
public string CurrentStatus = "";
|
|
|
|
|
|
2019-08-03 18:14:47 +02:00
|
|
|
|
/* Returns whether or not Execute() should be called this frame */
|
2019-08-14 18:05:41 +02:00
|
|
|
|
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;
|
|
|
|
|
}
|
2019-08-03 17:36:17 +02:00
|
|
|
|
}
|
|
|
|
|
}
|