修改sendupdatemsg消息发送时机 子弹扣血问题
This commit is contained in:
parent
c88e463f97
commit
7dd91deffb
@ -40,9 +40,6 @@ void Android::Update(int delta_time)
|
||||
}
|
||||
}
|
||||
InternalUpdate(delta_time);
|
||||
if (room->GetFrameNo() % 2 == 0) {
|
||||
SendUpdateMsg();
|
||||
}
|
||||
++updated_times_;
|
||||
}
|
||||
|
||||
|
@ -65,6 +65,7 @@ void Bullet::OnHit(std::set<Entity*>& objects)
|
||||
float def = hum->ability.def * (1 + hum->GetBuffAttrRate(kHAT_Def)) +
|
||||
hum->GetBuffAttrAbs(kHAT_Def);
|
||||
float finaly_dmg = dmg * (1 - def/MetaMgr::Instance()->K);
|
||||
finaly_dmg = std::max(finaly_dmg, 0.0f);
|
||||
player->stats.damage_amount_out += finaly_dmg;
|
||||
hum->DecHP(finaly_dmg, player->GetEntityUniId(), player->name, gun_meta->i->id());
|
||||
#ifdef DEBUG
|
||||
|
@ -25,9 +25,9 @@ class Entity
|
||||
virtual bool IsDead(Room* room) { return false;};
|
||||
virtual long long GetDeadFrameNo(Room* room) { return 0;};
|
||||
virtual void OnPreCollision(Room* room) {};
|
||||
int GetEntityUniId() { return entity_uniid_; }
|
||||
EntityType_e GetEntityType() { return entity_type_; }
|
||||
EntitySubType_e GetEntitySubType() { return entity_subtype_; }
|
||||
int GetEntityUniId() const { return entity_uniid_; }
|
||||
EntityType_e GetEntityType() const { return entity_type_; }
|
||||
EntitySubType_e GetEntitySubType() const { return entity_subtype_; }
|
||||
virtual bool IsEntityType(EntityType_e type) { return type == entity_type_;}
|
||||
virtual bool IsEntitySubType(EntitySubType_e subtype) { return subtype == entity_subtype_;}
|
||||
int GetGridId() const { return grid_id_; }
|
||||
|
@ -38,7 +38,15 @@ cs::SMUpdate* FrameMaker::MakeUpdateMsg(const Human* hum)
|
||||
auto& tuple = room->frame_event.shots_[idx];
|
||||
if (hum->CanSee(std::get<0>(tuple))) {
|
||||
*msg->add_shots() = std::get<1>(tuple);
|
||||
} else {
|
||||
#ifdef DEBUG
|
||||
abort();
|
||||
#endif
|
||||
}
|
||||
} else {
|
||||
#ifdef DEBUG
|
||||
abort();
|
||||
#endif
|
||||
}
|
||||
}
|
||||
for (size_t idx : hum->bullets_) {
|
||||
|
@ -46,9 +46,6 @@ void Player::Update(int delta_time)
|
||||
}
|
||||
}
|
||||
InternalUpdate(delta_time);
|
||||
if (room->GetFrameNo() % 2 == 0) {
|
||||
SendUpdateMsg();
|
||||
}
|
||||
++updated_times_;
|
||||
}
|
||||
|
||||
|
@ -117,6 +117,9 @@ void Room::Update(int delta_time)
|
||||
pair.second->Update(50);
|
||||
}
|
||||
if (GetFrameNo() % 2 == 0) {
|
||||
for (auto& pair : human_hash_) {
|
||||
pair.second->SendUpdateMsg();
|
||||
}
|
||||
frame_event.Clear();
|
||||
}
|
||||
++frameno_;
|
||||
|
Loading…
x
Reference in New Issue
Block a user