1
This commit is contained in:
parent
933b77ceaa
commit
5eada9e9de
@ -178,3 +178,9 @@ void Car::SyncPos()
|
|||||||
room->grid_service->MoveCreature(this);
|
room->grid_service->MoveCreature(this);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
float Car::GetRadius()
|
||||||
|
{
|
||||||
|
abort();
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
@ -28,6 +28,7 @@ class Car : public Creature
|
|||||||
void GetDown(Human* passenger);
|
void GetDown(Human* passenger);
|
||||||
void GetOn(Human* passenger);
|
void GetOn(Human* passenger);
|
||||||
void SyncPos();
|
void SyncPos();
|
||||||
|
virtual float GetRadius() override;
|
||||||
|
|
||||||
private:
|
private:
|
||||||
int AllocSeat();
|
int AllocSeat();
|
||||||
|
@ -1344,3 +1344,53 @@ RoomObstacle* Creature::SummonObstacle(int id, const a8::Vec2& pos)
|
|||||||
}
|
}
|
||||||
return obstacle;
|
return obstacle;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
bool Creature::CollisonDetection()
|
||||||
|
{
|
||||||
|
#if 0
|
||||||
|
if (room->OverBorder(GetPos(), GetRadius())){
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
if (HasBuffEffect(kBET_ThroughWall) ||
|
||||||
|
HasBuffEffect(kBET_Fly)) {
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
std::set<ColliderComponent*> colliders;
|
||||||
|
room->map_service->GetColliders(room, GetX(), GetY(), colliders);
|
||||||
|
|
||||||
|
AabbCollider aabb_box;
|
||||||
|
GetAabbBox(aabb_box);
|
||||||
|
for (ColliderComponent* collider : colliders) {
|
||||||
|
switch (collider->owner->GetEntityType()) {
|
||||||
|
case ET_Obstacle:
|
||||||
|
{
|
||||||
|
Obstacle* obstacle = (Obstacle*)collider->owner;
|
||||||
|
if (!obstacle->IsDead(room) &&
|
||||||
|
(
|
||||||
|
(collider->type == CT_Aabb && aabb_box.Intersect((ColliderComponent*)collider)) ||
|
||||||
|
(collider->type == CT_Circle && self_collider_->Intersect((ColliderComponent*)collider))
|
||||||
|
)) {
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
break;
|
||||||
|
case ET_Building:
|
||||||
|
{
|
||||||
|
if (
|
||||||
|
(
|
||||||
|
(collider->type == CT_Aabb && aabb_box.Intersect((ColliderComponent*)collider)) ||
|
||||||
|
(collider->type == CT_Circle && self_collider_->Intersect((ColliderComponent*)collider))
|
||||||
|
)
|
||||||
|
) {
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
break;
|
||||||
|
default:
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
#endif
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
@ -120,6 +120,7 @@ class Creature : public MoveableEntity
|
|||||||
|
|
||||||
void CheckSpecObject();
|
void CheckSpecObject();
|
||||||
RoomObstacle* SummonObstacle(int id, const a8::Vec2& pos);
|
RoomObstacle* SummonObstacle(int id, const a8::Vec2& pos);
|
||||||
|
bool CollisonDetection();
|
||||||
|
|
||||||
private:
|
private:
|
||||||
|
|
||||||
|
@ -22,6 +22,7 @@ class Entity
|
|||||||
virtual void FillMFObjectFull(Room* room, Human* hum, cs::MFObjectFull* full_data) {};
|
virtual void FillMFObjectFull(Room* room, Human* hum, cs::MFObjectFull* full_data) {};
|
||||||
virtual float GetSpeed() { return 1.0f;};
|
virtual float GetSpeed() { return 1.0f;};
|
||||||
virtual void GetAabbBox(AabbCollider& aabb_box);
|
virtual void GetAabbBox(AabbCollider& aabb_box);
|
||||||
|
virtual float GetRadius() { return 0;};
|
||||||
virtual void GetCircleBox(CircleCollider& circle_box);
|
virtual void GetCircleBox(CircleCollider& circle_box);
|
||||||
virtual bool IsDead(Room* room) { return false;};
|
virtual bool IsDead(Room* room) { return false;};
|
||||||
virtual long long GetDeadFrameNo(Room* room) { return 0;};
|
virtual long long GetDeadFrameNo(Room* room) { return 0;};
|
||||||
|
@ -187,3 +187,9 @@ void Hero::RecalcSelfCollider()
|
|||||||
self_collider_->pos = a8::Vec2();
|
self_collider_->pos = a8::Vec2();
|
||||||
self_collider_->rad = meta->i->radius();
|
self_collider_->rad = meta->i->radius();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
float Hero::GetRadius()
|
||||||
|
{
|
||||||
|
return meta->i->radius();
|
||||||
|
}
|
||||||
|
@ -30,6 +30,7 @@ public:
|
|||||||
virtual void GetAabbBox(AabbCollider& aabb_box) override;
|
virtual void GetAabbBox(AabbCollider& aabb_box) override;
|
||||||
|
|
||||||
virtual float GetSpeed() override;
|
virtual float GetSpeed() override;
|
||||||
|
virtual float GetRadius() override;
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
virtual void _UpdateMove(int speed) override;
|
virtual void _UpdateMove(int speed) override;
|
||||||
|
@ -629,11 +629,6 @@ void Human::FindPathInMapService()
|
|||||||
SetPos(old_pos);
|
SetPos(old_pos);
|
||||||
}
|
}
|
||||||
|
|
||||||
float Human::GetRadius()
|
|
||||||
{
|
|
||||||
return meta->i->radius();
|
|
||||||
}
|
|
||||||
|
|
||||||
float Human::GetHP()
|
float Human::GetHP()
|
||||||
{
|
{
|
||||||
return ability.hp;
|
return ability.hp;
|
||||||
@ -3368,3 +3363,8 @@ void Human::DoSkillPostProc(bool used, int skill_id, int target_id, const a8::Ve
|
|||||||
OnAttack();
|
OnAttack();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
float Human::GetRadius()
|
||||||
|
{
|
||||||
|
return meta->i->radius();
|
||||||
|
}
|
||||||
|
@ -153,7 +153,6 @@ class Human : public Creature
|
|||||||
virtual void RecalcSelfCollider() override;
|
virtual void RecalcSelfCollider() override;
|
||||||
bool IsCollisionInMapService();
|
bool IsCollisionInMapService();
|
||||||
void FindPathInMapService();
|
void FindPathInMapService();
|
||||||
float GetRadius();
|
|
||||||
float GetHP();
|
float GetHP();
|
||||||
float GetMaxHP();
|
float GetMaxHP();
|
||||||
void BeKill(int killer_id, const std::string& killer_name, int weapon_id);
|
void BeKill(int killer_id, const std::string& killer_name, int weapon_id);
|
||||||
@ -239,6 +238,7 @@ class Human : public Creature
|
|||||||
void SetSeat(int seat) { seat_ = seat; }
|
void SetSeat(int seat) { seat_ = seat; }
|
||||||
void DeadDrop();
|
void DeadDrop();
|
||||||
virtual std::string GetName() override { return name;};
|
virtual std::string GetName() override { return name;};
|
||||||
|
virtual float GetRadius() override;
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
void _InternalUpdateMove(float speed);
|
void _InternalUpdateMove(float speed);
|
||||||
|
@ -146,6 +146,7 @@ message Player
|
|||||||
optional int32 revive_time = 22;
|
optional int32 revive_time = 22;
|
||||||
optional string name = 23;
|
optional string name = 23;
|
||||||
optional int32 normal_skill = 24;
|
optional int32 normal_skill = 24;
|
||||||
|
optional float hit_radius = 25;
|
||||||
}
|
}
|
||||||
|
|
||||||
message Robot
|
message Robot
|
||||||
|
Loading…
x
Reference in New Issue
Block a user