1
This commit is contained in:
parent
6d0b7425c5
commit
1865216ca2
@ -179,7 +179,18 @@ void HeroAgent::SetAttackDir(const glm::vec3& dir)
|
|||||||
|
|
||||||
void HeroAgent::ShotNormal(const glm::vec3& dir)
|
void HeroAgent::ShotNormal(const glm::vec3& dir)
|
||||||
{
|
{
|
||||||
abort();
|
if (owner_->dead) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
if (owner_->CanShot(true)) {
|
||||||
|
bool shot_ok = false;
|
||||||
|
glm::vec3 shot_dir = owner_->GetAttackDir();
|
||||||
|
if (bullet_trace_mode_) {
|
||||||
|
owner_->Shot(shot_dir, shot_ok, 0, 0);
|
||||||
|
} else {
|
||||||
|
owner_->Shot(shot_dir, shot_ok, 0, 0);
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void HeroAgent::ShotTrace()
|
void HeroAgent::ShotTrace()
|
||||||
@ -595,10 +606,24 @@ behaviac::EBTStatus HeroAgent::StartCoroutine(std::shared_ptr<BtCoroutine> corou
|
|||||||
|
|
||||||
behaviac::EBTStatus HeroAgent::RegisterEvents(behaviac::vector<BtEvent_e> events)
|
behaviac::EBTStatus HeroAgent::RegisterEvents(behaviac::vector<BtEvent_e> events)
|
||||||
{
|
{
|
||||||
|
return behaviac::BT_SUCCESS;
|
||||||
}
|
}
|
||||||
|
|
||||||
behaviac::EBTStatus HeroAgent::CoMoveForward(int min_val, int max_val)
|
behaviac::EBTStatus HeroAgent::CoMoveForward(int min_val, int max_val)
|
||||||
{
|
{
|
||||||
|
float distance = a8::RandEx(min_val, max_val);
|
||||||
|
auto context = MAKE_BTCONTEXT
|
||||||
|
(
|
||||||
|
);
|
||||||
|
auto co = std::make_shared<BtCoroutine>(context, "CoMoveForward");
|
||||||
|
co->runing_cb =
|
||||||
|
[this, context] ()
|
||||||
|
{
|
||||||
|
if (owner_->GetMovement()->GetPathSize() <= 0) {
|
||||||
|
return behaviac::BT_SUCCESS;
|
||||||
|
} else {
|
||||||
|
return behaviac::BT_RUNNING;
|
||||||
|
}
|
||||||
|
};
|
||||||
|
return StartCoroutine(co);
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user