feat: defining map region unit un-/registering behaviour
This commit is contained in:
parent
92c38e54b6
commit
d8ae45df0f
7 changed files with 87 additions and 1 deletions
|
|
@ -6,6 +6,15 @@ void EnemyBody::_bind_methods() {
|
|||
ClassDB::bind_method(D_METHOD("set_movement_direction", "direction"), &self_type::set_movement_direction);
|
||||
}
|
||||
|
||||
void EnemyBody::on_child_added(Node *node) {
|
||||
if (StateMachine *fsm{ cast_to<StateMachine>(node) }) {
|
||||
this->fsm = fsm;
|
||||
}
|
||||
if (NavigationAgent3D *nav{ cast_to<NavigationAgent3D>(node) }) {
|
||||
this->nav = nav;
|
||||
}
|
||||
}
|
||||
|
||||
void EnemyBody::ready() {
|
||||
this->fsm = cast_to<StateMachine>(get_node(NodePath("%StateMachine")));
|
||||
this->nav = cast_to<NavigationAgent3D>(get_node(NodePath("%NavigationAgent3D")));
|
||||
|
|
@ -50,6 +59,10 @@ NpcUnit *EnemyBody::get_unit() const {
|
|||
return this->unit;
|
||||
}
|
||||
|
||||
HealthStatus *EnemyBody::get_health() const {
|
||||
return this->health;
|
||||
}
|
||||
|
||||
NavigationAgent3D *EnemyBody::get_nav() const {
|
||||
return this->nav;
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue