| 123456789101112131415161718192021222324252627282930313233343536373839 |
- //
- // enemy.cxx
- // danmaku
- //
- // Created by Sam Jaffe on 5/26/19.
- // Copyright © 2019 Sam Jaffe. All rights reserved.
- //
- #include "danmaku/enemy.hpp"
- #include <json/json.h>
- #include "danmaku/bullet_pattern.hpp"
- #include "danmaku/serial.hpp"
- #include "resource_factory/prototype_factory.hpp"
- using namespace danmaku;
- enemy::enemy(Json::Value const & json, graphics::object const & obj,
- attack_factory get_attack)
- : actor(json, obj), points_(to_points_map(json["points"])) {
- attack_ = to_vector(json["attack"], get_attack, this);
- }
- void enemy::update(float delta) {
- entity::update(delta);
- attack_[0]->update(delta);
- }
- std::unique_ptr<enemy> make_enemy(Json::Value const & json,
- graphics::object const & obj,
- attack_factory get_attack) {
- return std::make_unique<enemy>(json, obj, get_attack);
- }
- BIND_ACTOR("enemy", &make_enemy);
- // to_vector(Json::Value, attack_factory, actor*)
- #include "danmaku/serial.tpp"
|