1
This commit is contained in:
parent
d935629cac
commit
498f7350d9
@ -92,10 +92,14 @@ void SprintBuff::CoCollisionCheck()
|
|||||||
|
|
||||||
void SprintBuff::Check(Position& pre_pos, std::map<int, long long>& hited_objects)
|
void SprintBuff::Check(Position& pre_pos, std::map<int, long long>& hited_objects)
|
||||||
{
|
{
|
||||||
|
if (pre_pos.ManhattanDistance2D(owner->GetPos()) < 2) {
|
||||||
|
pre_pos = owner->GetPos();
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
std::set<Creature*> enemys;
|
std::set<Creature*> enemys;
|
||||||
Position old_pos = owner->GetPos();
|
Position old_pos = owner->GetPos();
|
||||||
|
|
||||||
if (pre_pos.ManhattanDistance2D(owner->GetPos()) > 2) {
|
|
||||||
a8::Vec2 dir = owner->GetPos().CalcDir2D(pre_pos);
|
a8::Vec2 dir = owner->GetPos().CalcDir2D(pre_pos);
|
||||||
dir.Normalize();
|
dir.Normalize();
|
||||||
float distance = owner->GetPos().Distance2D2(pre_pos);
|
float distance = owner->GetPos().Distance2D2(pre_pos);
|
||||||
@ -121,7 +125,6 @@ void SprintBuff::Check(Position& pre_pos, std::map<int, long long>& hited_object
|
|||||||
OnEnemyHit(enemy);
|
OnEnemyHit(enemy);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
|
||||||
|
|
||||||
owner->SetPos(old_pos);
|
owner->SetPos(old_pos);
|
||||||
pre_pos = owner->GetPos();
|
pre_pos = owner->GetPos();
|
||||||
|
Loading…
x
Reference in New Issue
Block a user