feat: initialized template and wrote first gameplay code
This commit is contained in:
parent
82f2cae0f6
commit
46a958f801
47 changed files with 1093 additions and 33 deletions
39
modules/wave_survival/weapon_base.cpp
Normal file
39
modules/wave_survival/weapon_base.cpp
Normal file
|
|
@ -0,0 +1,39 @@
|
|||
#include "weapon_base.h"
|
||||
#include "macros.h"
|
||||
#include "player_camera.h"
|
||||
#include "scene/animation/animation_player.h"
|
||||
|
||||
void WeaponBase::_bind_methods() {
|
||||
BIND_HPROPERTY(Variant::OBJECT, anim, PROPERTY_HINT_NODE_TYPE, AnimationPlayer::get_class_static());
|
||||
}
|
||||
|
||||
void WeaponBase::ready() {
|
||||
this->camera = cast_to<PlayerCamera>(get_node(NodePath("%PlayerCamera")));
|
||||
if (this->anim) {
|
||||
this->anim->play("RESET");
|
||||
}
|
||||
}
|
||||
|
||||
void WeaponBase::_notification(int what) {
|
||||
if (Engine::get_singleton()->is_editor_hint()) {
|
||||
return;
|
||||
}
|
||||
switch (what) {
|
||||
default:
|
||||
return;
|
||||
case NOTIFICATION_READY:
|
||||
ready();
|
||||
}
|
||||
}
|
||||
|
||||
void WeaponBase::set_anim(AnimationPlayer *anim) {
|
||||
this->anim = anim;
|
||||
}
|
||||
|
||||
AnimationPlayer *WeaponBase::get_anim() const {
|
||||
return this->anim;
|
||||
}
|
||||
|
||||
PlayerCamera *WeaponBase::get_camera() const {
|
||||
return this->camera;
|
||||
}
|
||||
Loading…
Add table
Add a link
Reference in a new issue