1
This commit is contained in:
parent
78a996cb8f
commit
f49e30ca15
@ -2335,11 +2335,10 @@ void Human::OnLand()
|
||||
if (IsAndroid() && team_uuid.empty()) {
|
||||
MustBeAddBuff(this, kBeRecycleBuffId);
|
||||
}
|
||||
#endif
|
||||
#endif
|
||||
if (IsPlayer()) {
|
||||
StartRefreshViewTimer();
|
||||
}
|
||||
#ifdef MAP3D
|
||||
{
|
||||
glm::vec3 center = GetPos().ToGlmVec3();
|
||||
room->map_instance->Scale(center);
|
||||
@ -2362,28 +2361,6 @@ void Human::OnLand()
|
||||
});
|
||||
#endif
|
||||
}
|
||||
#else
|
||||
if (CheckCollision()) {
|
||||
a8::Vec2 old_pos = GetPos();
|
||||
std::vector<a8::Vec2> dirs;
|
||||
{
|
||||
dirs.push_back(a8::Vec2::UP);
|
||||
dirs.push_back(a8::Vec2::DOWN);
|
||||
dirs.push_back(a8::Vec2::LEFT);
|
||||
dirs.push_back(a8::Vec2::RIGHT);
|
||||
}
|
||||
for (int i = 0; i < 10000000; i += 10) {
|
||||
for (const a8::Vec2& dir : dirs) {
|
||||
SetPos(old_pos + dir * i);
|
||||
if (!CheckCollision()) {
|
||||
room->grid_service->MoveCreature(this);
|
||||
return;
|
||||
}
|
||||
}
|
||||
}
|
||||
SetPos(old_pos);
|
||||
}
|
||||
#endif
|
||||
if (IsAndroid()) {
|
||||
int buff_uniid = MustBeAddBuff(this,
|
||||
kPeaceModeBuffId
|
||||
|
@ -25,29 +25,12 @@ a8::Vec2 Position::CalcDir2D(const Position& target_pos) const
|
||||
return a8::Vec2(target_pos.x, target_pos.z) - a8::Vec2(x, z);
|
||||
}
|
||||
|
||||
a8::Vec2 Position::CalcDir2DEx(const a8::Vec2& target_pos) const
|
||||
{
|
||||
return target_pos - ToVec2();
|
||||
}
|
||||
|
||||
a8::Vec2 Position::CalcDirGlm2DEx(const glm::vec2& target_pos) const
|
||||
{
|
||||
return a8::Vec2(target_pos.x, target_pos.y) - ToVec2();
|
||||
}
|
||||
|
||||
void Position::FromVec2(const a8::Vec2 v)
|
||||
{
|
||||
x = v.x;
|
||||
y = v.y;
|
||||
}
|
||||
|
||||
void Position::FromVec2Ex(const a8::Vec2 v)
|
||||
{
|
||||
x = v.x;
|
||||
y = v.y;
|
||||
z = 0;
|
||||
}
|
||||
|
||||
void Position::FromVec3(const a8::Vec3 v)
|
||||
{
|
||||
x = v.x;
|
||||
@ -55,19 +38,6 @@ void Position::FromVec3(const a8::Vec3 v)
|
||||
z = v.z;
|
||||
}
|
||||
|
||||
void Position::FromGlmVec2(const glm::vec2 v)
|
||||
{
|
||||
x = v.x;
|
||||
y = v.y;
|
||||
}
|
||||
|
||||
void Position::FromGlmVec2Ex(const glm::vec2 v)
|
||||
{
|
||||
x = v.x;
|
||||
y = v.y;
|
||||
z = 0;
|
||||
}
|
||||
|
||||
void Position::FromGlmVec3(const glm::vec3 v)
|
||||
{
|
||||
x = v.x;
|
||||
@ -83,23 +53,6 @@ a8::Vec2 Position::ToVec2() const
|
||||
return v2;
|
||||
}
|
||||
|
||||
a8::Vec3 Position::ToVec3() const
|
||||
{
|
||||
a8::Vec3 v;
|
||||
v.x = x;
|
||||
v.y = y;
|
||||
v.z = z;
|
||||
return v;
|
||||
}
|
||||
|
||||
glm::vec2 Position::ToGlmVec2() const
|
||||
{
|
||||
glm::vec2 v;
|
||||
v.x = x;
|
||||
v.y = y;
|
||||
return v;
|
||||
}
|
||||
|
||||
glm::vec3 Position::ToGlmVec3() const
|
||||
{
|
||||
glm::vec3 v;
|
||||
|
@ -77,21 +77,14 @@ struct Position
|
||||
float DistanceGlmVec3(const glm::vec3& v) const;
|
||||
float ManhattanDistance2D(const Position& target_pos) const;
|
||||
a8::Vec2 CalcDir2D(const Position& target_pos) const;
|
||||
a8::Vec2 CalcDir2DEx(const a8::Vec2& target_pos) const;
|
||||
a8::Vec2 CalcDirGlm2DEx(const glm::vec2& target_pos) const;
|
||||
glm::vec3 CalcDir(const Position& target_pos) const;
|
||||
|
||||
void FromVec2(const a8::Vec2 v);
|
||||
void FromVec2Ex(const a8::Vec2 v);
|
||||
void FromVec3(const a8::Vec3 v);
|
||||
|
||||
void FromGlmVec2(const glm::vec2 v);
|
||||
void FromGlmVec2Ex(const glm::vec2 v);
|
||||
void FromGlmVec3(const glm::vec3 v);
|
||||
|
||||
a8::Vec2 ToVec2() const;
|
||||
a8::Vec3 ToVec3() const;
|
||||
glm::vec2 ToGlmVec2() const;
|
||||
glm::vec3 ToGlmVec3() const;
|
||||
|
||||
const Position& AddVec2(const a8::Vec2& v);
|
||||
|
Loading…
x
Reference in New Issue
Block a user