添加攻击类型处理
This commit is contained in:
parent
bc99e625bc
commit
feef53a8b8
@ -84,7 +84,7 @@ void Bullet::OnHit(std::vector<Entity*>& objects)
|
|||||||
case ET_Obstacle:
|
case ET_Obstacle:
|
||||||
{
|
{
|
||||||
Obstacle* obstacle = (Obstacle*)target;
|
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->health = std::min(0.0f, obstacle->health - 10);
|
||||||
obstacle->dead = std::min(obstacle->health, 0.001f) <= 0.01f;
|
obstacle->dead = std::min(obstacle->health, 0.001f) <= 0.01f;
|
||||||
obstacle->dead_frameno = room->frame_no;
|
obstacle->dead_frameno = room->frame_no;
|
||||||
|
@ -361,3 +361,23 @@ void Human::ResetAction()
|
|||||||
action_target_id = 0;
|
action_target_id = 0;
|
||||||
need_sync_active_player = true;
|
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;
|
||||||
|
}
|
||||||
|
@ -110,6 +110,8 @@ class Human : public Entity
|
|||||||
int target_id);
|
int target_id);
|
||||||
void CancelAction();
|
void CancelAction();
|
||||||
void ResetAction();
|
void ResetAction();
|
||||||
|
void FillSMGameOver(cs::SMGameOver& msg);
|
||||||
|
void BeKill(int killer_id, const std::string& killer_name);
|
||||||
|
|
||||||
private:
|
private:
|
||||||
CircleCollider* self_collider_ = nullptr;
|
CircleCollider* self_collider_ = nullptr;
|
||||||
|
@ -40,7 +40,7 @@ void Obstacle::RecalcSelfCollider()
|
|||||||
0.0f - door_state1->height() / 2.0f);
|
0.0f - door_state1->height() / 2.0f);
|
||||||
self_collider2_->_max = Vector2D(door_state1->width(), door_state1->height());
|
self_collider2_->_max = Vector2D(door_state1->width(), door_state1->height());
|
||||||
}
|
}
|
||||||
} else {
|
} else if (meta->i->attack_type() != 2){
|
||||||
switch (meta->i->type()) {
|
switch (meta->i->type()) {
|
||||||
case 1:
|
case 1:
|
||||||
{
|
{
|
||||||
|
@ -254,6 +254,10 @@ void Player::UpdateUseItemIdx()
|
|||||||
|
|
||||||
void Player::UpdateSpectate()
|
void Player::UpdateSpectate()
|
||||||
{
|
{
|
||||||
|
stats.killer_id = entity_uniid;
|
||||||
|
stats.killer_name = name;
|
||||||
|
dead = true;
|
||||||
|
health = 0.0f;
|
||||||
spectate = false;
|
spectate = false;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -22,7 +22,7 @@ message MapThing
|
|||||||
optional float damage = 6; //伤害
|
optional float damage = 6; //伤害
|
||||||
optional float damage_dia = 7; //伤害半径
|
optional float damage_dia = 7; //伤害半径
|
||||||
optional int32 drop = 8; //掉落
|
optional int32 drop = 8; //掉落
|
||||||
optional int32 attackable = 9; //是否可攻击
|
optional int32 attack_type = 9; //是否可攻击 0:不可破坏对象 1:可破坏对象 2:可穿透对象
|
||||||
optional int32 is_door = 10; //是否门
|
optional int32 is_door = 10; //是否门
|
||||||
optional int32 is_house = 11; //是否房间
|
optional int32 is_house = 11; //是否房间
|
||||||
optional int32 is_tree = 12; //是否树
|
optional int32 is_tree = 12; //是否树
|
||||||
|
Loading…
x
Reference in New Issue
Block a user