添加grass water ice出来

This commit is contained in:
aozhiwei 2021-03-08 10:36:39 +08:00
parent 21a5be0d4f
commit 8ce7854986
2 changed files with 69 additions and 1 deletions

View File

@ -4291,12 +4291,74 @@ void Human::CheckSpecObject()
std::set<ColliderComponent*> colliders;
room->map_service->GetSpecColliders(spec_flags, room, GetPos().x, GetPos().y, colliders);
bool in_grass = false;
bool in_water = false;
bool in_ice = false;
for (const ColliderComponent* collider : colliders) {
switch (collider->owner->GetEntityType()) {
case ET_Loot:
case ET_Obstacle:
case ET_Building:
break;
default:
break;
}
}
if (in_grass) {
if (!HasBuffEffect(kBET_InGrass)) {
OnEnterGrass();
}
} else {
if (HasBuffEffect(kBET_InGrass)) {
OnLeaveGrass();
}
}
if (in_water) {
if (!HasBuffEffect(kBET_InWater)) {
OnEnterWater();
}
} else {
if (HasBuffEffect(kBET_InWater)) {
OnLeaveWater();
}
}
if (in_ice) {
if (!HasBuffEffect(kBET_InIce)) {
OnEnterIce();
}
} else {
if (HasBuffEffect(kBET_InIce)) {
OnLeaveIce();
}
}
}
void Human::OnEnterGrass()
{
}
void Human::OnLeaveGrass()
{
}
void Human::OnEnterWater()
{
}
void Human::OnLeaveWater()
{
}
void Human::OnEnterIce()
{
}
void Human::OnLeaveIce()
{
}

View File

@ -356,6 +356,12 @@ private:
void DoGetOnWithLoot(Loot* loot_entity);
void DoGetOnWithCar(Car* car);
void CheckSpecObject();
void OnEnterGrass();
void OnLeaveGrass();
void OnEnterWater();
void OnLeaveWater();
void OnEnterIce();
void OnLeaveIce();
protected:
int level_ = 0;