This commit is contained in:
aozhiwei 2019-07-18 10:16:22 +08:00
parent b06e983ccd
commit afd4e8061a
4 changed files with 26 additions and 30 deletions

View File

@ -235,6 +235,7 @@ void Human::Shot()
void Human::DirectShot(MetaData::Equip* bullet_meta, int skill_id)
{
#if 0
for (auto& tuple : bullet_meta->bullet_born_offset) {
a8::Vec2 bullet_born_offset = a8::Vec2(std::get<0>(tuple), std::get<1>(tuple));
bullet_born_offset.Rotate(attack_dir.CalcAngle(a8::Vec2::UP));
@ -284,6 +285,7 @@ void Human::DirectShot(MetaData::Equip* bullet_meta, int skill_id)
}
}
OnAttack();
#endif
}
void Human::RecalcSelfCollider()

View File

@ -48,38 +48,25 @@ namespace MetaData
void Equip::Init()
{
{
std::vector<std::string> strings;
a8::Split(i->bullet_born_offset(), strings, '|');
for (auto& str : strings) {
std::vector<std::string> strings2;
a8::Split(str, strings2, ':');
assert(strings2.size() >= 2);
bullet_born_offset.push_back(std::make_tuple(
a8::XValue(strings2[0]).GetDouble(),
a8::XValue(strings2[1]).GetDouble(),
strings2.size() > 2 ? a8::XValue(strings2[2]).GetDouble() : 0
)
);
}
}
#if 0
{
std::vector<std::string> strings;
a8::Split(i->volume(), strings, '|');
for (auto& str : strings) {
std::vector<std::string> strings2;
a8::Split(str, strings2, ':');
assert(strings2.size() == 2);
if (strings2.size() >= 2) {
int slot = a8::XValue(strings2[0]);
int num = a8::XValue(strings2[1]);
if (slot >= 0 && slot < volume.size()){
volume[slot] = num;
}
std::vector<std::string> strings0;
a8::Split(i->bullet_born_offset(), strings0, '$');
for (auto& str0 : strings0) {
std::vector<std::string> strings;
a8::Split(str0, strings, '|');
auto& p = a8::FastAppend(bullet_born_offset);
std::get<0>(p) = i->bullet_delay() * (bullet_born_offset.size() - 1);
for (auto& str : strings) {
std::vector<std::string> strings2;
a8::Split(str, strings2, ':');
assert(strings2.size() >= 2);
auto& born_point = a8::FastAppend(std::get<1>(p));
born_point.born_offset = a8::Vec2(a8::XValue(strings2[0]).GetDouble(),
a8::XValue(strings2[1]).GetDouble()
);
born_point.angle = strings2.size() > 2 ? a8::XValue(strings2[2]).GetDouble() : 0;
}
}
}
#endif
}
bool Equip::CanDrop()

View File

@ -47,11 +47,17 @@ namespace MetaData
const metatable::Item* i = nullptr;
};
struct BulletBornPoint
{
a8::Vec2 born_offset;
float angle = 0.0f;
};
struct Equip
{
const metatable::Equip* i = nullptr;
std::vector<std::tuple<float, float, float>> bullet_born_offset;
std::vector<std::tuple<int, std::vector<BulletBornPoint>>> bullet_born_offset;
std::array<int, IS_END> volume = {};
void Init();

View File

@ -85,6 +85,7 @@ message Equip
//required string inventory_slot = 31; //
//required int32 _inventory_slot = 32; //
required int32 bullet_delay = 33;
}
message EquipUpgrade