This commit is contained in:
aozhiwei 2020-04-28 18:58:44 +08:00
parent 9142edc8f7
commit 03099c0e7c
3 changed files with 70 additions and 5 deletions

View File

@ -572,6 +572,61 @@ void Human::FindPathInMapService()
}
}
SetPos(old_pos);
if (entity_subtype == EST_Player && last_collider && last_collider->type == CT_Aabb) {
#if 0
AabbCollider* aabb_collider = (AabbCollider*)last_collider;
#endif
if (GetPos().x > last_collider->owner->GetPos().x) {
//在右边
if (GetPos().y > last_collider->owner->GetPos().y) {
//右上
#ifdef DEBUG
a8::XPrintf("右上\n", {});
#endif
if (move_dir.Dot(a8::Vec2(1, -1)) > 0.000002f) {
SetPos(old_pos + a8::Vec2(2, 0));
} else {
SetPos(old_pos + a8::Vec2(0, 2));
}
} else {
//右下
#ifdef DEBUG
a8::XPrintf("右下\n", {});
#endif
if (move_dir.Dot(a8::Vec2(-1, 1)) > 0.000002f) {
SetPos(old_pos + a8::Vec2(2, 0));
} else {
SetPos(old_pos + a8::Vec2(0, -2));
}
}
} else {
//左边
if (GetPos().y > last_collider->owner->GetPos().y) {
//左上
#ifdef DEBUG
a8::XPrintf("左上\n", {});
#endif
if (move_dir.Dot(a8::Vec2(-1, -1)) > 0.000001f) {
SetPos(old_pos + a8::Vec2(-2, 0));
} else {
SetPos(old_pos + a8::Vec2(0, 2));
}
} else {
//左下
#ifdef DEBUG
a8::XPrintf("左下\n", {});
#endif
if (move_dir.Dot(a8::Vec2(1, -1)) > 0.000001f) {
SetPos(old_pos + a8::Vec2(-2, 0));
} else {
SetPos(old_pos + a8::Vec2(0, -2));
}
}
}
}
if (IsCollisionInMapService()) {
SetPos(old_pos);
}
}
float Human::GetRadius()
@ -2789,6 +2844,16 @@ void Human::ProcBuffEffect(Buff* buff)
}
}
break;
case kBET_Camouflage:
{
if (aiming) {
aiming = false;
}
if (action_type != AT_None) {
CancelAction();
}
}
break;
default:
break;
}

View File

@ -74,9 +74,6 @@ void Player::Update(int delta_time)
if (use_item) {
UpdateUseItemIdx();
}
if (has_use_item_id) {
UpdateUseItemId();
}
if (action_type != AT_None) {
UpdateAction();
}
@ -103,7 +100,10 @@ void Player::Update(int delta_time)
RemoveBuffByEffectId(kBET_Camouflage);
}
}
}
if (has_use_item_id) {
UpdateUseItemId();
}
}
}
void Player::UpdateMove()

@ -1 +1 @@
Subproject commit 6770f48291d2eefd47d83699e6f7e326697a5843
Subproject commit a369c484113b240f042c62cba80afd26df91e4ca