代码拉取完成,页面将自动刷新
//
// Created by liaoyunjie on 24-5-15.
//
#include "ShootStrategy.h"
#include "ImageManager.h"
#include "aircraft.h"
#include "defs.h"
auto BaseShootStrategy::shoot(const BaseAircraft* aircraft)
-> std::list<std::shared_ptr<Bullet>> {
return {};
}
auto DirectShootStrategy::shoot(const BaseAircraft* aircraft)
-> std::list<std::shared_ptr<Bullet>> {
std::list<std::shared_ptr<Bullet>> bullets;
int width, height, direction = aircraft->direction();
FlyingObjectType type;
if (direction == -1) {
width = ImageManager::HERO_BULLET_IMAGE.width();
height = ImageManager::HERO_BULLET_IMAGE.height();
type = HERO_BULLET;
} else {
width = ImageManager::ENEMY_BULLET_IMAGE.width();
height = ImageManager::ENEMY_BULLET_IMAGE.height();
type = ENEMY_BULLET;
}
for (int i = 0; i < aircraft->shoot_num(); i++) {
bullets.push_back(std::make_shared<Bullet>(
type, aircraft->location_x() + 10 * (2 * i - aircraft->shoot_num() + 1),
aircraft->location_y(), 0, BULLET_SPEED * direction, width, height,
aircraft->bullet_power()));
}
return bullets;
}
此处可能存在不合适展示的内容,页面不予展示。您可通过相关编辑功能自查并修改。
如您确认内容无涉及 不当用语 / 纯广告导流 / 暴力 / 低俗色情 / 侵权 / 盗版 / 虚假 / 无价值内容或违法国家有关法律法规的内容,可点击提交进行申诉,我们将尽快为您处理。