53 lines
1.2 KiB
C++
53 lines
1.2 KiB
C++
#ifndef WEAPON_BASE_H
|
|
#define WEAPON_BASE_H
|
|
|
|
#include "scene/3d/node_3d.h"
|
|
class AnimationPlayer;
|
|
class PlayerCamera;
|
|
class PlayerBody;
|
|
class PlayerInput;
|
|
|
|
class WeaponBase : public Node3D {
|
|
GDCLASS(WeaponBase, Node3D);
|
|
static void _bind_methods();
|
|
void ready();
|
|
|
|
protected:
|
|
void _notification(int what);
|
|
virtual PackedStringArray get_configuration_warnings() const override;
|
|
|
|
public:
|
|
bool is_animating() const;
|
|
void set_anim(AnimationPlayer *player);
|
|
AnimationPlayer *get_anim() const;
|
|
PlayerInput *get_input() const;
|
|
PlayerCamera *get_camera() const;
|
|
|
|
void set_body(PlayerBody *body);
|
|
PlayerBody *get_body() const;
|
|
|
|
void set_max_ammo(int amount);
|
|
int get_max_ammo() const;
|
|
void set_loaded_ammo(int amount);
|
|
int get_loaded_ammo() const;
|
|
bool try_use_ammo(int amount = 1);
|
|
bool ammo_empty() const;
|
|
void reload_full();
|
|
void reload_num(int num);
|
|
|
|
virtual bool allows_running() const { return false; }
|
|
virtual bool allows_jumping() const { return true; }
|
|
virtual void notify_selected() {}
|
|
|
|
private:
|
|
PlayerInput *input{ nullptr };
|
|
AnimationPlayer *anim{ nullptr };
|
|
PlayerCamera *camera{ nullptr };
|
|
PlayerBody *body{ nullptr };
|
|
|
|
int loaded_ammo{ 0 };
|
|
int max_ammo{ 1 };
|
|
};
|
|
|
|
#endif // !WEAPON_BASE_H
|