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