feat: implemented basics for weapons
This commit is contained in:
parent
6fa9d11af5
commit
aecc40ed6e
15 changed files with 163 additions and 51 deletions
|
|
@ -1,6 +1,8 @@
|
|||
#include "weapon_base.h"
|
||||
#include "macros.h"
|
||||
#include "player_body.h"
|
||||
#include "player_camera.h"
|
||||
#include "player_input.h"
|
||||
#include "scene/animation/animation_player.h"
|
||||
|
||||
void WeaponBase::_bind_methods() {
|
||||
|
|
@ -8,7 +10,9 @@ void WeaponBase::_bind_methods() {
|
|||
}
|
||||
|
||||
void WeaponBase::ready() {
|
||||
this->camera = cast_to<PlayerCamera>(get_node(NodePath("%PlayerCamera")));
|
||||
this->input = cast_to<PlayerInput>(get_parent()->get_node(NodePath("%PlayerInput")));
|
||||
this->camera = cast_to<PlayerCamera>(get_parent());
|
||||
this->body = cast_to<PlayerBody>(get_parent()->get_owner());
|
||||
if (this->anim) {
|
||||
this->anim->play("RESET");
|
||||
}
|
||||
|
|
@ -34,6 +38,10 @@ AnimationPlayer *WeaponBase::get_anim() const {
|
|||
return this->anim;
|
||||
}
|
||||
|
||||
PlayerInput *WeaponBase::get_input() const {
|
||||
return this->input;
|
||||
}
|
||||
|
||||
PlayerCamera *WeaponBase::get_camera() const {
|
||||
return this->camera;
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue