1
This commit is contained in:
parent
ee6108b632
commit
96f317ea1a
@ -9,6 +9,7 @@ class AIComponent
|
||||
virtual ~AIComponent();
|
||||
virtual void Update(int delta_time);
|
||||
virtual float GetAttackRate() { return 0;};
|
||||
virtual void Reset() {};
|
||||
void SetAiLevel(int ai_level);
|
||||
void SetAiMode(int ai_mode);
|
||||
int GetAiLevel();
|
||||
|
@ -303,6 +303,13 @@ enum RaceType_e
|
||||
kZombieRace = 2
|
||||
};
|
||||
|
||||
enum AIMode_e
|
||||
{
|
||||
kChiJiAiMode = 0,
|
||||
kHumanAiMode = 1,
|
||||
kZombieAiMode = 2
|
||||
};
|
||||
|
||||
const char* const PROJ_NAME_FMT = "game%d_gameserver";
|
||||
const char* const PROJ_ROOT_FMT = "/data/logs/%s";
|
||||
|
||||
|
@ -22,6 +22,7 @@
|
||||
#include "player.h"
|
||||
#include "buff.h"
|
||||
#include "roomobstacle.h"
|
||||
#include "aicomponent.h"
|
||||
|
||||
#include "framework/cpp/utils.h"
|
||||
#include "framework/cpp/httpclientpool.h"
|
||||
@ -1923,6 +1924,15 @@ void Human::ChangeToRace(RaceType_e race, int level)
|
||||
race != kZombieRace) {
|
||||
abort();
|
||||
}
|
||||
if (race_ != race && IsAndroid()) {
|
||||
Android* android = (Android*)this;
|
||||
android->ai->Reset();
|
||||
if (race == kHumanRace) {
|
||||
android->ai->SetAiMode(kHumanAiMode);
|
||||
} else if (race == kZombieRace) {
|
||||
android->ai->SetAiMode(kZombieAiMode);
|
||||
}
|
||||
}
|
||||
race_ = race;
|
||||
level_ = level;
|
||||
if (race_ == kHumanRace) {
|
||||
|
@ -81,6 +81,13 @@ void ZombieModeAI::Update(int delta_time)
|
||||
UpdateAI();
|
||||
}
|
||||
|
||||
void ZombieModeAI::Reset()
|
||||
{
|
||||
ChangeToState(ZSE_Idle);
|
||||
node_->param1 = 2;
|
||||
node_->ai_meta = nullptr;
|
||||
}
|
||||
|
||||
float ZombieModeAI::GetAttackRate()
|
||||
{
|
||||
if (!node_->ai_meta) {
|
||||
|
@ -20,6 +20,7 @@ public:
|
||||
ZombieModeAI();
|
||||
virtual ~ZombieModeAI() override;
|
||||
virtual void Update(int delta_time) override;
|
||||
virtual void Reset() override;
|
||||
float GetAttackRate();
|
||||
|
||||
private:
|
||||
|
Loading…
x
Reference in New Issue
Block a user