1
This commit is contained in:
parent
041ff84d5f
commit
9e69d549ca
@ -19,6 +19,8 @@
|
||||
#include "obstacle.h"
|
||||
#include "car.h"
|
||||
#include "app.h"
|
||||
#include "bullet.h"
|
||||
#include "virtualbullet.h"
|
||||
|
||||
#include "mt/Buff.h"
|
||||
#include "mt/Equip.h"
|
||||
@ -1308,5 +1310,52 @@ void CallFuncBuff::InternalRangeHoldBuff(std::function<bool(glm::vec3&)> get_cen
|
||||
|
||||
void CallFuncBuff::ThrowKnife()
|
||||
{
|
||||
const mt::Equip* weapon_meta = mt::Equip::GetById(meta->_int_buff_param2);
|
||||
if (!weapon_meta) {
|
||||
return;
|
||||
}
|
||||
|
||||
for (int i = 0; i < meta->_buff_param4_int_list.size(); ++i) {
|
||||
glm::vec3 bullet_dir = GlmHelper::UP;
|
||||
GlmHelper::RotateY(bullet_dir, meta->_buff_param4_int_list[i] / 180.f);
|
||||
Position bullet_born_pos = owner->GetPos();
|
||||
bullet_born_pos.AddGlmVec3(bullet_dir * meta->_buff_param3);
|
||||
int bullet_uniid = owner->room->AllocUniid();
|
||||
int shot_uniid = 0;
|
||||
owner->room->frame_event.AddBullet
|
||||
(bullet_uniid,
|
||||
owner->GetWeakPtrRef(),
|
||||
weapon_meta,
|
||||
1,
|
||||
bullet_born_pos.ToGlmVec3(),
|
||||
bullet_dir,
|
||||
0,
|
||||
0,
|
||||
0,
|
||||
nullptr,
|
||||
shot_uniid);
|
||||
auto p = std::make_shared<VirtualBullet>();
|
||||
p->bullet_uniid = bullet_uniid;
|
||||
//p->weapon_uniid = bullet->weapon_uniid;
|
||||
//p->skill_meta = bullet->skill_meta;
|
||||
//p->gun_meta = bullet->gun_meta;
|
||||
//p->bullet_meta = bullet->meta;
|
||||
p->sender = owner->GetWeakPtrRef();
|
||||
//p->passenger = bullet->passenger;
|
||||
p->room = owner->room;
|
||||
//p->is_pre_battle_bullet = bullet->IsPreBattleBullet();
|
||||
p->dir = bullet_dir;
|
||||
p->born_pos = bullet_born_pos;
|
||||
p->born_dir = bullet_dir;
|
||||
p->shot_uniid = shot_uniid;
|
||||
p->Init();
|
||||
owner->room->AddTask(bullet_uniid, std::make_shared<a8::CommonCbProcEx>
|
||||
(
|
||||
[p] (const a8::Args* args)
|
||||
{
|
||||
if (!p->IsDone()) {
|
||||
p->Update(50);
|
||||
}
|
||||
}));
|
||||
}
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user