From e5a80257216d76f5033b4120f348f309ca7764f1 Mon Sep 17 00:00:00 2001 From: Stanislaw Halik Date: Fri, 3 May 2024 18:42:09 +0200 Subject: a wip --- src/critter-script-walk.cpp | 62 +++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 62 insertions(+) create mode 100644 src/critter-script-walk.cpp (limited to 'src/critter-script-walk.cpp') diff --git a/src/critter-script-walk.cpp b/src/critter-script-walk.cpp new file mode 100644 index 00000000..9c92798c --- /dev/null +++ b/src/critter-script-walk.cpp @@ -0,0 +1,62 @@ +#include "critter-script.hpp" +//#include "raycast.hpp" +#include "point.hpp" +#include "critter.hpp" +#include "search-result.hpp" +#include "search-astar.hpp" +#include "entity/name-of.hpp" + +namespace floormat { + +namespace { + +enum class walk_mode : uint8_t +{ + none, line, path, +}; + +struct walk_script final : critter_script +{ + const void* type_id() const override; + void on_init(const std::shared_ptr& c) override; + void on_update(const std::shared_ptr& c, size_t& i, const Ns& dt) override; + void on_destroy(const std::shared_ptr& c, script_destroy_reason reason) override; + void delete_self() noexcept override; + + point to; + path_search_result path; + walk_mode mode = walk_mode::none; +}; + +constexpr StringView script_name = name_of; + +const void* walk_script::type_id() const +{ + return &script_name; +} + +void walk_script::on_init(const std::shared_ptr& c) +{ +} + +void walk_script::on_update(const std::shared_ptr& c, size_t& i, const Ns& dt) +{ +} + +void walk_script::on_destroy(const std::shared_ptr& c, script_destroy_reason reason) +{ +} + +void walk_script::delete_self() noexcept +{ + delete this; +} + +} // namespace + +critter_script* critter_script::make_walk_script(point to, path_search_result path) +{ + return new walk_script{}; +} + +} // namespace floormat -- cgit v1.2.3