58 lines
		
	
	
		
			1.4 KiB
		
	
	
	
		
			C++
		
	
	
	
	
	
			
		
		
	
	
			58 lines
		
	
	
		
			1.4 KiB
		
	
	
	
		
			C++
		
	
	
	
	
	
#ifndef WEAPONS_REVOLVER_H
 | 
						|
#define WEAPONS_REVOLVER_H
 | 
						|
 | 
						|
#include "wave_survival/hitscan_muzzle.h"
 | 
						|
#include "wave_survival/weapon_base.h"
 | 
						|
 | 
						|
class Revolver : public WeaponBase {
 | 
						|
	GDCLASS(Revolver, WeaponBase);
 | 
						|
	static void _bind_methods();
 | 
						|
	void queue_idle_anim();
 | 
						|
	void start_running();
 | 
						|
	void stop_running();
 | 
						|
	void start_reloading();
 | 
						|
	void stop_reloading();
 | 
						|
	void interrupt_reloading();
 | 
						|
	void interrupt_running();
 | 
						|
	void play_equip_anim();
 | 
						|
	void shoot();
 | 
						|
	void cock_hammer();
 | 
						|
	void on_primary_fire(bool pressed);
 | 
						|
	void on_alt_mode(bool pressed);
 | 
						|
	void on_reload();
 | 
						|
	void on_animation_changed(String old_anim, String new_anim);
 | 
						|
	void on_animation_finished(String old_anim);
 | 
						|
	void ready();
 | 
						|
	void process(double delta);
 | 
						|
 | 
						|
	bool animation_is_idle() const;
 | 
						|
 | 
						|
protected:
 | 
						|
	void _notification(int what);
 | 
						|
	virtual void notify_selected() override;
 | 
						|
	virtual void notify_deselected() override;
 | 
						|
	virtual bool allows_running() const override;
 | 
						|
 | 
						|
public:
 | 
						|
	void start_recoil();
 | 
						|
	void set_single_action_spread(float value);
 | 
						|
	float get_single_action_spread() const;
 | 
						|
	void set_double_action_spread(float value);
 | 
						|
	float get_double_action_spread() const;
 | 
						|
 | 
						|
private:
 | 
						|
	float single_action_spread{ 0.01f };
 | 
						|
	float double_action_spread{ 0.03f };
 | 
						|
	bool alt_active{ false };
 | 
						|
	HitscanMuzzle *muzzle{ nullptr };
 | 
						|
 | 
						|
	float recoil_force{ 2.f };
 | 
						|
	double recoil_time{ 0.1 };
 | 
						|
	double recoil_timer{ 0.0 };
 | 
						|
 | 
						|
	double run_animation_delay{ 0.4 };
 | 
						|
	double run_animation_timer{ 0.0 };
 | 
						|
};
 | 
						|
 | 
						|
#endif // !WEAPONS_REVOLVER_H
 |