generated from Persson-dev/Godot-Xmake
51 lines
1.6 KiB
C++
51 lines
1.6 KiB
C++
#pragma once
|
|
|
|
#include "BoneCollisionShape.h"
|
|
#include "FirstPersonPlayer.h"
|
|
#include <godot_cpp/classes/animation_node_state_machine_playback.hpp>
|
|
#include <godot_cpp/classes/animation_tree.hpp>
|
|
#include <godot_cpp/classes/character_body3d.hpp>
|
|
#include <godot_cpp/classes/navigation_agent3d.hpp>
|
|
#include <godot_cpp/variant/node_path.hpp>
|
|
#include <godot_cpp/variant/string_name.hpp>
|
|
#include <godot_cpp/classes/timer.hpp>
|
|
|
|
namespace blitz {
|
|
|
|
class Zombie : public godot::CharacterBody3D {
|
|
GDCLASS(Zombie, godot::CharacterBody3D)
|
|
protected:
|
|
static void _bind_methods();
|
|
|
|
public:
|
|
Zombie();
|
|
~Zombie();
|
|
|
|
void _ready();
|
|
void _process(float delta);
|
|
bool _target_in_range();
|
|
void _on_area_3d_a_zombie_head_shot_hit(int dam);
|
|
void _on_area_3d_a_zombie_body_shot_hit(int dam);
|
|
|
|
private:
|
|
godot::NavigationAgent3D* m_NavigationAgent;
|
|
FirstPersonPlayer* m_Player;
|
|
godot::NodePath m_PlayerPath;
|
|
godot::Vector3 m_Velocity;
|
|
godot::AnimationTree* m_AnimationTree;
|
|
godot::AnimationNodeStateMachinePlayback* m_StateMachine;
|
|
BoneCollisionShape* m_HeadCollision;
|
|
std::vector<godot::StringName> m_BodyPartsCollision = {"Neck", "Spine", "Hips", "LeftArm", "LeftForearm", "LeftHand", "RightArm",
|
|
"RightForearm", "RightHand", "LeftUpLeg", "RightUpLeg", "LeftLeg", "RightLeg", "LeftFoot", "RightFoot"};
|
|
int m_Health = 6;
|
|
godot::Timer* m_Timer;
|
|
|
|
void set_m_PlayerPath(const godot::NodePath& path);
|
|
godot::NodePath get_m_PlayerPath() const;
|
|
void hit_finished();
|
|
void apply_damage(int dam);
|
|
void connect_collision_shapes(const std::vector<godot::StringName>& body_parts);
|
|
void _on_timer_timeout();
|
|
};
|
|
|
|
} // namespace blitz
|