feat: animation/activate actions use scene unique names now
This commit is contained in:
parent
d8a3000b13
commit
c1b676f335
|
@ -72,13 +72,26 @@ double MoveTo::get_repath_interval() const {
|
|||
|
||||
void Activate::_bind_methods() {}
|
||||
|
||||
void Activate::_ready() {
|
||||
this->anim = this->get_parent()->get_node<gd::AnimationPlayer>("%AnimationPlayer");
|
||||
if(!this->anim->has_animation(this->animation))
|
||||
this->end_state();
|
||||
else this->anim->play(this->animation);
|
||||
}
|
||||
|
||||
void Activate::_process(double) {
|
||||
bool const animation_finished{!this->anim->is_playing() || this->anim->get_current_animation() != this->animation};
|
||||
if(this->is_action_done_interrupt() || animation_finished)
|
||||
this->end_state();
|
||||
}
|
||||
|
||||
void Animate::_bind_methods() {}
|
||||
|
||||
void Animate::_ready() {
|
||||
this->anim = this->get_node<gd::AnimationPlayer>("../AnimationPlayer");
|
||||
this->anim->play(this->animation);
|
||||
this->anim = this->get_parent()->get_node<gd::AnimationPlayer>("%AnimationPlayer");
|
||||
if(!this->anim->has_animation(this->animation))
|
||||
this->end_state();
|
||||
else this->anim->play(this->animation);
|
||||
}
|
||||
|
||||
void Animate::_process(double) {
|
||||
|
|
|
@ -34,8 +34,12 @@ class Activate : public goap::State {
|
|||
GDCLASS(Activate, goap::State);
|
||||
static void _bind_methods();
|
||||
public:
|
||||
virtual void _ready() override;
|
||||
virtual void _process(double) override;
|
||||
gd::Node3D *target_node{nullptr};
|
||||
gd::String animation{};
|
||||
private:
|
||||
gd::AnimationPlayer *anim{nullptr};
|
||||
};
|
||||
|
||||
class Animate : public goap::State {
|
||||
|
|
Loading…
Reference in a new issue