2014-06-29 23:14:46 +02:00
|
|
|
#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;
|
2014-07-20 22:21:51 +02:00
|
|
|
float _fireStart;
|
|
|
|
float _fireStop;
|
|
|
|
|
|
|
|
void fireHitscan();
|
|
|
|
void fireProjectile();
|
2014-06-29 23:14:46 +02:00
|
|
|
public:
|
2014-07-20 22:21:51 +02:00
|
|
|
WeaponItem(CharacterObject* character, std::shared_ptr<WeaponData> data)
|
|
|
|
: InventoryItem(data->inventorySlot, data->modelID, character), _wepData(data),
|
|
|
|
_firing(false), _fireStart(0.f), _fireStop(0.f)
|
2014-06-29 23:14:46 +02:00
|
|
|
{}
|
|
|
|
|
2014-07-20 22:21:51 +02:00
|
|
|
void primary(bool active);
|
2014-06-29 23:14:46 +02:00
|
|
|
|
2014-07-20 22:21:51 +02:00
|
|
|
void secondary(bool active);
|
2014-06-29 23:14:46 +02:00
|
|
|
|
|
|
|
bool isFiring() const { return _firing; }
|
|
|
|
|
2014-07-20 22:21:51 +02:00
|
|
|
void fire();
|
|
|
|
|
2014-06-29 23:14:46 +02:00
|
|
|
std::shared_ptr<WeaponData>& getWeaponData() { return _wepData; }
|
|
|
|
};
|
|
|
|
|
|
|
|
#endif
|