1
This commit is contained in:
parent
f98124ec0a
commit
d0b378e17d
@ -96,6 +96,9 @@ void Player::InternalUpdate(int delta_time)
|
||||
if (emote) {
|
||||
UpdateEmote();
|
||||
}
|
||||
if (jump) {
|
||||
UpdateJump();
|
||||
}
|
||||
if (get_down) {
|
||||
UpdateGetDown();
|
||||
}
|
||||
@ -327,6 +330,41 @@ void Player::UpdateEmote()
|
||||
emote_id = 0;
|
||||
}
|
||||
|
||||
void Player::UpdateJump()
|
||||
{
|
||||
if (HasBuffEffect(kBET_Fly)) {
|
||||
DoJump();
|
||||
if (GetPos().Distance(room->last_player_jump_pos) > 64 * 4) {
|
||||
size_t num = 2 + rand() % 2;
|
||||
for (size_t i = 0; i < num; ++i){
|
||||
room->xtimer.AddDeadLineTimerAndAttach
|
||||
(SERVER_FRAME_RATE / 10,
|
||||
a8::XParams()
|
||||
.SetSender(this),
|
||||
[] (const a8::XParams& param)
|
||||
{
|
||||
Human* hum = (Human*)param.sender.GetUserData();
|
||||
hum->room->TouchHumanList
|
||||
(
|
||||
a8::XParams()
|
||||
.SetSender(hum),
|
||||
[] (Human* hum, a8::XParams& param) -> bool
|
||||
{
|
||||
if (hum->HasBuffEffect(kBET_Fly) && hum->IsAndroid()) {
|
||||
hum->DoJump();
|
||||
return false;
|
||||
}
|
||||
return true;
|
||||
});
|
||||
},
|
||||
&xtimer_attacher.timer_list_);
|
||||
}
|
||||
}
|
||||
room->last_player_jump_pos = GetPos();
|
||||
}
|
||||
jump = false;
|
||||
}
|
||||
|
||||
void Player::UpdateGetDown()
|
||||
{
|
||||
DoGetDown();
|
||||
|
@ -55,6 +55,8 @@ class Player : public Human
|
||||
bool emote = false;
|
||||
int emote_id = 0;
|
||||
|
||||
bool jump = false;
|
||||
|
||||
bool use_skill = false;
|
||||
|
||||
bool get_down = false;
|
||||
@ -75,6 +77,7 @@ class Player : public Human
|
||||
void UpdateUseItemId();
|
||||
void UpdateSpectate();
|
||||
void UpdateEmote();
|
||||
void UpdateJump();
|
||||
void UpdateGetDown();
|
||||
void UpdateUseSkill();
|
||||
void Shot();
|
||||
|
@ -1068,7 +1068,7 @@ void Room::UpdateGasInactive()
|
||||
int auto_jump_min_num = MetaMgr::Instance()->GetSysParamAsInt("auto_jump_min_num");
|
||||
int auto_jump_max_num = MetaMgr::Instance()->GetSysParamAsInt("auto_jump_max_num");
|
||||
int jump_num = a8::RandEx(auto_jump_min_num, auto_jump_max_num);
|
||||
if (room->last_player_jump_pos_.Distance(room->plane.curr_pos) < 64 * 8) {
|
||||
if (room->last_player_jump_pos.Distance(room->plane.curr_pos) < 64 * 8) {
|
||||
jump_num = 1 + rand() % 2;
|
||||
}
|
||||
for (int i = 0; i < jump_num; ++i) {
|
||||
@ -1598,7 +1598,7 @@ void Room::ShuaPlane()
|
||||
plane.dir = plane.end_point - plane.start_point;
|
||||
plane.dir.Normalize();
|
||||
plane.curr_pos = plane.start_point;
|
||||
last_player_jump_pos_ = plane.curr_pos;
|
||||
last_player_jump_pos = plane.curr_pos;
|
||||
|
||||
for (auto& pair : human_hash_) {
|
||||
pair.second->MustBeAddBuff(pair.second, FLY_BUFFID);
|
||||
|
@ -45,6 +45,7 @@ public:
|
||||
MapService* map_service = nullptr;
|
||||
bool debug_trace = false;
|
||||
bool added_to_over_room = false;
|
||||
a8::Vec2 last_player_jump_pos;
|
||||
|
||||
~Room();
|
||||
void InitData(RoomInitInfo& init_info);
|
||||
@ -301,5 +302,4 @@ private:
|
||||
std::vector<ObstacleData> obstacle_datas_;
|
||||
|
||||
xtimer_list* auto_jump_timer_ = nullptr;
|
||||
a8::Vec2 last_player_jump_pos_;
|
||||
};
|
||||
|
Loading…
x
Reference in New Issue
Block a user