-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
9 changed files
with
105 additions
and
30 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -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<critter>& c) override; | ||
void on_update(const std::shared_ptr<critter>& c, size_t& i, const Ns& dt) override; | ||
void on_destroy(const std::shared_ptr<critter>& 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<walk_script>; | ||
|
||
const void* walk_script::type_id() const | ||
{ | ||
return &script_name; | ||
} | ||
|
||
void walk_script::on_init(const std::shared_ptr<critter>& c) | ||
{ | ||
} | ||
|
||
void walk_script::on_update(const std::shared_ptr<critter>& c, size_t& i, const Ns& dt) | ||
{ | ||
} | ||
|
||
void walk_script::on_destroy(const std::shared_ptr<critter>& 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 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters