rename zombieai -> zombiemodeai

This commit is contained in:
aozhiwei 2020-07-29 14:36:47 +08:00
parent 8ba9544bfa
commit e360400b6b
3 changed files with 22 additions and 22 deletions

View File

@ -3,13 +3,13 @@
#include "android.h" #include "android.h"
#include "metamgr.h" #include "metamgr.h"
#include "android.ai.h" #include "android.ai.h"
#include "zombie.ai.h" #include "zombiemode.ai.h"
#include "room.h" #include "room.h"
#include "app.h" #include "app.h"
Android::Android():Human() Android::Android():Human()
{ {
ai = new ZombieAI; ai = new ZombieModeAI;
ai->owner = this; ai->owner = this;
#if 0 #if 0
++PerfMonitor::Instance()->entity_num[ET_Android]; ++PerfMonitor::Instance()->entity_num[ET_Android];

View File

@ -2,7 +2,7 @@
#include <float.h> #include <float.h>
#include "zombie.ai.h" #include "zombiemode.ai.h"
#include "android.h" #include "android.h"
#include "room.h" #include "room.h"
#include "metamgr.h" #include "metamgr.h"
@ -53,17 +53,17 @@ ai级别
8: 8:
*/ */
ZombieAI::ZombieAI() ZombieModeAI::ZombieModeAI()
{ {
node_ = new ZombieAINode(); node_ = new ZombieAINode();
} }
ZombieAI::~ZombieAI() ZombieModeAI::~ZombieModeAI()
{ {
A8_SAFE_DELETE(node_); A8_SAFE_DELETE(node_);
} }
void ZombieAI::Update(int delta_time) void ZombieModeAI::Update(int delta_time)
{ {
Human* hum = (Human*)owner; Human* hum = (Human*)owner;
if (hum->poisoning) { if (hum->poisoning) {
@ -81,7 +81,7 @@ void ZombieAI::Update(int delta_time)
UpdateAI(); UpdateAI();
} }
float ZombieAI::GetAttackRate() float ZombieModeAI::GetAttackRate()
{ {
if (!node_->ai_meta) { if (!node_->ai_meta) {
return 1; return 1;
@ -90,7 +90,7 @@ float ZombieAI::GetAttackRate()
} }
} }
void ZombieAI::UpdateAI() void ZombieModeAI::UpdateAI()
{ {
Human* hum = (Human*)owner; Human* hum = (Human*)owner;
if (a8::HasBitFlag(hum->status, HS_Disable)) { if (a8::HasBitFlag(hum->status, HS_Disable)) {
@ -145,7 +145,7 @@ void ZombieAI::UpdateAI()
} }
} }
void ZombieAI::UpdateIdle() void ZombieModeAI::UpdateIdle()
{ {
Human* hum = (Human*)owner; Human* hum = (Human*)owner;
if (hum->room->GetFrameNo() > node_->frameno + node_->param1) { if (hum->room->GetFrameNo() > node_->frameno + node_->param1) {
@ -153,7 +153,7 @@ void ZombieAI::UpdateIdle()
} }
} }
void ZombieAI::UpdateThinking() void ZombieModeAI::UpdateThinking()
{ {
Human* hum = (Human*)owner; Human* hum = (Human*)owner;
if (hum->room->GetGasData().gas_mode == GasInactive || if (hum->room->GetGasData().gas_mode == GasInactive ||
@ -183,7 +183,7 @@ void ZombieAI::UpdateThinking()
} }
} }
void ZombieAI::UpdateAttack() void ZombieModeAI::UpdateAttack()
{ {
Human* myself = (Human*)owner; Human* myself = (Human*)owner;
if (!node_->target || node_->target->dead) { if (!node_->target || node_->target->dead) {
@ -245,7 +245,7 @@ void ZombieAI::UpdateAttack()
} }
} }
void ZombieAI::UpdateRandomWalk() void ZombieModeAI::UpdateRandomWalk()
{ {
Human* hum = (Human*)owner; Human* hum = (Human*)owner;
if (hum->room->GetFrameNo() > node_->frameno + node_->param1) { if (hum->room->GetFrameNo() > node_->frameno + node_->param1) {
@ -253,7 +253,7 @@ void ZombieAI::UpdateRandomWalk()
} }
} }
void ZombieAI::UpdatePursuit() void ZombieModeAI::UpdatePursuit()
{ {
Human* myself = (Human*)owner; Human* myself = (Human*)owner;
float distance = myself->GetPos().Distance(node_->target->GetPos()); float distance = myself->GetPos().Distance(node_->target->GetPos());
@ -266,7 +266,7 @@ void ZombieAI::UpdatePursuit()
} }
} }
void ZombieAI::DoMove() void ZombieModeAI::DoMove()
{ {
Human* hum = (Human*)owner; Human* hum = (Human*)owner;
if (std::abs(hum->move_dir.x) > FLT_EPSILON || if (std::abs(hum->move_dir.x) > FLT_EPSILON ||
@ -290,7 +290,7 @@ void ZombieAI::DoMove()
} }
} }
void ZombieAI::ChangeToState(ZombieState_e to_state) void ZombieModeAI::ChangeToState(ZombieState_e to_state)
{ {
Human* hum = (Human*)owner; Human* hum = (Human*)owner;
switch (to_state) { switch (to_state) {
@ -361,7 +361,7 @@ void ZombieAI::ChangeToState(ZombieState_e to_state)
node_->exec_frame_num = 0; node_->exec_frame_num = 0;
} }
Human* ZombieAI::GetTarget() Human* ZombieModeAI::GetTarget()
{ {
if (GetAiLevel() <= 1) { if (GetAiLevel() <= 1) {
return nullptr; return nullptr;
@ -411,7 +411,7 @@ Human* ZombieAI::GetTarget()
return target; return target;
} }
float ZombieAI::GetAttackRange() float ZombieModeAI::GetAttackRange()
{ {
float attack_range = 0; float attack_range = 0;
Human* myself = (Human*)owner; Human* myself = (Human*)owner;
@ -424,7 +424,7 @@ float ZombieAI::GetAttackRange()
return attack_range; return attack_range;
} }
void ZombieAI::DoShot() void ZombieModeAI::DoShot()
{ {
Human* myself = (Human*)owner; Human* myself = (Human*)owner;
if (!node_->target) { if (!node_->target) {
@ -464,7 +464,7 @@ void ZombieAI::DoShot()
} }
} }
int ZombieAI::GetAttackTimes() int ZombieModeAI::GetAttackTimes()
{ {
Human* myself = (Human*)owner; Human* myself = (Human*)owner;
if (myself->curr_weapon) { if (myself->curr_weapon) {

View File

@ -13,12 +13,12 @@ enum ZombieState_e
class Human; class Human;
class ZombieAINode; class ZombieAINode;
class ZombieAI : public AIComponent class ZombieModeAI : public AIComponent
{ {
public: public:
ZombieAI(); ZombieModeAI();
virtual ~ZombieAI() override; virtual ~ZombieModeAI() override;
virtual void Update(int delta_time) override; virtual void Update(int delta_time) override;
float GetAttackRate(); float GetAttackRate();