添加攻击类型处理

This commit is contained in:
aozhiwei 2019-04-10 14:06:20 +08:00
parent bc99e625bc
commit feef53a8b8
6 changed files with 29 additions and 3 deletions

View File

@ -84,7 +84,7 @@ void Bullet::OnHit(std::vector<Entity*>& objects)
case ET_Obstacle:
{
Obstacle* obstacle = (Obstacle*)target;
if (!obstacle->dead && obstacle->meta->i->attackable()) {
if (!obstacle->dead && obstacle->meta->i->attack_type() == 1) {
obstacle->health = std::min(0.0f, obstacle->health - 10);
obstacle->dead = std::min(obstacle->health, 0.001f) <= 0.01f;
obstacle->dead_frameno = room->frame_no;

View File

@ -361,3 +361,23 @@ void Human::ResetAction()
action_target_id = 0;
need_sync_active_player = true;
}
void Human::FillSMGameOver(cs::SMGameOver& msg)
{
msg.set_team_id(0);
msg.set_team_rank(0);
msg.set_team_allcnt(1);
msg.set_game_over(true);
msg.set_victory(false);
cs::MFPlayerStats* p = msg.add_player_stats();
FillMFPlayerStats(p);
}
void Human::BeKill(int killer_id, const std::string& killer_name)
{
stats.killer_id = killer_id;
stats.killer_name = killer_name;
dead = true;
health = 0.0f;
}

View File

@ -110,6 +110,8 @@ class Human : public Entity
int target_id);
void CancelAction();
void ResetAction();
void FillSMGameOver(cs::SMGameOver& msg);
void BeKill(int killer_id, const std::string& killer_name);
private:
CircleCollider* self_collider_ = nullptr;

View File

@ -40,7 +40,7 @@ void Obstacle::RecalcSelfCollider()
0.0f - door_state1->height() / 2.0f);
self_collider2_->_max = Vector2D(door_state1->width(), door_state1->height());
}
} else {
} else if (meta->i->attack_type() != 2){
switch (meta->i->type()) {
case 1:
{

View File

@ -254,6 +254,10 @@ void Player::UpdateUseItemIdx()
void Player::UpdateSpectate()
{
stats.killer_id = entity_uniid;
stats.killer_name = name;
dead = true;
health = 0.0f;
spectate = false;
}

View File

@ -22,7 +22,7 @@ message MapThing
optional float damage = 6; //
optional float damage_dia = 7; //
optional int32 drop = 8; //
optional int32 attackable = 9; //
optional int32 attack_type = 9; // 0: 1 2穿
optional int32 is_door = 10; //
optional int32 is_house = 11; //
optional int32 is_tree = 12; //