This commit is contained in:
aozhiwei 2023-10-23 18:12:01 +08:00
parent a30efadc98
commit 2281bf1d80
2 changed files with 8 additions and 3 deletions

View File

@ -175,6 +175,7 @@ void HeroAgent::ShotNormal(const glm::vec3& dir)
} else {
owner_->Shot(shot_dir, shot_ok, 0, 0);
}
last_shot_frameno_ = owner_->room->GetFrameNo();
}
}
@ -194,6 +195,7 @@ void HeroAgent::ShotTrace()
} else {
owner_->Shot(shot_dir, shot_ok, 0, current_target_agent->GetUniId());
}
last_shot_frameno_ = owner_->room->GetFrameNo();
}
}
@ -605,6 +607,7 @@ behaviac::EBTStatus HeroAgent::CoUseSkill(int skill_id)
{
int wait_time = 0;
if (InternalUseSkill(skill_id, wait_time)) {
last_useskill_frameno_ = owner_->room->GetFrameNo();
return behaviac::BT_SUCCESS;
}
return behaviac::BT_FAILURE;
@ -905,15 +908,15 @@ int HeroAgent::GetAliveEnemyNum()
int HeroAgent::GetLastShotPassTime()
{
return (owner_->room->GetFrameNo() - last_shot_frameno_) * FRAME_RATE_MS;
}
int HeroAgent::GetLastUseSkillPassTime()
{
return (owner_->room->GetFrameNo() - last_useskill_frameno_) * FRAME_RATE_MS;
}
int HeroAgent::GetLastAttackPassTime()
{
return std::min(GetLastShotPassTime(), GetLastUseSkillPassTime());
}

View File

@ -133,5 +133,7 @@ protected:
private:
bool bullet_trace_mode_ = false;
long long flags_ = 0;
long long last_shot_frameno_ = 0;
long long last_useskill_frameno_ = 0;
std::map<int, int> dyn_hash_;
};