#ifndef PLAYER_ANIM_TREE_HPP #define PLAYER_ANIM_TREE_HPP #include "utils/godot_macros.hpp" #include #include namespace gd = godot; class PlayerAnimTree : public gd::AnimationTree { GDCLASS(PlayerAnimTree, gd::AnimationTree); static void _bind_methods(); public: enum Tags : unsigned { None = 0x0, Turn = 0x1, Aim = 0x2 }; public: virtual void _ready() override; virtual void _process(double delta) override; void set_target_turn_speed(float value); float get_target_turn_speed() const; void set_is_walking(bool value); bool get_is_walking() const; void set_walk_speed(float value); float get_walk_speed() const; void set_is_running(); bool get_is_running() const; void set_aim_weapon(bool value); bool get_aim_weapon() const; void set_fire_weapon(); bool get_fire_weapon(); bool match_tags(Tags tags) const; private: void update_tags(gd::StringName const &anim); void commit_turn_speed(); void commit_walk_speed(); private: gd::Ref fsm; float turn_speed{0.f}; float target_turn_speed{0.f}; bool is_walking{false}; float walk_speed{0.f}; double running_time{0.0}; bool aim_weapon{false}; double fire_weapon{0.0}; Tags current_tags{Tags::None}; gd::StringName last_known_anim{}; }; #endif // !PLAYER_ANIM_HPP