1
This commit is contained in:
parent
e1970a647a
commit
bf5e70c166
@ -17,6 +17,7 @@ class AIComponent
|
||||
{
|
||||
public:
|
||||
MoveableEntity* owner = nullptr;
|
||||
MetaData::AI* ai_meta = nullptr;
|
||||
|
||||
virtual ~AIComponent();
|
||||
virtual void Update(int delta_time);
|
||||
|
@ -47,7 +47,6 @@ private:
|
||||
|
||||
OldAiData* old_ai_data_ = nullptr;
|
||||
|
||||
MetaData::AI* ai_meta = nullptr;
|
||||
AINode* node_ = nullptr;
|
||||
bool moving_ = false;
|
||||
};
|
||||
|
@ -14,7 +14,7 @@ public:
|
||||
virtual void Update(int delta_time) override;
|
||||
float GetAttackRate();
|
||||
|
||||
private:
|
||||
protected:
|
||||
void UpdateAI();
|
||||
void UpdateIdle();
|
||||
void UpdateThinking();
|
||||
@ -30,8 +30,7 @@ private:
|
||||
float GetAttackRange();
|
||||
int GetAttackTimes();
|
||||
|
||||
private:
|
||||
MetaData::AI* ai_meta = nullptr;
|
||||
protected:
|
||||
HeroAINode* node_ = nullptr;
|
||||
bool moving_ = false;
|
||||
};
|
||||
|
@ -254,6 +254,12 @@ void Hero::InitAI()
|
||||
if (!ai_meta) {
|
||||
abort();
|
||||
}
|
||||
if (ai_meta->i->ai_kind() == kAI_MineSweeper) {
|
||||
ai = new MineSweeperAI;
|
||||
ai->ai_meta = ai_meta;
|
||||
} else {
|
||||
ai = new HeroAI;
|
||||
ai->ai_meta = ai_meta;
|
||||
}
|
||||
ai->owner = this;
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user