mirror of
https://github.com/rwengine/openrw.git
synced 2024-11-07 19:32:49 +01:00
36 lines
746 B
C++
36 lines
746 B
C++
#pragma once
|
|
#ifndef _WEAPONITEM_HPP_
|
|
#define _WEAPONITEM_HPP_
|
|
#include <items/InventoryItem.hpp>
|
|
#include <data/WeaponData.hpp>
|
|
#include <memory>
|
|
|
|
class WeaponItem : public InventoryItem
|
|
{
|
|
std::shared_ptr<WeaponData> _wepData;
|
|
|
|
bool _firing;
|
|
float _fireStart;
|
|
float _fireStop;
|
|
|
|
void fireHitscan();
|
|
void fireProjectile();
|
|
public:
|
|
WeaponItem(CharacterObject* character, std::shared_ptr<WeaponData> data)
|
|
: InventoryItem(data->inventorySlot, data->modelID, character), _wepData(data),
|
|
_firing(false), _fireStart(0.f), _fireStop(0.f)
|
|
{}
|
|
|
|
void primary(bool active);
|
|
|
|
void secondary(bool active);
|
|
|
|
bool isFiring() const { return _firing; }
|
|
|
|
void fire();
|
|
|
|
std::shared_ptr<WeaponData>& getWeaponData() { return _wepData; }
|
|
};
|
|
|
|
#endif
|