|
|
@@ -9,7 +9,10 @@
|
|
|
#include <json/json.h>
|
|
|
#include <vector>
|
|
|
|
|
|
+#include "danmaku/bullet.hpp"
|
|
|
#include "danmaku/bullet_pattern.hpp"
|
|
|
+#include "game/engine/serial.hpp"
|
|
|
+#include "game/graphics/object.hpp"
|
|
|
#include "game/math/angle.hpp"
|
|
|
#include "game/math/common.hpp"
|
|
|
#include "game/math/math_fwd.hpp"
|
|
|
@@ -21,16 +24,19 @@ using namespace danmaku;
|
|
|
using shot = std::pair<math::vec2, float>;
|
|
|
|
|
|
struct burstshot : public danmaku::bullet_pattern {
|
|
|
- static std::shared_ptr<burstshot> create(danmaku::actor *,
|
|
|
- Json::Value const &);
|
|
|
+ static std::shared_ptr<burstshot>
|
|
|
+ create(danmaku::actor *, Json::Value const &, graphics::manager &);
|
|
|
|
|
|
- burstshot(danmaku::actor *, float shot_interval, std::vector<shot> shots);
|
|
|
+ burstshot(danmaku::actor *, float shot_interval, std::vector<shot> shots,
|
|
|
+ bullet bullet, graphics::object object);
|
|
|
void update(float delta) override;
|
|
|
|
|
|
danmaku::actor * actor;
|
|
|
danmaku::bullet_timer shot_timer;
|
|
|
float last_fired{std::numeric_limits<float>::lowest()};
|
|
|
std::vector<shot> shots;
|
|
|
+ bullet bullet_proto;
|
|
|
+ graphics::object object_proto;
|
|
|
};
|
|
|
|
|
|
std::vector<shot> shot_vector(std::size_t count, float facing, float covered,
|
|
|
@@ -54,16 +60,20 @@ std::vector<shot> shot_vector(std::size_t count, float facing, float covered,
|
|
|
}
|
|
|
|
|
|
burstshot::burstshot(danmaku::actor * actor, float shot_interval,
|
|
|
- std::vector<shot> shots)
|
|
|
- : actor(actor), shot_timer{shot_interval}, shots(shots) {}
|
|
|
+ std::vector<shot> shots, bullet blt, graphics::object obj)
|
|
|
+ : actor(actor), shot_timer{shot_interval}, shots(shots), bullet_proto(blt),
|
|
|
+ object_proto(obj) {}
|
|
|
|
|
|
std::shared_ptr<burstshot> burstshot::create(danmaku::actor * actor,
|
|
|
- Json::Value const & json) {
|
|
|
+ Json::Value const & json,
|
|
|
+ graphics::manager & manager) {
|
|
|
return std::make_shared<burstshot>(
|
|
|
actor, json["timeBetweenBullets"].asFloat(),
|
|
|
shot_vector(json["bulletsPerWave"].asUInt(),
|
|
|
json["centerAngle"].asFloat(), json["burstAngle"].asFloat(),
|
|
|
- json["bulletSpeed"].asFloat(), json["clockwise"].asBool()));
|
|
|
+ json["bulletSpeed"].asFloat(), json["clockwise"].asBool()),
|
|
|
+ json["prototype"]["damage"].asInt(),
|
|
|
+ engine::to_object(json["prototype"], manager));
|
|
|
}
|
|
|
|
|
|
void burstshot::update(float delta) {}
|