]> git.localhorst.tv Git - blobs.git/blobdiff - src/creature/Goal.hpp
little better seek ai
[blobs.git] / src / creature / Goal.hpp
index d664e6b7815509cdec12037582bdac2a5f7cc78d..2ec03bf255e7baa23f792e7d52a3188364d2e6f5 100644 (file)
@@ -1,18 +1,34 @@
 #ifndef BLOBS_CREATURE_GOAL_HPP_
 #define BLOBS_CREATURE_GOAL_HPP_
 
+#include <functional>
+#include <string>
+
+
 namespace blobs {
 namespace creature {
 
 class Creature;
+class Situation;
+class Steering;
 
 class Goal {
 
 public:
-       Goal();
+       using Callback = std::function<void(Goal &)>;
+
+public:
+       explicit Goal(Creature &);
        virtual ~Goal() noexcept;
 
 public:
+       Creature &GetCreature() noexcept { return c; }
+       const Creature &GetCreature() const noexcept { return c; }
+       Situation &GetSituation() noexcept;
+       const Situation &GetSituation() const noexcept;
+       Steering &GetSteering() noexcept;
+       const Steering &GetSteering() const noexcept;
+
        double Urgency() const noexcept { return urgency; }
        void Urgency(double u) noexcept { urgency = u; }
 
@@ -20,14 +36,19 @@ public:
        void Interruptible(bool i) noexcept { interruptible = i; }
 
        bool Complete() const noexcept { return complete; }
-       void Complete(bool i) noexcept { complete = i; }
+       void SetComplete() noexcept;
+       /// only supports one callback for now, new one will replace an old
+       void OnComplete(Callback) noexcept;
 
 public:
-       virtual void Enable(Creature &) { }
+       virtual std::string Describe() const = 0;
+       virtual void Enable() { }
        virtual void Tick(double dt) { }
-       virtual void Action(Creature &) { }
+       virtual void Action() { }
 
 private:
+       Creature &c;
+       Callback on_complete;
        double urgency;
        bool interruptible;
        bool complete;