namespace app {
struct Assets;
}
+namespace math {
+ class GaloisLFSR;
+}
namespace creature {
class Creature;
const Steering &GetSteering() const noexcept;
app::Assets &Assets() noexcept;
const app::Assets &Assets() const noexcept;
+ math::GaloisLFSR &Random() noexcept;
double Urgency() const noexcept { return urgency; }
void Urgency(double u) noexcept { urgency = u; }
void Interruptible(bool i) noexcept { interruptible = i; }
bool Complete() const noexcept { return complete; }
- void SetComplete() noexcept;
+ void SetComplete();
+ void SetForeground();
+ void SetBackground();
/// only supports one callback for now, new one will replace an old
- void OnComplete(Callback) noexcept;
+ void WhenComplete(Callback) noexcept;
+ void WhenForeground(Callback) noexcept;
+ /// on background will not be called when the goal is first inserted
+ /// but only after is has been in the foreground once
+ void WhenBackground(Callback) noexcept;
public:
virtual std::string Describe() const = 0;
virtual void Tick(double dt) { }
virtual void Action() { }
+private:
+ virtual void OnComplete() { }
+ virtual void OnForeground() { }
+ virtual void OnBackground() { }
+
private:
Creature &c;
Callback on_complete;
+ Callback on_foreground;
+ Callback on_background;
double urgency;
bool interruptible;
bool complete;