generated from Persson-dev/Godot-Xmake
Collision of zombie body parts completed and different damage added depending on the body part hit
This commit is contained in:
10
src/Zombie.h
10
src/Zombie.h
@@ -1,11 +1,13 @@
|
||||
#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>
|
||||
|
||||
namespace blitz {
|
||||
|
||||
@@ -21,6 +23,8 @@ class Zombie : public godot::CharacterBody3D {
|
||||
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;
|
||||
@@ -29,10 +33,16 @@ class Zombie : public godot::CharacterBody3D {
|
||||
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;
|
||||
|
||||
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);
|
||||
};
|
||||
|
||||
} // namespace blitz
|
||||
Reference in New Issue
Block a user