feat: added weapon muzzle, which will register itself with parent playercharacters
This commit is contained in:
parent
a81fc5ad21
commit
18ec109b86
|
@ -9,6 +9,7 @@
|
||||||
#include "tunnels_game_state.hpp"
|
#include "tunnels_game_state.hpp"
|
||||||
#include "tunnels_player.hpp"
|
#include "tunnels_player.hpp"
|
||||||
#include "weapon_data.hpp"
|
#include "weapon_data.hpp"
|
||||||
|
#include "weapon_muzzle.hpp"
|
||||||
#include "utils/game_mode.hpp"
|
#include "utils/game_mode.hpp"
|
||||||
#include "utils/game_root.hpp"
|
#include "utils/game_root.hpp"
|
||||||
#include "utils/game_state.hpp"
|
#include "utils/game_state.hpp"
|
||||||
|
@ -35,16 +36,21 @@ void initialize_gdextension_types(ModuleInitializationLevel p_level)
|
||||||
ClassDB::register_class<PlayerInput>();
|
ClassDB::register_class<PlayerInput>();
|
||||||
ClassDB::register_class<SpawnPoint3D>();
|
ClassDB::register_class<SpawnPoint3D>();
|
||||||
|
|
||||||
ClassDB::register_class<CharacterData>();
|
|
||||||
ClassDB::register_class<Enemy>();
|
|
||||||
ClassDB::register_class<Health>();
|
|
||||||
ClassDB::register_class<PelletProjectile>();
|
|
||||||
ClassDB::register_class<PlayerCharacter>();
|
|
||||||
ClassDB::register_class<ProjectilePool>();
|
|
||||||
ClassDB::register_class<TunnelsGameMode>();
|
ClassDB::register_class<TunnelsGameMode>();
|
||||||
ClassDB::register_class<TunnelsGameState>();
|
ClassDB::register_class<TunnelsGameState>();
|
||||||
ClassDB::register_class<TunnelsPlayer>();
|
ClassDB::register_class<TunnelsPlayer>();
|
||||||
|
|
||||||
|
ClassDB::register_class<Enemy>();
|
||||||
|
ClassDB::register_class<Health>();
|
||||||
|
ClassDB::register_class<PlayerCharacter>();
|
||||||
|
ClassDB::register_class<ProjectilePool>();
|
||||||
|
ClassDB::register_class<WeaponMuzzle>();
|
||||||
|
|
||||||
ClassDB::register_class<WeaponData>();
|
ClassDB::register_class<WeaponData>();
|
||||||
|
ClassDB::register_class<CharacterData>();
|
||||||
|
|
||||||
|
ClassDB::register_class<Projectile>();
|
||||||
|
ClassDB::register_class<PelletProjectile>();
|
||||||
}
|
}
|
||||||
|
|
||||||
extern "C"
|
extern "C"
|
||||||
|
|
16
src/weapon_muzzle.cpp
Normal file
16
src/weapon_muzzle.cpp
Normal file
|
@ -0,0 +1,16 @@
|
||||||
|
#include "weapon_muzzle.hpp"
|
||||||
|
#include "player_character.hpp"
|
||||||
|
#include "utils/godot_macros.h"
|
||||||
|
|
||||||
|
namespace godot {
|
||||||
|
void WeaponMuzzle::_bind_methods() {
|
||||||
|
#define CLASSNAME WeaponMuzzle
|
||||||
|
}
|
||||||
|
|
||||||
|
void WeaponMuzzle::_enter_tree() { GDGAMEONLY();
|
||||||
|
PlayerCharacter *owner = Object::cast_to<PlayerCharacter>(this->get_owner());
|
||||||
|
if(!owner)
|
||||||
|
return;
|
||||||
|
owner->set_weapon_muzzle(this);
|
||||||
|
}
|
||||||
|
}
|
15
src/weapon_muzzle.hpp
Normal file
15
src/weapon_muzzle.hpp
Normal file
|
@ -0,0 +1,15 @@
|
||||||
|
#ifndef WEAPON_MUZZLE_HPP
|
||||||
|
#define WEAPON_MUZZLE_HPP
|
||||||
|
|
||||||
|
#include "godot_cpp/classes/node3d.hpp"
|
||||||
|
|
||||||
|
namespace godot {
|
||||||
|
class WeaponMuzzle : public Node3D {
|
||||||
|
GDCLASS(WeaponMuzzle, Node3D);
|
||||||
|
static void _bind_methods();
|
||||||
|
public:
|
||||||
|
virtual void _enter_tree() override;
|
||||||
|
};
|
||||||
|
}
|
||||||
|
|
||||||
|
#endif // !WEAPON_MUZZLE_HPP
|
Loading…
Reference in a new issue