obstacle添加圆形碰撞体
This commit is contained in:
parent
6f2090e278
commit
3301cec6db
@ -90,6 +90,13 @@ void Obstacle::RecalcSelfCollider()
|
||||
break;
|
||||
}
|
||||
}
|
||||
if (!self_collider_) {
|
||||
self_collider_ = new CircleCollider();
|
||||
self_collider_->owner = this;
|
||||
AddEntityCollider(self_collider_);
|
||||
self_collider_->pos = a8::Vec2();
|
||||
self_collider_->rad = 0.0f;
|
||||
}
|
||||
}
|
||||
|
||||
void Obstacle::FillMFObjectPart(Room* room, cs::MFObjectPart* part_data)
|
||||
@ -273,30 +280,29 @@ void Obstacle::Explosion(Bullet* bullet)
|
||||
hum->DecHP(finaly_dmg, VP_Mine, "地雷", VW_Mine);
|
||||
}
|
||||
}
|
||||
break;
|
||||
case ET_Obstacle:
|
||||
{
|
||||
Obstacle* obstacle = (Obstacle*)target;
|
||||
if (!obstacle->IsDead(room) && obstacle->meta->i->attack_type() == 1) {
|
||||
float dmg = meta->i->damage();
|
||||
float def = 0;
|
||||
float finaly_dmg = dmg * (1 - def/MetaMgr::Instance()->K);
|
||||
break;
|
||||
case ET_Obstacle:
|
||||
{
|
||||
Obstacle* obstacle = (Obstacle*)target;
|
||||
if (!obstacle->IsDead(room) && obstacle->meta->i->attack_type() == 1) {
|
||||
float dmg = meta->i->damage();
|
||||
float def = 0;
|
||||
float finaly_dmg = dmg * (1 - def/MetaMgr::Instance()->K);
|
||||
|
||||
obstacle->SetHealth(room,
|
||||
std::max(0.0f, obstacle->health_ - finaly_dmg));
|
||||
if (obstacle->GetHealth(room) <= 0.01f) {
|
||||
obstacle->Die(room);
|
||||
}
|
||||
if (obstacle->IsDead(room)) {
|
||||
bullet->player->DropItems(obstacle);
|
||||
}
|
||||
obstacle->BroadcastFullState(room);
|
||||
}
|
||||
obstacle->SetHealth(room,
|
||||
std::max(0.0f, obstacle->health_ - finaly_dmg));
|
||||
if (obstacle->GetHealth(room) <= 0.01f) {
|
||||
obstacle->Die(room);
|
||||
}
|
||||
break;
|
||||
default:
|
||||
break;
|
||||
|
||||
if (obstacle->IsDead(room)) {
|
||||
bullet->player->DropItems(obstacle);
|
||||
}
|
||||
obstacle->BroadcastFullState(room);
|
||||
}
|
||||
}
|
||||
break;
|
||||
default:
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user